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

Improve syntax error reporting #34

Open
kaikalur opened this issue Dec 27, 2022 · 3 comments
Open

Improve syntax error reporting #34

kaikalur opened this issue Dec 27, 2022 · 3 comments

Comments

@kaikalur
Copy link

Due to (mostly) direct translation of the spec and especially keeping the expressions part as given in the spec, some syntax errors are not very good. For example:

SELECT Overlaps( overlaps ) AS overlaps;

Gives a bad error:

Parse error: 1:1 at token: SELECT

One simple addition would be to see if the next token (after the consumed token SELECT) is a keyword and use that as an error. So fro the above, it will be better to say:

Parse error: 1:8 at token: OVERLAPS

@manticore-projects
Copy link

Can we maybe also state the Production where it fails?
Based on a Rail Road Diagram, for the example above this would point straight to: "Reserved Keyword where Identifier has been expected" (which in my experience accounts for 50% of all end user issues).

@kaikalur
Copy link
Author

No production is a concept for the developer, not the user. Again - you can just customize it for your usecase if you want to add the production, but I don't want it in the main grammar

@kaikalur
Copy link
Author

Can we maybe also state the Production where it fails? Based on a Rail Road Diagram, for the example above this would point straight to: "Reserved Keyword where Identifier has been expected" (which in my experience accounts for 50% of all end user issues).

Yes that's the idea - so if the next token (token.next) is a reserved word, we give this error saying found keyword where identifier is expected

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

No branches or pull requests

2 participants