I'm trying to use ANTLR4 to parse a file, where elements can be the character "b"
or simple literals, the problem appears when the Literal is just one character with a "b"
.
Here's a simplified grammar
Lexer file:
B
: 'b'
;
LETTER
: [a-z]
;
LETTERS
: LETTER+
;
Parser file:
pointer
: B '.' LETTERS
;
b.f
works but b.b
doesn't, I get "line 1:2 mismatched input 'b' expecting LETTERS"
. How can I avoid the conflict between the two lexical rules without putting Letter above B, where the problem will just change to B
.
LETTERS
at column 0? Also why does it sayLetters
with only a capital L? Are you sure you're running the same grammar you posted here? – sepp2k