[antlr-interest] Puzzling Problem

Sam Barnett-Cormack sdb at geekworld.co.uk
Sun Apr 9 09:59:56 PDT 2006


Scott Amort wrote:
> On Sun, 2006-04-09 at 17:07 +0100, Sam Barnett-Cormack wrote:
> 
>>And that would be a little odd... but I could instead statically define 
>>the "0" literal in the lexer, I think... I just didn't think of the 
>>effect of literals in the subgrammar. In fact, to be simpler, I could define
>>
>>zero
>>   : "0"
>>   ;
> 
> 
> I don't think that will work - you will just end up with a ZERO token
> type, and then a non-determinism error between ZERO and FLOAT_OR_INT.

I was actually suggesting zero being a parser rule in the supergrammar. 
However, I think your other suggestion may be simpler, and also of 
course do it with "-99999" as well.

Sam

> I think you could instead try adding:
> 
> tokens {
>   "0";
> }
> 
> After the options in your lexer.
> 
> Best,
> Scott
> 




More information about the antlr-interest mailing list