[antlr-interest] parser backtrack issue
Ashish
asengine at gmail.com
Sat Jan 19 13:58:06 PST 2008
On Jan 18, 2008 6:59 PM, Gavin Lambert <antlr at mirality.co.nz> wrote:
> At 15:44 19/01/2008, Ashish wrote:
> >I defined boolean expressions as
> >booleanExpressions
> > : booleanExpression ( BOOLEAN_OR booleanExpression )*
> > | booleanExpression ( BOOLEAN_AND booleanExpression )*
>
> That's only going to match a chain of ANDs or a chain or ORs. It
> won't match a mixed sequence of ANDs and ORs, for example. You
> probably want this:
>
> booleanExpressions
> : booleanExpression ((BOOLEAN_OR | BOOLEAN_AND)
> booleanExpression)*
> ;
>
> Or this:
>
> booleanExpressions
> : booleanExpression
> ( BOOLEAN_OR booleanExpressions
> | BOOLEAN_AND booleanExpressions
> )?
> ;
>
>
That is what I want ! Thanks for pointing that out.
-Ashish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080119/6e9102ed/attachment.html
More information about the antlr-interest
mailing list