-
Hi there, I'm running into a parsing problem with my array syntax. Here's a simplified repro:
Input:
Error (reproduced on langium playground):
The empty array on the second line wouldn't parse, and it seems the conflict is introduced by the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @ymc9,
Yes, every unique usage of keywords (anything wrapped inside of a string) generates a token type for the lexer. This is expected behavior for basically all parser generators (such as ANTLR). The obvious fix is to modify the
The issue is that since |
Beta Was this translation helpful? Give feedback.
Hey @ymc9,
Yes, every unique usage of keywords (anything wrapped inside of a string) generates a token type for the lexer. This is expected behavior for basically all parser generators (such as ANTLR). The obvious fix is to modify the
Person
rule slightly:The issue is that since
[]
is a longer token type pattern, it has precedence over shorter ones, such as[
. So during the lexing phase, encountering the string[]
will always yield the[]
token instead of separate[
and]
tokens.