[antlr-interest] ANTLR should warn about nullable tokens

Terence Parr parrt at cs.usfca.edu
Mon Jun 25 17:45:03 PDT 2007


Hi Guys, actually, I have a bug report already for this.  I will add  
the test.  It seems to happen with alarming frequency.

Ter
On Jun 26, 2007, at 9:57 AM, Randall R Schulz wrote:

> On Monday 25 June 2007 16:44, David Piepgrass wrote:
>> 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.
>
>
> It's probably inappropriate to put such heuristic diagnostics into the
> ANTLR compiler generator itself.
>
> Perhaps it's time for a lint- / PMD-style tool for ANTLR?
>
>
> Randall Schulz



More information about the antlr-interest mailing list