Java 类org.antlr.v4.runtime.atn.PredicateTransition 实例源码

项目:Scratch-ApuC    文件:FailedPredicateException.java   
public FailedPredicateException(@NotNull Parser recognizer,
                                @Nullable String predicate,
                                @Nullable String message)
{
    super(formatMessage(predicate, message), recognizer, recognizer.getInputStream(), recognizer._ctx);
    ATNState s = recognizer.getInterpreter().atn.states.get(recognizer.getState());

    AbstractPredicateTransition trans = (AbstractPredicateTransition)s.transition(0);
    if (trans instanceof PredicateTransition) {
        this.ruleIndex = ((PredicateTransition)trans).ruleIndex;
        this.predicateIndex = ((PredicateTransition)trans).predIndex;
    }
    else {
        this.ruleIndex = 0;
        this.predicateIndex = 0;
    }

    this.predicate = predicate;
    this.setOffendingToken(recognizer.getCurrentToken());
}