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

Report doesn't include enough information #57

Open
chowells79 opened this issue Dec 11, 2021 · 2 comments
Open

Report doesn't include enough information #57

chowells79 opened this issue Dec 11, 2021 · 2 comments

Comments

@chowells79
Copy link

I was working on AoC problem (https://adventofcode.com/2021/day/10) recently and saw that recognizing whether an input matches a grammar was part of it. (I ended up going a different direction to solve it, but...)

Since I thought I only needed to identify whether something parsed or not, I wanted to use report to test acceptance without bothering with parse results. But.. that actually isn't sufficient. At least, not unless you add names to the productions, and in sufficient granularity. If you have skipped that portion for your grammar, the Report value doesn't give sufficient information to determine whether something parsed in its entirety - only whether it ran into an error or was able to consume the entire input without errors. The only way to determine if any parse ran to completion is checking whether fullParses returned any parses.

It would be really nice if report returned some way to determine whether there was a full parse without requiring sufficiently granular naming of productions.

@expipiplus1
Copy link

You could check the position field of your Report, or check the unconsumed field for emptiness.

@chowells79
Copy link
Author

@expipiplus1 That covers the case when there was input that was unexpected. It does not cover the case of not enough input. I should know, it's exactly what I tried to do. It doesn't handle the situation.

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