Skip to content

phrase method loses error context when successful parse result has lastFailure #518

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
i10416 opened this issue May 30, 2023 · 0 comments

Comments

@i10416
Copy link

i10416 commented May 30, 2023

When phrase is applied to successful parse result which has lastFailure, it returns only the original failure.
I think it would be better to add a message that indicates the EOF is expected in the same way as it does when lastFailure is None.

For example, the following p fails because there are trailing spaces after d, but error message comes from c parse failure which doesn't have any hint for EOF.

val input = "a b d  "
val p = phase(/* a parser that parses `a b (c or d)`*/)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant