goparsify icon indicating copy to clipboard operation
goparsify copied to clipboard

Possible bug with Any (or Seq)?

Open austin-searchpilot opened this issue 7 years ago • 1 comments

Hi,

First of all - thanks for the great library! I've found a possible bug. I've tried to debug it to find the underlying cause but have struggled a bit. It can be reduced to the following case.

If we have the parser:

str := `str`
str1 := parsify.Seq(`str`, `1`)
str2 := parsify.Any(`str2`)
parser := parsify.Any(str1, str2, str)

I would expect this to be able to parse the string str (for the 3rd argument to the Any) and then try to parse the string str, I get the error goparsify.UnparsedInputError{remaining:"str"} .

My exploration of the code is guiding me to think that the Any from the str2 line is not errorring correctly but I can't see how to fix it.

Do you agree that the parser defined above should be able to parse str? And if so, could you give me a pointer of how I might go about fixing it?

Some additional information: The exact same parser works with the library at commit 0f854720ca2bad30246020bb01cdb903a5f9406d. I noticed the main thing that has changed in between was the removal of the prediction in the Any function which my colleague suggested a couple of weeks ago. I can't see anything obvious in that commit which would trigger this new behaviour though.

austin-searchpilot avatar Jun 29 '18 11:06 austin-searchpilot