start item recovery

This commit is contained in:
Aleksey Kladov 2018-08-31 13:35:48 +03:00
parent faebae74e4
commit 8fc7f438c4
7 changed files with 40 additions and 9 deletions

View file

@ -12,7 +12,7 @@ fn mask(kind: SyntaxKind) -> u128 {
}
impl TokenSet {
const EMPTY: TokenSet = TokenSet(0);
pub const EMPTY: TokenSet = TokenSet(0);
pub fn contains(&self, kind: SyntaxKind) -> bool {
self.0 & mask(kind) != 0
@ -145,10 +145,10 @@ impl<'t> Parser<'t> {
}
/// Create an error node and consume the next token.
pub(crate) fn err_recover(&mut self, message: &str, recovery_set: TokenSet) {
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
if self.at(SyntaxKind::L_CURLY)
|| self.at(SyntaxKind::R_CURLY)
|| recovery_set.contains(self.current()) {
|| recovery.contains(self.current()) {
self.error(message);
} else {
let m = self.start();