[antlr-interest] Q re syntax for relative root for TreePatternMatcher
Gerald Rosenberg
gerald at certiv.net
Thu Mar 11 09:56:37 PST 2010
Given an actual AST structure of
^(ROOT ^(PACKAGE ^(PACKAGENAME ID+)))
this tree pattern rule works as expected
package : ^(PACKAGE ^(PACKAGENAME id+=ID+)) ;
and this works
package : PACKAGE ;
However, this rule does not
package : PACKAGE ^(PACKAGENAME id+=ID+) ;
Seems that it generates code that expects a flat structure:
PACKAGE5 = (AstTree) match(input, PACKAGE,
FOLLOW_PACKAGE_in_packageStatement162);
if (state.failed) return;
match(input, PACKAGENAME,
FOLLOW_PACKAGENAME_in_packageStatement166);
if (state.failed) return;
match(input, Token.DOWN, null);
...
Is this is intended behavior?
Thanks...
More information about the antlr-interest
mailing list