Replies: 3 comments 6 replies
-
Is there a reason why you don't define a lexer rule for the operator |
Beta Was this translation helpful? Give feedback.
1 reply
-
Your MINUS exp unary rule has the highest precedence so it takes that, which it should. Make <- a single token. On Aug 28, 2024, at 15:37, Ken Domino ***@***.***> wrote:
Is there a reason why you don't define a lexer rule for the operator <-?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
4 replies
-
issue seems to come from here: I don't understand why rule declared in 5th seems to be tested first ? I don't mind pushing a merge request for the bug but I might need some guidance to start. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hi,
I'm using :
antlr : 4.7.1
antlr intellij plugin: 1.23
I have the following lexer/grammar:
I have the following expression:
I expect antlr to parse it with rule "exp LT MINUS parameters" but it goes with "exp LT exp"
IntellijPlugin tells me that there is an ambiguity but changing rule alternative orders doesn't change anything.
issue seems to come from different rules starting with same token, it has higher precedence but order of check stays the same:
extract from antlr4 -Xlog Test.g4
what would be the solution to force antlr to match longest token sequence ?
Update:
Antlr4 seems to always take combination of several rules instead a one.
in this case I have rules:
MINUS exp
LT exp
exp LT MINUS parameters
=> ANTLR seems to always take combination of rules having same combination of token instead of one having all
Beta Was this translation helpful? Give feedback.
All reactions