Do not emit Unknown token

This commit is contained in:
Dhruv Manilawala
2024-03-11 09:56:19 +05:30
parent e9d5ca2fe1
commit 2b47794278
2 changed files with 0 additions and 8 deletions

View File

@@ -977,12 +977,6 @@ impl<'src> Parser<'src> {
});
fstring_literal
}
// `Invalid` tokens are created when there's a lexical error, so
// we ignore it here to avoid creating unexpected token errors
TokenKind::Unknown => {
self.next_token();
continue;
}
// Handle an unexpected token
_ => {
let (tok, range) = self.next_token();

View File

@@ -100,9 +100,7 @@ impl Iterator for TokenSource {
}
Err(error) => {
let location = error.location();
self.errors.push(error);
break Some((Tok::Unknown, location));
}
}
}