or
choosing secondary option, over recovered first option
#677
Labels
1.0
Features that should be implemented for the 1.0 release
error-recovery
An issue related to chumsky's error recovery API
I'm building an lsp, so error recovery is very important for me. I wanted to recover a function call that would look something like that
foo(
My parser would look like this:
function_call_parser
correctly recovers from this error and maps to proper value, but The final result would be a combination of a varfoo
with parentheses()
showing an error form parentheses parser.I've looked at the
Or
struct implementation and I think this is the problem:If I understand this correctly, if the second parser doesn't produce an error, while the first does, we choose the result of the second parser even tho the first parser may have parsed correctly.
While this may be a valid behaviour it's not consistent with what the docs say:
"If both parser succeed, the output of the first parser is guaranteed to be prioritised over the output of the second."
Is there some other util I can use, or should I create my own? I can create the fix as it seems pretty easy. What do you think?
The text was updated successfully, but these errors were encountered: