[antlr-interest] Found bug on lexer with ANTLR 3.0.1 with Python target

Jim Idle jimi at temporal-wave.com
Wed Jul 2 07:52:52 PDT 2008


On Wed, 2008-07-02 at 11:44 +0200, Benjamin Niemann wrote:

> Hi Cesare,
> 
> [+antlr-interest, as this might be of interest for more people]
> 
> I don't think, this is a problem specific to Python.
> You define INT as ('0'..'9')*, so an empty token is a valid int.


This is not a bug - defining an empty lexer token is not a valid thing
to do.


> Technically the behavior is correct, albeit not very useful. The
> correct solution would be to emit a warning or even error for tokens
> that could match an empty sequence.



I agree that an empty token definition should issue an error - it seems a lot of people fall over this inadvertently. 

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080702/ff8a1fbc/attachment.html 


More information about the antlr-interest mailing list