[antlr-interest] Lists of one & rewrite rules

Alex Milowski alexml at milowski.com
Thu Mar 1 08:50:08 PST 2007

I currently have a rule like:

   orExpr : andExpr ( or andExpr )* ->
         ^(OR_OP andExpr*);

That means I always get a tree like:

(OR_OP expr ...)

but for a singleton I'd like just the expression
instead of:

(OR_OP expr)

How do I do that in the re-write rule?  Can I test for
just one item in the list ?

--Alex Milowski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070301/6ef1a2e2/attachment.html 

More information about the antlr-interest mailing list