A bit confused" Does the order in which lexer tokens are defined in the g4 file, matter? #4080
Unanswered
The-Futurist
asked this question in
Q&A
Replies: 3 comments 3 replies
-
|
It matters: it defines token precedence. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Yes, order matters, but only so much. The rule is:
|
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Thanks folks. I get this but these work the same way irrespective of order, yes? The lexer will match ** correctly, no matter how the rules are ordered, yes? |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've made excellent progress using Antlr4 for designing my new language grammar, but I'm still not fully familiar with the many facets of it.
Early on I had parsing failing and "moved some tokens around" in the g4 file and the parsing worked again, this was weeks ago and I can't recall the details, I might have made other changes as well.
So does the physical ordering of Lexer definitions matter in any way or is it totally irrelevant?
Beta Was this translation helpful? Give feedback.
All reactions