-
Notifications
You must be signed in to change notification settings - Fork 52
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
2 last statements in single top level block doesn't error recover well #298
Labels
bug
Something isn't working
Comments
Your example does error for me. Is this on master or on the current crate? |
latest master, my code:
|
I'm surprised we didn't have a regression test for this. Good find |
Note this is specific to the top-level block parsing, and does not occur when parsing inside of nested blocks (e.g., loops) |
Reopening as the error recovery part isn't completely solved yet, as we lose data |
JohnnyMorganz
changed the title
laststmt behavior
2 last statements in single top level block doesn't error recover well
Jul 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test case:
parsing this does not produce any errors (imo it should).
however, even if this should be parsed, the location of the laststmt in question is ambiguous:
if it's continue, then we keep parsing statements, so the continue statement "teleports" to the end
if it's return, then the other statements get stripped (parser is no longer lossless)
etc. etc.
of course it's possible to determine the position based on tokens, but it isn't very convenient
The text was updated successfully, but these errors were encountered: