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;
}
Ter
On Mar 20, 2009, at 12:55 PM, Gavin Lambert wrote:
> At 07:31 21/03/2009, Terence Parr wrote:
>> Hi. ANTLR generates lexer's, parsers, tree parsers with the same
>
>> code generator and all of those derive from a single base class.
>
>> all three can backtrack :) in the case of the lexer, though,
>> it's not the kind of backtracking you see in lex.
>
> Doesn't backtracking require support from the code-generation
> templates, though? It was my impression that the templates for
> the lexer don't contain the necessary pieces to actually do the
> backtracking, even though the base class does.
>
> (Besides which, it never seems to want to backtrack all the way to
> mTOKENS.)
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
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
-~----------~----~----~----~------~----~------~--~---