Skip to content

Having trouble making a recursive parser #2026

Answered by msujew
knpwrs asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @knpwrs,

I haven't tried reproducing your error yet - the report is missing a reproducible repo ;) - but I assume you're encountering one of the pitfalls of Chevrotain's alternative choosing (lookahead) mechanism. Basically, when parsing the inner doc rule, the MANY consumes the inner text token first and since it finds another {% right after, it will perform another repetition in the assumption that there's a nested controlIf waiting in the token stream. However, inside of the MANY, the OR will find that controlIf doesn't really match (since it requires a [TagStart, ControlIf] sequence), which then results in the parser error you're seeing. Basically, the rule is unaware that there i…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by knpwrs
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
Converted from issue

This discussion was converted from issue #2025 on April 03, 2024 07:50.