diff options
Diffstat (limited to 'crates/parser/src')
-rw-r--r-- | crates/parser/src/parser.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/crates/parser/src/parser.rs b/crates/parser/src/parser.rs index d2487acc3..81e26e009 100644 --- a/crates/parser/src/parser.rs +++ b/crates/parser/src/parser.rs | |||
@@ -7,7 +7,7 @@ use drop_bomb::DropBomb; | |||
7 | use crate::{ | 7 | use crate::{ |
8 | event::Event, | 8 | event::Event, |
9 | ParseError, | 9 | ParseError, |
10 | SyntaxKind::{self, EOF, ERROR, TOMBSTONE}, | 10 | SyntaxKind::{self, EOF, ERROR, L_DOLLAR, R_DOLLAR, TOMBSTONE}, |
11 | TokenSet, TokenSource, T, | 11 | TokenSet, TokenSource, T, |
12 | }; | 12 | }; |
13 | 13 | ||
@@ -215,13 +215,23 @@ impl<'t> Parser<'t> { | |||
215 | 215 | ||
216 | /// Create an error node and consume the next token. | 216 | /// Create an error node and consume the next token. |
217 | pub(crate) fn err_and_bump(&mut self, message: &str) { | 217 | pub(crate) fn err_and_bump(&mut self, message: &str) { |
218 | self.err_recover(message, TokenSet::EMPTY); | 218 | match self.current() { |
219 | L_DOLLAR | R_DOLLAR => { | ||
220 | let m = self.start(); | ||
221 | self.error(message); | ||
222 | self.bump_any(); | ||
223 | m.complete(self, ERROR); | ||
224 | } | ||
225 | _ => { | ||
226 | self.err_recover(message, TokenSet::EMPTY); | ||
227 | } | ||
228 | } | ||
219 | } | 229 | } |
220 | 230 | ||
221 | /// Create an error node and consume the next token. | 231 | /// Create an error node and consume the next token. |
222 | pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) { | 232 | pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) { |
223 | match self.current() { | 233 | match self.current() { |
224 | T!['{'] | T!['}'] => { | 234 | T!['{'] | T!['}'] | L_DOLLAR | R_DOLLAR => { |
225 | self.error(message); | 235 | self.error(message); |
226 | return; | 236 | return; |
227 | } | 237 | } |