aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar/mod.rs')
-rw-r--r--src/parser/event_parser/grammar/mod.rs33
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
49fn 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
61fn 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
82impl<'p> Parser<'p> { 49impl<'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)