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.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs
index 1c57e0cb4..881bb3ef3 100644
--- a/src/parser/event_parser/grammar/mod.rs
+++ b/src/parser/event_parser/grammar/mod.rs
@@ -6,6 +6,7 @@ use syntax_kinds::*;
6mod items; 6mod items;
7mod attributes; 7mod attributes;
8mod expressions; 8mod expressions;
9mod types;
9mod paths; 10mod paths;
10 11
11pub(crate) fn file(p: &mut Parser) { 12pub(crate) fn file(p: &mut Parser) {
@@ -72,12 +73,21 @@ fn many<F: FnMut(&mut Parser) -> bool>(p: &mut Parser, mut f: F) {
72 73
73fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { 74fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) {
74 many(p, |p| { 75 many(p, |p| {
75 if !f(p) || p.current() == end { 76 if p.current() == end {
76 false 77 return false
78 }
79 let pos = p.pos();
80 f(p);
81 if p.pos() == pos {
82 return false
83 }
84
85 if p.current() == end {
86 p.eat(COMMA);
77 } else { 87 } else {
78 p.expect(COMMA); 88 p.expect(COMMA);
79 true
80 } 89 }
90 true
81 }) 91 })
82} 92}
83 93