Folks,

Ought to be a pretty simple question.  I have the following production in a 
combined grammar with tree output

collection returns [CommonTree name]
@init {
  List<CommonTree> rest = new LinkedList<CommonTree>();
}
  : OPEN { $name = pushName(newName()); } 
      ( term { rest.add($term.rest); })+ 
    CLOSE { popName(); }
    -> ^(COL { $name } term+) ????
  ;

This production is supposed to match a "collection" - An open paren followed by 
a non-zero-length sequence of <term> followed by a close paren.  Each <term> 
has two outputs - the default tree return, and the "rest" tree.  I want the 
output of this production to be the sequence of the COL tree prepended to all 
the "rest"s which are accumulated in the @init list.

I know, for example, that I can do stuff like this:

test
  :  foo bar baz
    -> foo baz
  ;

to have the list of 'foo' and 'baz' trees as output.  Thing is I don't know 
what to do with the 'rest' list above to have its elements appear in the output 
tree.

Can someone tell me what needs to go in place of ????

Thanks!

        .bill



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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to