[antlr-interest] ANTLR NUB
Gavin Lambert
antlr at mirality.co.nz
Mon Jan 21 11:46:05 PST 2008
At 08:37 22/01/2008, Andy Tripp wrote:
>
>Try replacing OCCURRENCE, YEAR, and DAY_OF_MONTH with a single
rule
>for handling numbers:
>
>NUMBER: ('0'..'9)*;
Yeah, that's another thing you need to watch out for: never have a
top-level lexer rule that can match nothing. (It leads to
infinite loops, since it can always match nothing without
advancing the input stream.)
So you need to use + in preference to *, as I said earlier :)
More information about the antlr-interest
mailing list