diff options
Diffstat (limited to 'src/parser/event_parser/grammar.rs')
-rw-r--r-- | src/parser/event_parser/grammar.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/parser/event_parser/grammar.rs b/src/parser/event_parser/grammar.rs index d09579881..7425526ef 100644 --- a/src/parser/event_parser/grammar.rs +++ b/src/parser/event_parser/grammar.rs | |||
@@ -74,7 +74,7 @@ fn many<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { | |||
74 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { | 74 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { |
75 | many(p, |p| { | 75 | many(p, |p| { |
76 | f(p); | 76 | f(p); |
77 | p.expect(COMMA) | 77 | p.is_eof() || p.expect(COMMA) |
78 | }) | 78 | }) |
79 | } | 79 | } |
80 | 80 | ||
@@ -101,6 +101,14 @@ impl<'p> Parser<'p> { | |||
101 | } | 101 | } |
102 | 102 | ||
103 | pub(crate) fn expect(&mut self, kind: SyntaxKind) -> bool { | 103 | pub(crate) fn expect(&mut self, kind: SyntaxKind) -> bool { |
104 | self.current_is(kind) && { self.bump(); true } | 104 | if self.current_is(kind) { |
105 | self.bump(); | ||
106 | true | ||
107 | } else { | ||
108 | self.error() | ||
109 | .message(format!("expected {:?}", kind)) | ||
110 | .emit(); | ||
111 | false | ||
112 | } | ||
105 | } | 113 | } |
106 | } \ No newline at end of file | 114 | } \ No newline at end of file |