[antlr-interest] Syntactic Predicate does not work but Backtracking does
Terence Parr
parrt at cs.usfca.edu
Sun Mar 2 13:47:28 PST 2008
those rules are totally different. One has an alternative and the
other does not.
Ter
On Mar 1, 2008, at 1:00 AM, Alexander Gängel wrote:
> 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
More information about the antlr-interest
mailing list