[antlr-interest] Workaround: Does @synpredgate work per rule?

Colin Macdonald Colin.Macdonald at us.gbs.com
Tue Nov 23 07:42:10 PST 2010


FYI - I put in place a workaround by including (state.backtracking>0) in 
my predicate.

This works, but will cause lookahead to produce false positives in some 
cases.


Colin Macdonald
Senior Consultant
_____________________________________ 

GROUP Business Software

http://www.gbs.com/
----- Forwarded by Colin Macdonald/NA/GBS on 2010-11-23 10:06 AM -----

From:   Colin Macdonald <Colin.Macdonald at us.gbs.com>
To:     antlr-interest at antlr.org
Date:   2010-11-22 01:38 PM
Subject:        [antlr-interest] Does @synpredgate work per rule?
Sent by:        antlr-interest-bounces at antlr.org



Hi all, quick question,

Searching the forums leads me to believe that @synpredgate works at the 
rule level.  However my attempts (in Java target) still end up with "if ( 
state.backtracking==0 )" code

Terence posted this, which seems to indicate that it will work

http://markmail.org/message/fv4teaxn6xnac7r7 

A month earlier he'd described the exact problem I'm facing with syntactic 

predicates and setting necessary scope variables in actions during 
backtracking.  But didn't have a solution at that time.

http://www.antlr.org/wiki/display/ANTLR3/Action+execution+during+backtracking 



Thanks
Colin


More information about the antlr-interest mailing list