-
Notifications
You must be signed in to change notification settings - Fork 131
Misleading error message when using optional or repeatedly parser #34
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
I'm not sure that I see what the bug is here. It seems to me that your fragment "(?i)AND".r.* is succeeding by matching an empty sequence of input characters at the position of the first 'b', since a '*' parser can always succeed with no repetitions. Why would you expect to see a failure message for that parser? The message you see is because you've (presumably) wrapped the whole parser using |
If I will parse a string like that
I see doing that will make the errors reasonable and helpful, Is that will break anything? |
But you will only get an error if something fails. As you say, |
nope with
Although |
Yes, of course, you're right. My point from earlier remains, however. I don't think there is a bug in the repetition combinator |
Yeah you are right about that I shouldn't change |
I have tried to parse this string
aaa bbb
using this parserident ~ "(?i)AND".r.*
. I was expecting to see this error[1.5] failure: string matching regex '(?i)AND' expected but 'b' found
, but I received this error[1.5] failure: string matching regex '\z' expected but 'b' found
.After Investigating in this bug, I found that this problem happens only when using
*
to repeat the same parser.The text was updated successfully, but these errors were encountered: