[antlr-interest] Puzzling Problem

Scott Amort jsamort at rogers.com
Sun Apr 9 09:30:43 PDT 2006


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
think you could instead try adding:

tokens {
  "0";
}

After the options in your lexer.

Best,
Scott



More information about the antlr-interest mailing list