don't break parser error recovery in presence of macros
Parser has the invariant that `{}` are balanced.
Previous code tried (unsucesfuly) maintain the same invariant for
`$()` as well, but it was done in a rather ad-hoc manner: it's not at
all obvious that it is possible to maintain both invariants!
This commit is contained in:
@@ -5,7 +5,7 @@ use drop_bomb::DropBomb;
|
||||
use crate::{
|
||||
event::Event,
|
||||
ParseError,
|
||||
SyntaxKind::{self, EOF, ERROR, L_DOLLAR, R_DOLLAR, TOMBSTONE},
|
||||
SyntaxKind::{self, EOF, ERROR, TOMBSTONE},
|
||||
TokenSet, TokenSource, T,
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ impl<'t> Parser<'t> {
|
||||
/// Create an error node and consume the next token.
|
||||
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
|
||||
match self.current() {
|
||||
T!['{'] | T!['}'] | L_DOLLAR | R_DOLLAR => {
|
||||
T!['{'] | T!['}'] => {
|
||||
self.error(message);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user