[antlr-interest] Re: Manually insert a node into an automatically contructed tree

oliver_kellogg oliver_kellogg at yahoo.com
Sat Mar 13 11:31:38 PST 2004


Terence Parr wrote:
> 
> Oh, sorry about that...that rule has no content to match. Put this
> imaginary root generation code in the rule where you actually match
> stuff that needs an imaginary root.

Ah, just to make sure I am understanding you:
I changed the original

  component_list [boolean has_discrim]
    : component_items ( variant_part { has_discrim }? )?
    | empty_component_items variant_part { has_discrim }?
    ;

to

  component_list [boolean has_discrim]
    : component_items ( variant_part { has_discrim }? )?
    |! vp:variant_part { has_discrim }?
         { #component_list =
             #(#[COMPONENT_LIST, "COMPONENT_LIST"],
               #(#[COMPONENT_ITEMS, "COMPONENT_ITEMS"]), #vp); }
    ;

Is that what you had in mind?

Thanks alot,

Oliver




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list