[antlr-interest] Tree filter/rewrite wildcards

Jim Idle jimi at temporal-wave.com
Wed Apr 7 11:26:29 PDT 2010


Did you try:

-> ^(FUNCTION NEW_NODE $rest*);
                            ^

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Joseph Cottam
> Sent: Wednesday, April 07, 2010 11:19 AM
> To: antlr-interest at antlr.org
> 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





More information about the antlr-interest mailing list