*Using rest* is closer, but still not what I need (and seems to behave oddly as well). The rest* inserts only the last item matched.
topdown: ^(f=FUNCTION rest=.*) -> ^(FUNCTION NEW_NODE $rest*);* Tree: ^(FUNCTION OLD1 OLD2 OLD3 OLD4) Yields: ^(FUNCTION NEW_NODE OLD4) -JC > Did you try: > > -> ^(FUNCTION NEW_NODE $rest*); > ^ > > Jim > >* -----Original Message-----* >>* From: antlr-interest-bounces at antlr.org >><http://www.antlr.org/mailman/listinfo/antlr-interest> >>[mailto:antlr-interest-* >>* bounces at antlr.org >><http://www.antlr.org/mailman/listinfo/antlr-interest>] On Behalf Of Joseph >>Cottam* >>* Sent: Wednesday, April 07, 2010 11:19 AM *>>* To: antlr-interest at antlr.org <http://www.antlr.org/mailman/listinfo/antlr-interest> *>>* Subject: [antlr-interest] Tree filter/rewrite wildcards *>>* *>>* Using V3.2... *>>* *>>* With grammar options: *>>* filter = true; *>>* output = AST; *>>* *>>* topdown: ^(f=FUNCTION rest=.*) -> ^(FUNCTION NEW_NODE $rest); *>>* *>>* Yields: ^(FUNCTION NEW_NODE) *>>* *>>* Regardless of the contents matched in $rest. Put another way, it seems *>>* to** match, but not output things caught up in a wildcard. *>>* *>>* Is that the defined behavior? *>>* *>>* How can I match number of anythings in tree *>>* *>>* I have also tried: *>>* rest+=.* (no change to behavior) *>>* Rule called 'rest' with just a .* in it (does not compile, tries to *>>* catch* *an exception that can't ever be thrown). *>>* *>>* *>>* -Joseph Cottam * 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
