I have a rule (in a tree pattern matcher) that uses a validating
semantic predicate.  When the predicate returns false, I expected to
catch a FailedPredicateException and take some custom action.
However, the FailedPredicateException is not getting thrown.  Looking
at the generated code, the problem appears to be that the exception
only gets thrown conditionally (if state.backtracking==0).  For some
reason that is beyond my meager understanding, state.backtracking = 1
when the semantic predicate fails.

Any clues for me?

Thanks,
Tom Smith.

tree grammar Trans;

options {
        tokenVocab=SsipAST;
        output=AST;
        ASTLabelType=CommonTree;
        filter = true;
}
...
transition
scope {
    ...
}
@init {
    ...
}
        :       ^(TRANSITION s1=stateName s2=stateName arcBody[$s1.text])
        { checkTransition($s1.text, $s2.text) }?
        { System.err.println("Transition from " + $s1.text + " to " +
$s2.text + " is OK"); }
        ;
        catch [FailedPredicateException fpe] {
                String msg = String.format("In transition from \%s to \%s, 
liveness
is not consistent", $s1.text, $s2.text);
                throw new SemanticException(msg);
        }

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