[antlr-interest] Found bug on lexer with ANTLR 3.0.1 with Python target
Terence Parr
parrt at cs.usfca.edu
Wed Jul 2 10:22:13 PDT 2008
IBelieve I have already had a bug about this.
Ter
On Jul 2, 2008, at 7:52 AM, Jim Idle wrote:
> 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
More information about the antlr-interest
mailing list