Better fix for stuck parser?

This commit is contained in:
Florian Diebold 2020-03-15 14:03:30 +01:00
parent 035db0fbb9
commit e6ec4a329f

View file

@ -61,7 +61,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
LIFETIME,
]);
const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW, R_DOLLAR];
pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> {
if let Some(m) = literal(p) {
@ -565,10 +565,10 @@ fn meta_var_expr(p: &mut Parser) -> CompletedMarker {
it
}
_ => {
while !p.at(EOF) && !p.at(R_DOLLAR) {
while !p.at(R_DOLLAR) {
p.bump_any()
}
p.eat(R_DOLLAR);
p.bump(R_DOLLAR);
m.complete(p, ERROR)
}
}