-
-
Notifications
You must be signed in to change notification settings - Fork 10
fix: parsing crashes on code with errors #65
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
base: main
Are you sure you want to change the base?
Conversation
|
I'm not sure this exactly the right fix, as the error cases showing 'unknown token: eot' is exposing an implementation detail that isn't a real syntax error. I think you can maybe split the struct error into its own PR. I'll dig into it more, how does the tokenizer actually tokenize that special << character? |
As
Will do. Also for that one I'm not 100% either that the behavior I chose is the one we really want either, we can discuss further there |
79b5b25 to
5ed6d78
Compare
|
I merged #67 which fixes the weird character issue. I need to go to bed, but have another fix in flight for the other error. The issue is that it should detect if there is a closing bracket/brace/paren when it wasn't expected one, report the error, and continue parsing. If you want to look into it tomorrow during the day, it'll be around the validate_peek function and look at those "is_list", etc variables in the parse_expression function. Otherwise i can tackle it tomorrow evening. |
5ed6d78 to
7a264fc
Compare
|
@mhanberg it seems the issue was caused by
|
|
One thing that caught my attention is that we have a test with this snippet( This would incorrectly report an unexpected Essentially we:
I think dropping |
Probably best to discuss in a separate issue about improving error recovery. |
Trying to integrate Spitfire into Expert I found a few issues:
Spitfire.parse_with_comments("@x ]")crashes instead of returning an error:Spitfire.parse("[«]")crashes(this one was triggered by one of Expert's test helpers):This PR fixes those