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

How to get better parse errors? #239

Open
Philogy opened this issue Oct 3, 2023 · 1 comment
Open

How to get better parse errors? #239

Philogy opened this issue Oct 3, 2023 · 1 comment

Comments

@Philogy
Copy link

Philogy commented Oct 3, 2023

Is there a way to get more precise errors when parsing fails? Currently, when it fails to parse an input string the error seems to just bubble up to the entry expression telling me it failed e.g.:

parsimonious.exceptions.IncompleteParseError: Rule 'program' matched in its entirety, but it didn't consume all the text. The non-matching por
tion of the text begins with '#define macro CONSTR' (line 15, column 1).

Would be great to be able to enable a mode where the error tells you the furthest point that the parser got to in terms of the grammar and also in the input string. I would like my program to be able to give a more helpful error message than just "parsing failed somewhere, dunno what exactly tho".

Thanks a lot! 🙏

@markdoerr
Copy link

Thanks, @Philogy, for bringing this up, I have exactly the same issue and would be happy, with the solution, you suggest.

Maybe the parser could just support different debug levels and in "DEBUG" mode show the most furthest point.

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