Prevents matching partial words in lexer #4772
-
Let's say I have these two rules in lexer:
With input Now, I've tried something like the code below
which works except that it requires a character at the end. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
No, it doesn't. See below.
The lexer produces a single token for the input. This is because Antlr lexers follow two basic rules:
In your grammar. PRINT occurs first. But STRING matches It sounds like you have a build issue. Make sure to remove generated files, and rebuild completely from scratch. Or, there is something more to your grammar. |
Beta Was this translation helpful? Give feedback.
No, it doesn't. See below.