[antlr-interest] Lexer bug?
Clifford Heath
clifford.heath at gmail.com
Sun Oct 21 00:49:13 PDT 2007
The following will parse "10 .. 20" and "10 ..20", but not "10..20".
It looks to me very much like it should... what's up here? It gets
a "no viable alternate" exception.
Obviously if I changed FRACTION to use DIGIT* instead of DIGIT+, it's
not going to work in the third case above, but... without that change?
Clifford Heath.
----
grammar range;
range
: NUMBER '..' NUMBER
;
NUMBER
: SIGN? DIGIT+ FRACTION? EXPONENT?
| SIGN? FRACTION EXPONENT?
;
fragment SIGN: ('+' | '-');
fragment FRACTION: '.' DIGIT+;
fragment EXPONENT: ('e'|'E') SIGN? DIGIT+;
fragment DIGIT : '0'..'9';
WS: (' '|'\t'|'\r'|'\n')+ {skip();};
More information about the antlr-interest
mailing list