You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is intended behavior or a bug. The operations such as many will parse success 0 or N times and will stop at the last failed parse. The parse will generate some error. The parsing operation will be successful but the error stack is not cleared. A subsequent skip fails will cause the errors from the failed many the N+1 failed parse to show up.
Consider the following example:
#[test]fntest_skip(){use combine::EasyParser;let ret = many::<String,_,_>(combine::parser::char::char('a')).skip(combine::parser::char::char('b')).easy_parse("a");println!("{:?}", ret);}
The input is a "a", and the parser is to parse many'a' followed by a b (which will fail). The expected error is:
errors: [Unexpected(Static("end of input")), Expected(Token('b'))]
But the actual output is:
errors: [Unexpected(Static("end of input")), Expected(Token('a')), Expected(Token('b'))]
The Expected(Token('a')) error is from the many parser parsing "a". It should be cleared once the many parser is deemed successful.
The text was updated successfully, but these errors were encountered:
That is expected behavior. At the point where it fails another a or a b would be accepted. Arguably we could drop the a expectation here since the full parse would fail but I am not entirely sure how that would be decided without losing other cases where the a expectation should remain in the error.
Not sure if this is intended behavior or a bug. The operations such as
many
will parse success 0 or N times and will stop at the last failed parse. The parse will generate some error. The parsing operation will be successful but the error stack is not cleared. A subsequentskip
fails will cause the errors from the failedmany
theN+1
failed parse to show up.Consider the following example:
The input is a
"a"
, and the parser is to parsemany
'a'
followed by ab
(which will fail). The expected error is:But the actual output is:
The
Expected(Token('a'))
error is from themany
parser parsing"a"
. It should be cleared once themany
parser is deemed successful.The text was updated successfully, but these errors were encountered: