diff options
author | Aleksey Kladov <[email protected]> | 2018-01-27 22:13:27 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-27 22:13:27 +0000 |
commit | 3630aeb1ea646b0151da4cdf12a6b025a0d031c5 (patch) | |
tree | a55931ab3e0857ceac6b8bc0740fb48fd9cc2ed2 /src/parser/event_parser/grammar | |
parent | b7ae5bbba22cb7968756b40240bcbca1f64ff6b0 (diff) |
Drop high-order stuff for good
Diffstat (limited to 'src/parser/event_parser/grammar')
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 67773453b..6e4f72096 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs | |||
@@ -46,39 +46,6 @@ fn alias(p: &mut Parser) -> bool { | |||
46 | true //FIXME: return false if three are errors | 46 | true //FIXME: return false if three are errors |
47 | } | 47 | } |
48 | 48 | ||
49 | fn repeat<F: FnMut(&mut Parser) -> bool>(p: &mut Parser, mut f: F) { | ||
50 | loop { | ||
51 | let pos = p.pos(); | ||
52 | if !f(p) { | ||
53 | return | ||
54 | } | ||
55 | if pos == p.pos() { | ||
56 | panic!("Infinite loop in parser") | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | |||
61 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { | ||
62 | repeat(p, |p| { | ||
63 | if p.current() == end { | ||
64 | return false | ||
65 | } | ||
66 | let pos = p.pos(); | ||
67 | f(p); | ||
68 | if p.pos() == pos { | ||
69 | return false | ||
70 | } | ||
71 | |||
72 | if p.current() == end { | ||
73 | p.eat(COMMA); | ||
74 | } else { | ||
75 | p.expect(COMMA); | ||
76 | } | ||
77 | true | ||
78 | }) | ||
79 | } | ||
80 | |||
81 | |||
82 | impl<'p> Parser<'p> { | 49 | impl<'p> Parser<'p> { |
83 | fn at<L: Lookahead>(&self, l: L) -> bool { | 50 | fn at<L: Lookahead>(&self, l: L) -> bool { |
84 | l.is_ahead(self) | 51 | l.is_ahead(self) |