[antlr-interest] Choosing token
Johannes Luber
jaluber at gmx.de
Fri May 11 09:19:27 PDT 2007
Stefan Chrobot wrote:
> Hello!
>
> Is there a way other than reordering the rules to tell ANTLRv3 to prefer
> token BOOLEAN instead of IDENTIFIER?
>
> grammar Test;
>
> start : BOOLEAN
> | IDENTIFIER;
>
> IDENTIFIER
> : ('a'..'z'|'A'..'Z'|'0'..'9')+;
>
> BOOLEAN : 'true' | 'false';
Yes. Look at
<http://www.antlr.org/wiki/display/ANTLR3/Quick+Starter+on+Parser+Grammars+-+No+Past+Experience+Required>
in the "How to define tokens" section for more information.
Best regards,
Johannes Luber
More information about the antlr-interest
mailing list