feat/refactor: improve errors in case of ident with number at start

This commit is contained in:
Ezra Shaw 2023-03-07 23:01:26 +13:00
parent 8824994ccd
commit 252e0b3385
No known key found for this signature in database
GPG key ID: 67ABF16FB0ECD870
9 changed files with 68 additions and 45 deletions

View file

@ -348,6 +348,10 @@ impl<'a> Parser<'a> {
lo = self.token.span;
}
if self.is_lit_bad_ident() {
return Err(self.expected_ident_found());
}
let pat = if self.check(&token::BinOp(token::And)) || self.token.kind == token::AndAnd {
self.parse_pat_deref(expected)?
} else if self.check(&token::OpenDelim(Delimiter::Parenthesis)) {