[antlr-interest] ANTLR should warn about nullable tokens

David Piepgrass qwertie256 at gmail.com
Mon Jun 25 16:44:03 PDT 2007


I was testing my lexer on an invalid input when it entered an infinite loop.

It turns out this was because of my whitepace rule:

WS: (' '|'\t'|'\n'|'\r'|'\u000C')* { $channel=HIDDEN; };

Which caused an infinite sequence of WS tokens. It should be

WS: (' '|'\t'|'\n'|'\r'|'\u000C')+ { $channel=HIDDEN; };

IMO, ANTLR should give a warning about this.


More information about the antlr-interest mailing list