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

Terence Parr parrt at cs.usfca.edu
Fri Mar 12 15:20:01 PST 2004


On Mar 11, 2004, at 11:39 PM, oliver_kellogg wrote:

> Hi,
>
> Is it possible to insert an artificial (dummy) item in the tree
> that is automatically constructed for a rule?

Yes.  It looks like you are doing so below...doesn't that work?

Thanks,
Ter
>
> I would like to do this for the sake of a more regular
> node structure. Here is the concerning rule:
>
> component_list [boolean has_discrim]
>   : component_items ( variant_part { has_discrim }? )?
>   | /* empty_component_items */ variant_part { has_discrim }?
>   ;
>
> At the place of the empty_component_items, I would like
> to insert the empty node.
> This would make the tree look the same regardless of
> whether or not the component_items are present.
>
> The component_items rule is this:
>
> component_items : ( pragma | comp_decl )+
>   { #component_items =
>      #(#[COMPONENT_ITEMS, "COMPONENT_ITEMS"], #component_items); }
>
>
> Thanks,
>
> Oliver
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
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