[antlr-interest] Tree filter/rewrite wildcards

Joseph Cottam jcottam at umail.iu.edu
Wed Apr 7 11:18:53 PDT 2010


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


More information about the antlr-interest mailing list