Skip to content

Commit 2634fa4

Browse files
committed
---
yaml --- r: 137693 b: refs/heads/auto c: a64bb66 h: refs/heads/master i: 137691: 2013183 v: v3
1 parent f09f708 commit 2634fa4

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: abb1b2a309acfca78e89e6dac574f94a0ce4d916
16+
refs/heads/auto: a64bb6623c0732e2b3f7f371f375dc70b58629b7
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libregex/parse.rs

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ impl BuildAst {
162162
/// expression.
163163
pub type Flags = u8;
164164

165-
pub static FLAG_EMPTY: u8 = 0;
166-
pub static FLAG_NOCASE: u8 = 1 << 0; // i
167-
pub static FLAG_MULTI: u8 = 1 << 1; // m
168-
pub static FLAG_DOTNL: u8 = 1 << 2; // s
169-
pub static FLAG_SWAP_GREED: u8 = 1 << 3; // U
170-
pub static FLAG_NEGATED: u8 = 1 << 4; // char class or not word boundary
165+
pub const FLAG_EMPTY: u8 = 0;
166+
pub const FLAG_NOCASE: u8 = 1 << 0; // i
167+
pub const FLAG_MULTI: u8 = 1 << 1; // m
168+
pub const FLAG_DOTNL: u8 = 1 << 2; // s
169+
pub const FLAG_SWAP_GREED: u8 = 1 << 3; // U
170+
pub const FLAG_NEGATED: u8 = 1 << 4; // char class or not word boundary
171171

172172
struct Parser<'a> {
173173
// The input, parsed only as a sequence of UTF8 code points.
@@ -1025,7 +1025,7 @@ fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
10251025
}
10261026

10271027
type Class = &'static [(char, char)];
1028-
type NamedClasses = &'static [(&'static str, Class)];
1028+
type NamedClasses = &'static [(&'static str, &'static Class)];
10291029

10301030
static ASCII_CLASSES: NamedClasses = &[
10311031
// Classes must be in alphabetical order so that bsearch works.
@@ -1044,19 +1044,34 @@ static ASCII_CLASSES: NamedClasses = &[
10441044
// [:word:] word characters (== [0-9A-Za-z_])
10451045
// [:xdigit:] hex digit (== [0-9A-Fa-f])
10461046
// Taken from: http://golang.org/pkg/regex/syntax/
1047-
("alnum", &[('0', '9'), ('A', 'Z'), ('a', 'z')]),
1048-
("alpha", &[('A', 'Z'), ('a', 'z')]),
1049-
("ascii", &[('\x00', '\x7F')]),
1050-
("blank", &[(' ', ' '), ('\t', '\t')]),
1051-
("cntrl", &[('\x00', '\x1F'), ('\x7F', '\x7F')]),
1052-
("digit", &[('0', '9')]),
1053-
("graph", &[('!', '~')]),
1054-
("lower", &[('a', 'z')]),
1055-
("print", &[(' ', '~')]),
1056-
("punct", &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')]),
1057-
("space", &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'), ('\x0C', '\x0C'),
1058-
('\r', '\r'), (' ', ' ')]),
1059-
("upper", &[('A', 'Z')]),
1060-
("word", &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')]),
1061-
("xdigit", &[('0', '9'), ('A', 'F'), ('a', 'f')]),
1047+
("alnum", &ALNUM),
1048+
("alpha", &ALPHA),
1049+
("ascii", &ASCII),
1050+
("blank", &BLANK),
1051+
("cntrl", &CNTRL),
1052+
("digit", &DIGIT),
1053+
("graph", &GRAPH),
1054+
("lower", &LOWER),
1055+
("print", &PRINT),
1056+
("punct", &PUNCT),
1057+
("space", &SPACE),
1058+
("upper", &UPPER),
1059+
("word", &WORD),
1060+
("xdigit", &XDIGIT),
10621061
];
1062+
1063+
static ALNUM: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z')];
1064+
static ALPHA: Class = &[('A', 'Z'), ('a', 'z')];
1065+
static ASCII: Class = &[('\x00', '\x7F')];
1066+
static BLANK: Class = &[(' ', ' '), ('\t', '\t')];
1067+
static CNTRL: Class = &[('\x00', '\x1F'), ('\x7F', '\x7F')];
1068+
static DIGIT: Class = &[('0', '9')];
1069+
static GRAPH: Class = &[('!', '~')];
1070+
static LOWER: Class = &[('a', 'z')];
1071+
static PRINT: Class = &[(' ', '~')];
1072+
static PUNCT: Class = &[('!', '/'), (':', '@'), ('[', '`'), ('{', '~')];
1073+
static SPACE: Class = &[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'),
1074+
('\x0C', '\x0C'), ('\r', '\r'), (' ', ' ')];
1075+
static UPPER: Class = &[('A', 'Z')];
1076+
static WORD: Class = &[('0', '9'), ('A', 'Z'), ('a', 'z'), ('_', '_')];
1077+
static XDIGIT: Class = &[('0', '9'), ('A', 'F'), ('a', 'f')];

branches/auto/src/libregex/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub struct ExNative {
128128
#[doc(hidden)]
129129
pub original: &'static str,
130130
#[doc(hidden)]
131-
pub names: &'static [Option<&'static str>],
131+
pub names: &'static &'static [Option<&'static str>],
132132
#[doc(hidden)]
133133
pub prog: fn(MatchKind, &str, uint, uint) -> Vec<Option<uint>>
134134
}

branches/auto/src/libregex_macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
324324

325325
::regex::native::Native(::regex::native::ExNative {
326326
original: $regex,
327-
names: CAP_NAMES,
327+
names: &CAP_NAMES,
328328
prog: exec,
329329
})
330330
})

0 commit comments

Comments
 (0)