Hi Folks

I have a production in a tree grammar with ST output

rule
        : ^(AS_RULE rName=ID rType=ID alternative+)
        ;

What I'd like is to pass in all the STs from the 'alternative' matches into a 
single multi-valued attribute for the ST for this production, like so

rule
        : ^(AS_RULE rName=ID rType=ID alternative+)
          -> someTemplate(rName={$rName.text}, alts={ ??? })
        ;

where alts iis a multi-valued attribute consisting of STs.  I know I can do this

rule
@init { List<StringTemplate> alts = new ... }
        : ^(AS_RULE rName=ID rType=ID ( a=alternative { alts.add($a.st); } )+ )
          -> someTemplate(rName={$rName.text}, alts={ alts })
        ;

but this seems clumsy.  Is there any better way?

Thanks.

        .bill

Bill Andersen 
Highfleet, Inc. (www.highfleet.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: +1.410.675.1201
Cell: +1.443.858.6444
Fax: +1.410.675.1204






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