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

Provide rule and no-match indicators in parserErr #112

Open
flowchartsman opened this issue Mar 30, 2023 · 1 comment
Open

Provide rule and no-match indicators in parserErr #112

flowchartsman opened this issue Mar 30, 2023 · 1 comment

Comments

@flowchartsman
Copy link
Contributor

The docs indicate that the prefix refers to the rule in which the error occurred, but I have not found this to be the case. It appears to only be the position in the parsed data. Allowing the programmer to access the enclosing failing rule would help in shimming in more useful error messages without having to resort to hacks like some of the solutions to #72, since you could just make a quick map of rule names to error messages and, with a little inspection, figure out a way to give your users something more useful.

As a side note, it would also be helpful to be able to identify no match errors without the string inspection that's now necessary since the message is hard-coded This could help provide a way to squash the error message as a fallback and only use the position to highlight where the parsing stopped, indicating something (hopfully) intuitive like an improperly-formatted statement when used in conjunction with more robust errors elsewhere.

@fy0
Copy link

fy0 commented May 16, 2024

I don't completely understand without example. Maybe parser.rstack is what you want.

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