[antlr-interest] How can I ignore reserved words in certain cases ?

Anthony W. Youngman antlr at thewolery.demon.co.uk
Thu Nov 30 14:44:34 PST 2006


In message <20061130083648.98597.qmail at web23408.mail.ird.yahoo.com>, 
JeanChristophe Gautier <jchgautier at yahoo.fr> writes
>Obviously the second example ("print print") does not work
> because the
>token PRINT takes priority since we have testLiterals = true (note
> that
>this example is taken from a more complex grammar).
>
>The question is: how do I, under certain circumstances, ignore reserved
>word tokens?

Is v3 token filter working?

That's why I want a filter between the lexer and the parser (Monty's 
AREV grammar does this in v2 iirc), so that you can say "print is always 
followed by a string" and when the filter sees a "print" token, it will 
force the following token to a string token regardless of what the lexer 
said it was.

That to me is conceptually a far simpler approach, and I got the 
impression that functionality was intended for v3.

Cheers,
Wol
-- 
Anthony W. Youngman - anthony at thewolery.demon.co.uk



More information about the antlr-interest mailing list