Skip to content

Fail parser immediately (skip other choices) #522

Answered by zesterer
zaynetro asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

If there was a problem with function arguments I want to see the error there instead of an error due it my parser failing to parse an expression.

Chumsky will automatically prioritise error branches that make the most progress into the input. This means that if the parser sees fn <malformed>, the error you will see will be that generated by the fn_ parser (unless, of course, the expr parser contains some syntax rule that can parse the fn too).

The exact mechanism for this is kept as an implementation detail (there are some future changes we might be able to do to improve error prioritisation even further), but the parser will already exhibit the behaviour you're looking for witho…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zaynetro
Comment options

Answer selected by zaynetro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants