[antlr-interest] compilation error with tree filters under 3.4
Tom Smith
yotommy at gmail.com
Thu Jan 5 10:13:25 PST 2012
I am trying to upgrade from 3.1.3 to 3.4, but I am now encountering a
compile error on the generated code. The toy tree filter shown below
reproduces the problem. The compilation error is:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
(default-compile) on project treeNotFound: Compilation failure
[ERROR] /Users/tsmith/devel/antlr/treeNotFound/target/generated-sources/antlr3/example/TFilter.java:[249,52]
cannot find symbol
[ERROR] symbol : variable tree
[ERROR] location: class org.antlr.runtime.RuleReturnScope
The generated source line in question is:
if ( _first_1==null ) _first_1 = vl.tree;
vl is declared as RuleReturnScope, which does not have a public field
named 'tree'.
Suggestions?
Thanks,
Tom Smith.
===
tree grammar TFilter;
options {
tokenVocab=TParser;
output=AST;
ASTLabelType=CommonTree;
filter = true;
}
@header {
package example;
import java.util.List;
}
topdown
: topRule
;
topRule
: assignListLhs { System.out.println($assignListLhs.variableList); }
;
assignListLhs returns[List<Tree> variableList]
: ^(LIST vl+=varName+) { $variableList = $vl; }
;
varName
: Identifier
;
More information about the antlr-interest
mailing list