ParserATNSimulator.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:Scratch-ApuC 作者:
/** Used for debugging in adaptivePredict around execATN but I cut
 *  it out for clarity now that alg. works well. We can leave this
 *  "dead" code for a bit.
 */
public void dumpDeadEndConfigs(@NotNull NoViableAltException nvae) {
    System.err.println("dead end configs: ");
    for (ATNConfig c : nvae.getDeadEndConfigs()) {
        String trans = "no edges";
        if ( c.state.getNumberOfTransitions()>0 ) {
            Transition t = c.state.transition(0);
            if ( t instanceof AtomTransition) {
                AtomTransition at = (AtomTransition)t;
                trans = "Atom "+getTokenName(at.label);
            }
            else if ( t instanceof SetTransition ) {
                SetTransition st = (SetTransition)t;
                boolean not = st instanceof NotSetTransition;
                trans = (not?"~":"")+"Set "+st.set.toString();
            }
        }
        System.err.println(c.toString(parser, true)+":"+trans);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号