I'm trying to parse one token with pattern <int1>..<int2>
in antlr4, and what I'm doing now is a trivial approach like:
main: INT1 '..' INT2;
INT1: NUMBER;
INT2: NUMBER;
NUMBER: [0-9]+ ;
However, when I tried to test the rule main with input 1..10
I got the error:
mismatched input '1' expecting NUMBER
which means I will always miss match the first int, BUT MY second int will be matched.
I was really confused, I think given the token <int1>
and <int2>
the same NUMBER
lexer rule should result in same match, but clearly it doesn't do the job in my case. Anyone has any ideas? Thanks
1..2
,3..45
,67..89
- the error you're receiving doesn't actually indicate whether it's failing on the1
by itself or the1
that is part of10
. ā J Earls