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

oliver_kellogg oliver_kellogg at yahoo.com
Thu Mar 11 23:39:15 PST 2004


Hi,

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

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

<*> 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