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
take_until with tuple parser #168
Comments
(All non-partial parsers are always in "first mode"). Since this wasn't checked before, a sequence parser that returned an error after consuming input would start from the middle of the sequence if it parsing was attempted with it again as the partial state isn't reset). Fixes #168
Thanks for the immediate fix! |
(All non-partial parsers are always in "first mode"). Since this wasn't checked before, a sequence parser that returned an error after consuming input would start from the middle of the sequence if it parsing was attempted with it again as the partial state isn't reset). Fixes #168
@Marwes
|
Ouch, that is a rather bad bug. It's root cause was that the Fix released as 3.3.4 |
I have tried version 3.34, it seems that my |
Damn, I may have either published the wrong version or recognize somehow has a similar bug all on its own. Does it work of you use take_until instead of skip_until and just ignore the result of take_until? ( can't check atm) |
Or test it with the git master |
take_until(try()) is broken in version 3.3.2 and fixed in 3.3.3 (with no change in 3.3.4). git master version behaves the same as 3.3.4. I'm just learning combine and now trying hard figuring out how to implement Parser trait for custom types. I'm not urgent and feel free to check it once you have vacant time. |
Seema that range::recognize has the same issue that skip_until had (but combinator::recognize does not have this issue which may have been why i didnt notice) |
Fix in #173 . I checked all other uses of |
I'm new to parser combinator so pardon if this is a naive question.
This works as expected:
println!("{:?}", take_until::<String, _>(try(string("ab"))).easy_parse(r#"aaab"#)); // Ok(("aa", "ab"))
But this behaves surprisingly:
println!("{:?}", take_until::<String, _>(try((char('a'), char('b')))).easy_parse(r#"aaab"#)); // Ok(("aaa", "b"))
I want to use tuple because the closing string is calculated at runtime. For example, to parse the closing "quote" of Rust raw string, I count the number of # in
r#"
, buttake_until::<String, _>(try((char('"'), count_min_max::<String, _>(1, 1, char('#'))))).easy_parse("aa\"ab\"#")
gives
aa\"ab\"
instead ofaa\"ab
The text was updated successfully, but these errors were encountered: