[antlr-interest] Rewrite rules from alternative tokens, how?

Jim Idle jimi at temporal-wave.com
Sun Sep 21 14:13:17 PDT 2008


On Sun, 2008-09-21 at 16:07 +0200, Blake Friedman wrote:

> Hi,
> 
> I've run into problems trying to do something like this:
> 
> options {PREFIX;}
> 
> prefix : a=('-' | '+') prefix -> ^(PREFIX $a prefix)


As these are both tokens (I would push literals in to the lexer if I
were you, but):

prefix : (a='-' | a ='+) .....

should work I think.


Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080921/81969cb7/attachment.html 


More information about the antlr-interest mailing list