-
Notifications
You must be signed in to change notification settings - Fork 91
Labelling/annotating expected items #111
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
Comments
To be honest this looks like something not commonly useful, so complexity that it would introduce probably is not worth it. Nevertheless, let it hang here so if more people request such a thing, we could add it. Thanks for opening the issue. |
I think a fairly low impact way to implement this would be adding a new constructor (to ErrorItem) like:
and a function that labels all "Tokens" ErrorItems, e.g. |
I think for any sort of language parser this is very useful as now you can see the category of the expected items produced e.g. "expression", "verb", "noun", "value", etc.. At the moment it's either one or the other, but both would be better IMO. |
I guess another way to implement it would be to tag errors with the |
I'm still maintaining my own branch with this in it because it's very useful for me in production, but maybe a different design would be more palatable? I'm not sure how to implement this but: If there was a function |
like |
This probably may be added in some form in 5.2.0. For the upcoming 5.1.0 release I'm not adding new things right now. Yeah, |
Actually I'm thinking of adding a combinator of the type |
If you are OK with such a function, tell me and I'll close this issue and open another one describing that function and schedule it for 5.2.0. |
I changed my mind, this looks like a simple yet useful thing to add in 5.1.0. Closing in favor of #145. |
For a work project I'm working on it would be really nice to have a way to annotate specific expected items in ParseErrors. I'd like to be able to label expected items by the parser that they came from, e.g. "string", "number" etc.
At the moment errorCustom /kind of/ let's you achieve this, except when ParseErrors are combined you can't map specific ErrorItems to elements of errorCustom (i.e., autocompletions to labels).
The text was updated successfully, but these errors were encountered: