Keywords with same prefix in grammar will cause validation error because langium is not greedy. It will not use the longest match. It use the first match instead. #1650
Unanswered
durianwaffle
asked this question in
Q&A
Replies: 1 comment
-
Hey @durianwaffle, how did you define your keywords? Can you give a reproducible example? By default, Langium will perform some sorting on the keywords to ensure they appear in the correct order in the lexer definition to ensure that this issue does not appear. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a grammar with 3 keywords with the same prefix as shown below:
A
AB
B
Then it causes false validation error under keyword
AB
because langium is not greedy. It will not get the longest keyword as keyword if there are multiple possible rules for the keyword. Instead, it processed keywordAB
as two separate keywordsA
andB
but there is not keyword_a then keyword_b grammar in my langium grammar.How to fix this issue?
Beta Was this translation helpful? Give feedback.
All reactions