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

Improved error recovery #36

Merged
merged 1 commit into from
May 11, 2024
Merged

Improved error recovery #36

merged 1 commit into from
May 11, 2024

Conversation

dannymcgee
Copy link
Owner

This PR vastly improves the error-recovery capabilities of the parser.

Previously, a parse error occurring in any part of a top-level declaration would cause the parser to bail out of that entire declaration and pick up again at the next one. That limited form of error recovery was better than nothing, but it was liable to cause some UX issues as, e.g., "Go to definition" requests would fail for a function declaration if any single statement in the function body was ill-formed.

This PR applies the same technique that was previously used for top-level declarations to every heterogeneous sequence of nodes in the tree. This includes things like block statements, argument and parameter lists, field declarations, etc. Now, for example, if one argument of a function-call expression emits a parse error, only that argument will be missing from the tree.

@dannymcgee dannymcgee merged commit 139b67a into main May 11, 2024
1 check passed
@dannymcgee dannymcgee deleted the better-error-recovery branch May 11, 2024 02:02
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.

1 participant