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

||| parser reports error on only one of the explored branches #565

Open
ValentinAebi opened this issue Oct 11, 2024 · 1 comment
Open

||| parser reports error on only one of the explored branches #565

ValentinAebi opened this issue Oct 11, 2024 · 1 comment

Comments

@ValentinAebi
Copy link

When both branches of a ||| combinator produce a Failure as a result, the resulting error message is the one coming from the branch that matched the longest chain. This can lead to confusing error messages in situations like this one:

lazy val parser = (intKeyword ~ ...) ||| (doubleKeyword ~ ...)

where the parser outputs an error message like expected 'int'. I think that it would be much less confusing to issue an error message that contains all the possible tokens: expected 'int' or 'double'.

Am I using the API the wrong way, or is there no way of configuring the parser to output such error messages? In the latter case, the addition of such a feature would be much appreciated.

@SethTisue
Copy link
Member

SethTisue commented Oct 26, 2024

I think you might need to dig into the source code to answer this (and perhaps improve it) yourself, as I don't think there's anyone left who actually knows the codebase well.

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