Skip to content

Commit fe958e0

Browse files
committed
Merge pull request #2 from drbawb/feature/fix-macro-expansions
Fix macro expansions
2 parents 65729fa + b084fc1 commit fe958e0

File tree

5 files changed

+465
-465
lines changed

5 files changed

+465
-465
lines changed

src/parse.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ impl<'a> Parser<'a> {
224224
},
225225
'(' => {
226226
if self.peek_is(1, '?') {
227-
try!(self.expect('?'))
228-
try!(self.parse_group_opts())
227+
try!(self.expect('?'));
228+
try!(self.parse_group_opts());
229229
} else {
230230
self.caps += 1;
231231
self.stack.push(Paren(self.flags,
@@ -373,7 +373,7 @@ impl<'a> Parser<'a> {
373373
fn parse_class(&mut self) -> Result<(), Error> {
374374
let negated =
375375
if self.peek_is(1, '^') {
376-
try!(self.expect('^'))
376+
try!(self.expect('^'));
377377
FLAG_NEGATED
378378
} else {
379379
FLAG_EMPTY
@@ -597,7 +597,7 @@ impl<'a> Parser<'a> {
597597
// Parses all escape sequences.
598598
// Assumes that '\' is the current character.
599599
fn parse_escape(&mut self) -> Result<Ast, Error> {
600-
try!(self.noteof("an escape sequence following a '\\'"))
600+
try!(self.noteof("an escape sequence following a '\\'"));
601601

602602
let c = self.cur();
603603
if is_punct(c) {
@@ -639,7 +639,7 @@ impl<'a> Parser<'a> {
639639
let negated = if self.cur() == 'P' { FLAG_NEGATED } else { FLAG_EMPTY };
640640
let mut name: String;
641641
if self.peek_is(1, '{') {
642-
try!(self.expect('{'))
642+
try!(self.expect('{'));
643643
let closer =
644644
match self.pos('}') {
645645
Some(i) => i,
@@ -677,10 +677,10 @@ impl<'a> Parser<'a> {
677677
let mut end = start + 1;
678678
let (d2, d3) = (self.peek(1), self.peek(2));
679679
if d2 >= Some('0') && d2 <= Some('7') {
680-
try!(self.noteof("expected octal character in [0-7]"))
680+
try!(self.noteof("expected octal character in [0-7]"));
681681
end += 1;
682682
if d3 >= Some('0') && d3 <= Some('7') {
683-
try!(self.noteof("expected octal character in [0-7]"))
683+
try!(self.noteof("expected octal character in [0-7]"));
684684
end += 1;
685685
}
686686
}
@@ -698,7 +698,7 @@ impl<'a> Parser<'a> {
698698
// Assumes that \x has been read.
699699
fn parse_hex(&mut self) -> Result<Ast, Error> {
700700
if !self.peek_is(1, '{') {
701-
try!(self.expect('{'))
701+
try!(self.expect('{'));
702702
return self.parse_hex_two()
703703
}
704704
let start = self.chari + 2;
@@ -723,7 +723,7 @@ impl<'a> Parser<'a> {
723723
let (start, end) = (self.chari, self.chari + 2);
724724
let bad = self.slice(start - 2, self.chars.len());
725725
try!(self.noteof(format!("Invalid hex escape sequence '{}'",
726-
bad).as_slice()))
726+
bad).as_slice()));
727727
self.parse_hex_digits(self.slice(start, end).as_slice())
728728
}
729729

@@ -743,7 +743,7 @@ impl<'a> Parser<'a> {
743743
// is '<'.
744744
// When done, parser will be at the closing '>' character.
745745
fn parse_named_capture(&mut self) -> Result<(), Error> {
746-
try!(self.noteof("a capture name"))
746+
try!(self.noteof("a capture name"));
747747
let closer =
748748
match self.pos('>') {
749749
Some(i) => i,
@@ -773,15 +773,15 @@ impl<'a> Parser<'a> {
773773
// character.
774774
fn parse_group_opts(&mut self) -> Result<(), Error> {
775775
if self.peek_is(1, 'P') && self.peek_is(2, '<') {
776-
try!(self.expect('P')) try!(self.expect('<'))
776+
try!(self.expect('P')); try!(self.expect('<'));
777777
return self.parse_named_capture()
778778
}
779779
let start = self.chari;
780780
let mut flags = self.flags;
781781
let mut sign = 1i;
782782
let mut saw_flag = false;
783783
loop {
784-
try!(self.noteof("expected non-empty set of flags or closing ')'"))
784+
try!(self.noteof("expected non-empty set of flags or closing ')'"));
785785
match self.cur() {
786786
'i' => { flags = flags | FLAG_NOCASE; saw_flag = true},
787787
'm' => { flags = flags | FLAG_MULTI; saw_flag = true},
@@ -823,7 +823,7 @@ impl<'a> Parser<'a> {
823823
// If it is, then the next character is consumed.
824824
fn get_next_greedy(&mut self) -> Result<Greed, Error> {
825825
Ok(if self.peek_is(1, '?') {
826-
try!(self.expect('?'))
826+
try!(self.expect('?'));
827827
Ungreedy
828828
} else {
829829
Greedy

tests/bench.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ macro_rules! throughput(
146146
b.iter(|| if $regex.is_match(text.as_slice()) { panic!("match") });
147147
}
148148
);
149-
)
149+
);
150150

151151
fn easy0() -> Regex { regex!("ABCDEFGHIJKLMNOPQRSTUVWXYZ$") }
152152
fn easy1() -> Regex { regex!("A[AB]B[BC]C[CD]D[DE]E[EF]F[FG]G[GH]H[HI]I[IJ]J$") }
@@ -165,18 +165,18 @@ fn gen_text(n: uint) -> String {
165165
String::from_utf8(bytes).unwrap()
166166
}
167167

168-
throughput!(easy0_32, easy0(), 32)
169-
throughput!(easy0_1K, easy0(), 1<<10)
170-
throughput!(easy0_32K, easy0(), 32<<10)
168+
throughput!(easy0_32, easy0(), 32);
169+
throughput!(easy0_1K, easy0(), 1<<10);
170+
throughput!(easy0_32K, easy0(), 32<<10);
171171

172-
throughput!(easy1_32, easy1(), 32)
173-
throughput!(easy1_1K, easy1(), 1<<10)
174-
throughput!(easy1_32K, easy1(), 32<<10)
172+
throughput!(easy1_32, easy1(), 32);
173+
throughput!(easy1_1K, easy1(), 1<<10);
174+
throughput!(easy1_32K, easy1(), 32<<10);
175175

176-
throughput!(medium_32, medium(), 32)
177-
throughput!(medium_1K, medium(), 1<<10)
178-
throughput!(medium_32K,medium(), 32<<10)
176+
throughput!(medium_32, medium(), 32);
177+
throughput!(medium_1K, medium(), 1<<10);
178+
throughput!(medium_32K,medium(), 32<<10);
179179

180-
throughput!(hard_32, hard(), 32)
181-
throughput!(hard_1K, hard(), 1<<10)
182-
throughput!(hard_32K,hard(), 32<<10)
180+
throughput!(hard_32, hard(), 32);
181+
throughput!(hard_1K, hard(), 1<<10);
182+
throughput!(hard_32K,hard(), 32<<10);

0 commit comments

Comments
 (0)