[antlr-interest] Possible bug with backtrack-generated predicate methods
franck102
franck102 at yahoo.com
Fri Nov 25 23:54:33 PST 2011
The grammar below won't compile, this looks like a bug to me? It seems that
the syntactic predicate automatically generated by the backtrack option
includes the rule parameter but doesn't have a declaration for it.
The error I get is:
[08:49:44] 1 error
[08:50:01] C:\Temp\output\TestParser.java:548: cannot find symbol
[08:50:01] symbol : variable $program
[08:50:01] location: class TestParser
[08:50:01] rule($program.tree);
=====================================================
grammar Test;
options {
output=AST;
backtrack=true;
}
program
: 'raw'? ( ID->ID ) ( rule[$program.tree] -> rule )*
| 'raw' ID
;
rule[Object tree]
: 'some' ID
;
// LEXER
// ==========================================
ID
: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
;
WS : ( ' '
| '\t'
| '\r'
| '\n'
) {$channel=HIDDEN;}
;
--
View this message in context: http://antlr.1301665.n2.nabble.com/Possible-bug-with-backtrack-generated-predicate-methods-tp7033324p7033324.html
Sent from the ANTLR mailing list archive at Nabble.com.
More information about the antlr-interest
mailing list