Skip to content

Commit 3e0db5e

Browse files
committed
Remove all public reexports
They're leftovers from the enum namespacing transition Other than removing public reexports, I also had to publicize a type (compile::InstIdx). It should have always been public but was no error was never given because of this bug: rust-lang/rust#6477 I also had to enable documentation for compile::Ist because it was complaining that there wasn't any.
1 parent 4fd8fb5 commit 3e0db5e

File tree

5 files changed

+51
-56
lines changed

5 files changed

+51
-56
lines changed

src/compile.rs

+31-32
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,62 @@
1111
// Enable this to squash warnings due to exporting pieces of the representation
1212
// for use with the regex! macro. See lib.rs for explanation.
1313

14-
pub use self::Inst::*;
14+
use self::Inst::*;
1515

1616
use std::cmp;
1717
use parse;
18-
use parse::{
19-
Flags, FLAG_EMPTY,
20-
Nothing, Literal, Dot, AstClass, Begin, End, WordBoundary, Capture, Cat, Alt,
21-
Rep,
22-
ZeroOne, ZeroMore, OneMore,
23-
};
18+
use parse::{Flags, FLAG_EMPTY};
19+
use parse::Ast::{Nothing, Literal, Dot, AstClass, Begin, End, WordBoundary, Capture, Cat, Alt,
20+
Rep};
21+
use parse::Repeater::{ZeroOne, ZeroMore, OneMore};
2422

25-
type InstIdx = uint;
23+
pub type InstIdx = uint;
2624

25+
/// An instruction, the underlying unit of a compiled regular expression
2726
#[deriving(Show, Clone)]
2827
pub enum Inst {
29-
// When a Match instruction is executed, the current thread is successful.
28+
/// When a Match instruction is executed, the current thread is successful.
3029
Match,
3130

32-
// The OneChar instruction matches a literal character.
33-
// The flags indicate whether to do a case insensitive match.
31+
/// The OneChar instruction matches a literal character.
32+
/// The flags indicate whether to do a case insensitive match.
3433
OneChar(char, Flags),
3534

36-
// The CharClass instruction tries to match one input character against
37-
// the range of characters given.
38-
// The flags indicate whether to do a case insensitive match and whether
39-
// the character class is negated or not.
35+
/// The CharClass instruction tries to match one input character against
36+
/// the range of characters given.
37+
/// The flags indicate whether to do a case insensitive match and whether
38+
/// the character class is negated or not.
4039
CharClass(Vec<(char, char)>, Flags),
4140

42-
// Matches any character except new lines.
43-
// The flags indicate whether to include the '\n' character.
41+
/// Matches any character except new lines.
42+
/// The flags indicate whether to include the '\n' character.
4443
Any(Flags),
4544

46-
// Matches the beginning of the string, consumes no characters.
47-
// The flags indicate whether it matches if the preceding character
48-
// is a new line.
45+
/// Matches the beginning of the string, consumes no characters.
46+
/// The flags indicate whether it matches if the preceding character
47+
/// is a new line.
4948
EmptyBegin(Flags),
5049

51-
// Matches the end of the string, consumes no characters.
52-
// The flags indicate whether it matches if the proceeding character
53-
// is a new line.
50+
/// Matches the end of the string, consumes no characters.
51+
/// The flags indicate whether it matches if the proceeding character
52+
/// is a new line.
5453
EmptyEnd(Flags),
5554

56-
// Matches a word boundary (\w on one side and \W \A or \z on the other),
57-
// and consumes no character.
58-
// The flags indicate whether this matches a word boundary or something
59-
// that isn't a word boundary.
55+
/// Matches a word boundary (\w on one side and \W \A or \z on the other),
56+
/// and consumes no character.
57+
/// The flags indicate whether this matches a word boundary or something
58+
/// that isn't a word boundary.
6059
EmptyWordBoundary(Flags),
6160

62-
// Saves the current position in the input string to the Nth save slot.
61+
/// Saves the current position in the input string to the Nth save slot.
6362
Save(uint),
6463

65-
// Jumps to the instruction at the index given.
64+
/// Jumps to the instruction at the index given.
6665
Jump(InstIdx),
6766

68-
// Jumps to the instruction at the first index given. If that leads to
69-
// a panic state, then the instruction at the second index given is
70-
// tried.
67+
/// Jumps to the instruction at the first index given. If that leads to
68+
/// a panic state, then the instruction at the second index given is
69+
/// tried.
7170
Split(InstIdx, InstIdx),
7271
}
7372

src/lib.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -400,19 +400,16 @@ pub mod native {
400400
//
401401
// On the bright side, `rustdoc` lets us hide this from the public API
402402
// documentation.
403-
pub use compile::{
404-
Program,
405-
OneChar, CharClass, Any, Save, Jump, Split,
406-
Match, EmptyBegin, EmptyEnd, EmptyWordBoundary,
407-
};
403+
pub use compile::Program;
404+
pub use compile::Inst::{Match, OneChar, CharClass, Any, EmptyBegin, EmptyEnd,
405+
EmptyWordBoundary, Save, Jump, Split};
408406
pub use parse::{
409407
FLAG_EMPTY, FLAG_NOCASE, FLAG_MULTI, FLAG_DOTNL,
410408
FLAG_SWAP_GREED, FLAG_NEGATED,
411409
};
412-
pub use re::{Dynamic, ExDynamic, Native, ExNative};
413-
pub use vm::{
414-
MatchKind, Exists, Location, Submatches,
415-
StepState, StepMatchEarlyReturn, StepMatch, StepContinue,
416-
CharReader, find_prefix,
417-
};
410+
pub use re::{ExDynamic, ExNative};
411+
pub use re::Regex::{Dynamic, Native};
412+
pub use vm::{CharReader, find_prefix};
413+
pub use vm::MatchKind::{mod, Exists, Location, Submatches};
414+
pub use vm::StepState::{mod, StepMatchEarlyReturn, StepMatch, StepContinue};
418415
}

src/parse.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub use self::Ast::*;
12-
pub use self::Repeater::*;
13-
pub use self::Greed::*;
11+
use self::Ast::*;
12+
use self::Repeater::*;
13+
use self::Greed::*;
1414
use self::BuildAst::*;
1515

1616
use std::char;

src/re.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub use self::NamesIter::*;
12-
pub use self::Regex::*;
11+
use self::NamesIter::*;
12+
use self::Regex::*;
1313

1414
use std::collections::HashMap;
1515
use std::fmt;
@@ -18,7 +18,8 @@ use std::str::CowString;
1818
use compile::Program;
1919
use parse;
2020
use vm;
21-
use vm::{CaptureLocs, MatchKind, Exists, Location, Submatches};
21+
use vm::CaptureLocs;
22+
use vm::MatchKind::{mod, Exists, Location, Submatches};
2223

2324
/// Escapes all regular expression meta characters in `text`.
2425
///

src/vm.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,15 @@
3333
//
3434
// [1] - http://swtch.com/~rsc/regex/regex3.html
3535

36-
pub use self::MatchKind::*;
37-
pub use self::StepState::*;
36+
use self::MatchKind::*;
37+
use self::StepState::*;
3838

3939
use std::cmp;
4040
use std::mem;
4141
use std::slice::SliceExt;
42-
use compile::{
43-
Program,
44-
Match, OneChar, CharClass, Any, EmptyBegin, EmptyEnd, EmptyWordBoundary,
45-
Save, Jump, Split,
46-
};
42+
use compile::Program;
43+
use compile::Inst::{Match, OneChar, CharClass, Any, EmptyBegin, EmptyEnd, EmptyWordBoundary,
44+
Save, Jump, Split};
4745
use parse::{FLAG_NOCASE, FLAG_MULTI, FLAG_DOTNL, FLAG_NEGATED};
4846
use unicode::regex::PERLW;
4947

0 commit comments

Comments
 (0)