Your integer
rule is a parser rule, not a lexer rule. The '0'
, '1'
, etc. literals it references are implicitly turned into lexer rules which match a single digit each. You should make the following lexer rule instead:
INTEGER : '0'..'9'+;
Or in ANTLR 4, simply this:
INTEGER : [0-9]+;