Closed yihuaf closed 4 months ago
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.