Hi,

I have an AST producing grammar with a desired rule like

expression_unary_minus
        :       '-' expression_power -> ^(TOK_TIMES '-1' expression_power)
        |       expression_power
        ;

This doesn't work because apparently I can't just insert a literal token 
('-1') in the rewrite rule. How do I get the same effect? Also, is there 
a way to simplify the rule into a one-liner? Ideally I would not need 
the second line since I just need a rule like

expression_unary_minus
        :       '-'? expression_power
        ;

but allowing a rewrite.

Thanks in advance,
Victor

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to