ParserFactory.java 文件源码

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

项目:codebuff 作者:
@Override
public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) {
    int decision = ((DecisionState)blkAST.atnState).decision;
    Choice c;
    if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) {
        c = getLL1ChoiceBlock(blkAST, alts);
    }
    else {
        c = getComplexChoiceBlock(blkAST, alts);
    }

    if ( labelAST!=null ) { // for x=(...), define x or x_list
        String label = labelAST.getText();
        Decl d = getTokenLabelDecl(label);
        c.label = d;
        getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d);
        if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN  ) {
            String listLabel = gen.getTarget().getListLabel(label);
            TokenListDecl l = new TokenListDecl(this, listLabel);
            getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l);
        }
    }

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


问题


面经


文章

微信
公众号

扫码关注公众号