[antlr-interest] Syntactic Predicate does not work but Backtracking does

Alexander Gängel alexander at gaengel.de
Fri Feb 29 15:33:23 PST 2008


I have a rule in my grammar like this:

    expression_comma options
        :(
        (expression COMMA)=>expression (COMMA expression_comma)?
    ->expression expression_comma?
        |expression->expression
        )
        ;


my some Input like expression, expression does not work even when both 
parts left and rigth of the comma are expressions.

if I use this rule with backtracking it works.

    oclExpression_comma options {backtrack=true;}
        :
        oclExpression (COMMA oclExpression_comma)? ->oclExpression
    oclExpression_comma?
        ;


Am I wrong or should both work all right?
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080301/0759335f/attachment.html 


More information about the antlr-interest mailing list