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

Alexander Gängel alexander at gaengel.de
Sat Mar 1 01:00:16 PST 2008


sorry I send a wrong copy of the first version it should be:

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


Alexander Gängel schrieb:
> 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/8411807f/attachment.html 


More information about the antlr-interest mailing list