Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix: eof check
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Nov 22, 2021
1 parent 0b1d22b commit 1bf0fde
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/rslint_parser/src/parse_recoverer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl ParseRecoverer {

/// Checks if the parsing phase is recoverable by checking curly braces and [tokens set](TokenSet)
fn parsing_is_recoverable(&self, parser: &Parser) -> bool {
self.is_at_token_set(parser) || self.is_at_braces(parser)
self.is_at_token_set(parser) || self.is_at_braces(parser) || self.is_at_eof(parser)
}

/// It returns the diagnostic
Expand All @@ -86,9 +86,14 @@ impl ParseRecoverer {

fn is_at_braces(&self, parser: &Parser) -> bool {
matches!(parser.cur(), T!['{'] | T!['}'] if self.include_braces)

}

fn is_at_token_set(&self, parser: &Parser) -> bool {
parser.at_ts(self.recovery)
}

fn is_at_eof(&self, parser: &Parser) -> bool {
parser.cur() == SyntaxKind::EOF
}
}

0 comments on commit 1bf0fde

Please sign in to comment.