Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rudimentary form of error recovery to parser #1733

Merged
merged 1 commit into from
Apr 19, 2023
Merged

Conversation

mtdowling
Copy link
Member

When we encounter a parser error, we'll now attempt some basic error recovery by simply skipping token until we reach a token at the start of a line that is an identifier, documentation comment, or '@'. This should help with things like LSPs that still should be able to utilize jump to definition even with a broken or in-progress model.

(still need to test the experience out in the LSP before merging)

@mtdowling mtdowling force-pushed the error-recovery branch 2 times, most recently from c882606 to 3e6cd35 Compare April 16, 2023 17:52
@mtdowling mtdowling marked this pull request as ready for review April 18, 2023 17:46
@mtdowling mtdowling requested a review from a team as a code owner April 18, 2023 17:46
@mtdowling mtdowling changed the base branch from lexer to main April 19, 2023 21:49
When we encounter a parser error, we'll now attempt some basic
error recovery by simply skipping token until we reach a token at
the start of a line that is an identifier, documentation comment,
or '@'. This should help with things like LSPs that still should be
able to utilize jump to definition even with a broken or in-progress
model.

Add error recovery to control statements and metadata. Ensure that
invalid identifiers are turned into ERROR tokens instead of throwing.
Error recovery will also consider "$" a recovery token.
@mtdowling mtdowling merged commit 49334cc into main Apr 19, 2023
@mtdowling mtdowling deleted the error-recovery branch April 25, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants