lexer grammar T;

options {backtrack=true;}

A :  '(' A ')'
    | '(' A* ')'
   ;

Gives same output ;)

Ter
On Mar 20, 2009, at 5:04 PM, Gavin Lambert wrote:

> At 08:58 21/03/2009, Terence Parr wrote:
> >Well, come to think of it, I have not tried it a while but:
> >
> >A : ('(' A ')')=> '(' A ')'
> >    | '(' A* ')'
> >   ;
> >
> >should work.  Yep, seems to:
> >
> >             if ( (LA2_0=='(') ) {
> >                 int LA2_1 = input.LA(2);
> >
> >                 if ( (synpred1_T()) ) {
> >                     alt2=1;
> >                 }
> >                 else if ( (true) ) {
> >                     alt2=2;
> >                 }
>
> I suspect we're arguing from different usages of the word  
> "backtracking" :)
>
> I was referring to *automatic* backtracking (a la "backtrack=true"  
> option).  I know that explicit predicates work ok.
>


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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to