-
This grammar
cannot parse this file
The error suggests that the LL(k) parser is only looking one token ahead and choosing the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey @drhagen, the issue isn't really that the lookahead doesn't look 2 tokens into the input stack. Instead, it simply disregards outer context. I.e. when performing lookahead inside of the |
Beta Was this translation helpful? Give feedback.
-
I am turning my comment into an answer because it is actually the solution to the original problem. Langium configures lookahead based on local alternatives only, not global ones. For this particular case, it is possible to apply lookahead manually at the tokenization phase using regex lookahead (i.e.
|
Beta Was this translation helpful? Give feedback.
I am turning my comment into an answer because it is actually the solution to the original problem.
Langium configures lookahead based on local alternatives only, not global ones. For this particular case, it is possible to apply lookahead manually at the tokenization phase using regex lookahead (i.e.
(?=...)
). All mentions of the token at which lookahead failed need to be turned intoterminal
s and put into the appropriate order.