diff options
Diffstat (limited to 'src/parser/event_parser/grammar/mod.rs')
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 16 |
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::*; | |||
6 | mod items; | 6 | mod items; |
7 | mod attributes; | 7 | mod attributes; |
8 | mod expressions; | 8 | mod expressions; |
9 | mod types; | ||
9 | mod paths; | 10 | mod paths; |
10 | 11 | ||
11 | pub(crate) fn file(p: &mut Parser) { | 12 | pub(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 | ||
73 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { | 74 | fn 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 | ||