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.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to