Skip to content

Order of alternatives has an impact on common lookahead prefix #753

Answered by msujew
luan-xiaokun asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @luan-xiaokun,

yeah that's a feature. Chevrotain is heavily optimized for parsing performance and skips alternatives with shorter prefixes while parsing. This is documented here. Note that we will switch to ALL(*) with Langium 1.0, which alleviates this issue. The parser will then always choose the longest matching alternative.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@luan-xiaokun
Comment options

@msujew
Comment options

Answer selected by luan-xiaokun
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