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.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs
index 60458ce70..76f62b714 100644
--- a/src/parser/event_parser/grammar/mod.rs
+++ b/src/parser/event_parser/grammar/mod.rs
@@ -41,7 +41,15 @@ fn node<F: FnOnce(&mut Parser)>(p: &mut Parser, node_kind: SyntaxKind, rest: F)
41} 41}
42 42
43fn many<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { 43fn many<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) {
44 while f(p) { } 44 loop {
45 let pos = p.pos();
46 if !f(p) {
47 return
48 }
49 if pos == p.pos() {
50 panic!("Infinite loop in parser")
51 }
52 }
45} 53}
46 54
47fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { 55fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) {