LexerATNSimulator.java 文件源码

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

项目:Scratch-ApuC 作者:
protected int matchATN(@NotNull CharStream input) {
    ATNState startState = atn.modeToStartState.get(mode);

    if ( debug ) {
        System.out.format(Locale.getDefault(), "matchATN mode %d start: %s\n", mode, startState);
    }

    int old_mode = mode;

    ATNConfigSet s0_closure = computeStartState(input, startState);
    boolean suppressEdge = s0_closure.hasSemanticContext;
    s0_closure.hasSemanticContext = false;

    DFAState next = addDFAState(s0_closure);
    if (!suppressEdge) {
        decisionToDFA[mode].s0 = next;
    }

    int predict = execATN(input, next);

    if ( debug ) {
        System.out.format(Locale.getDefault(), "DFA after matchATN: %s\n", decisionToDFA[old_mode].toLexerString());
    }

    return predict;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号