java类org.antlr.v4.runtime.atn.ATN的实例源码

ATNOptimizer.java 文件源码 项目:codebuff 阅读 18 收藏 0 点赞 0 评论 0
private static void optimizeStates(ATN atn) {
//      System.out.println(atn.states);
        List<ATNState> compressed = new ArrayList<ATNState>();
        int i = 0; // new state number
        for (ATNState s : atn.states) {
            if ( s!=null ) {
                compressed.add(s);
                s.stateNumber = i; // reset state number as we shift to new position
                i++;
            }
        }
//      System.out.println(compressed);
//      System.out.println("ATN optimizer removed " + (atn.states.size() - compressed.size()) + " null states.");
        atn.states.clear();
        atn.states.addAll(compressed);
    }
StatisticsParserATNSimulator.java 文件源码 项目:goworks 阅读 20 收藏 0 点赞 0 评论 0
public StatisticsParserATNSimulator(ATN atn) {
    super(atn);
    decisionInvocations = new long[atn.decisionToState.size()];
    fullContextFallback = new long[atn.decisionToState.size()];
    nonSll = new long[atn.decisionToState.size()];
    ambiguousResult = new long[atn.decisionToState.size()];
    totalTransitions = new long[atn.decisionToState.size()];
    computedTransitions = new long[atn.decisionToState.size()];
    fullContextTransitions = new long[atn.decisionToState.size()];
    totalLookaheadSll = new long[atn.decisionToState.size()];
    totalLookaheadLl = new long[atn.decisionToState.size()];
    minLookaheadSll = new long[atn.decisionToState.size()];
    maxLookaheadSll = new long[atn.decisionToState.size()];
    minLookaheadLl = new long[atn.decisionToState.size()];
    maxLookaheadLl = new long[atn.decisionToState.size()];
    for (int i = 0; i < minLookaheadSll.length; i++) {
        minLookaheadSll[i] = Long.MAX_VALUE;
        minLookaheadLl[i] = Long.MAX_VALUE;
        maxLookaheadSll[i] = Long.MIN_VALUE;
        maxLookaheadLl[i] = Long.MIN_VALUE;
    }
}
StatisticsParserATNSimulator.java 文件源码 项目:goworks 阅读 31 收藏 0 点赞 0 评论 0
public StatisticsParserATNSimulator(Parser parser, ATN atn) {
    super(parser, atn);
    decisionInvocations = new long[atn.decisionToState.size()];
    fullContextFallback = new long[atn.decisionToState.size()];
    nonSll = new long[atn.decisionToState.size()];
    ambiguousResult = new long[atn.decisionToState.size()];
    totalTransitions = new long[atn.decisionToState.size()];
    computedTransitions = new long[atn.decisionToState.size()];
    fullContextTransitions = new long[atn.decisionToState.size()];
    totalLookaheadSll = new long[atn.decisionToState.size()];
    totalLookaheadLl = new long[atn.decisionToState.size()];
    minLookaheadSll = new long[atn.decisionToState.size()];
    maxLookaheadSll = new long[atn.decisionToState.size()];
    minLookaheadLl = new long[atn.decisionToState.size()];
    maxLookaheadLl = new long[atn.decisionToState.size()];
    for (int i = 0; i < minLookaheadSll.length; i++) {
        minLookaheadSll[i] = Long.MAX_VALUE;
        minLookaheadLl[i] = Long.MAX_VALUE;
        maxLookaheadSll[i] = Long.MIN_VALUE;
        maxLookaheadLl[i] = Long.MIN_VALUE;
    }
}
GoParserFactory.java 文件源码 项目:goworks 阅读 20 收藏 0 点赞 0 评论 0
public static SemanticContext.Predicate getQidPredicate(@NonNull ATN atn) {
    int predicateIndex = -1;
    for (ATNState state : atn.states) {
        if (state.ruleIndex != GoParser.RULE_qualifiedIdentifier) {
            continue;
        }

        for (int i = 0; i < state.getNumberOfOptimizedTransitions(); i++) {
            Transition transition = state.getOptimizedTransition(i);
            if (transition instanceof PredicateTransition) {
                predicateIndex = ((PredicateTransition)transition).predIndex;
            }
        }
    }

    assert predicateIndex >= 0 : "Couldn't find the QID predicate transition.";
    return new SemanticContext.Predicate(GoParser.RULE_qualifiedIdentifier, predicateIndex, false);
}
LexerInterpreter.java 文件源码 项目:Scratch-ApuC 阅读 20 收藏 0 点赞 0 评论 0
public LexerInterpreter(String grammarFileName, Collection<String> tokenNames, Collection<String> ruleNames, Collection<String> modeNames, ATN atn, CharStream input) {
    super(input);

    if (atn.grammarType != ATNType.LEXER) {
        throw new IllegalArgumentException("The ATN must be a lexer ATN.");
    }

    this.grammarFileName = grammarFileName;
    this.atn = atn;
    this.tokenNames = tokenNames.toArray(new String[tokenNames.size()]);
    this.ruleNames = ruleNames.toArray(new String[ruleNames.size()]);
    this.modeNames = modeNames.toArray(new String[modeNames.size()]);

    this._decisionToDFA = new DFA[atn.getNumberOfDecisions()];
    for (int i = 0; i < _decisionToDFA.length; i++) {
        _decisionToDFA[i] = new DFA(atn.getDecisionState(i), i);
    }
    this._interp = new LexerATNSimulator(this,atn,_decisionToDFA,_sharedContextCache);
}
Parser.java 文件源码 项目:Scratch-ApuC 阅读 23 收藏 0 点赞 0 评论 0
/**
 * The ATN with bypass alternatives is expensive to create so we create it
 * lazily.
 *
 * @throws UnsupportedOperationException if the current parser does not
 * implement the {@link #getSerializedATN()} method.
 */
@NotNull
public ATN getATNWithBypassAlts() {
    String serializedAtn = getSerializedATN();
    if (serializedAtn == null) {
        throw new UnsupportedOperationException("The current parser does not support an ATN with bypass alternatives.");
    }

    synchronized (bypassAltsAtnCache) {
        ATN result = bypassAltsAtnCache.get(serializedAtn);
        if (result == null) {
            ATNDeserializationOptions deserializationOptions = new ATNDeserializationOptions();
            deserializationOptions.setGenerateRuleBypassTransitions(true);
            result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn.toCharArray());
            bypassAltsAtnCache.put(serializedAtn, result);
        }

        return result;
    }
}
CParser.java 文件源码 项目:BEAST 阅读 23 收藏 0 点赞 0 评论 0
public final DeclarationSpecifiersContext declarationSpecifiers() throws RecognitionException {
    DeclarationSpecifiersContext _localctx = new DeclarationSpecifiersContext(_ctx, getState());
    enterRule(_localctx, 50, RULE_declarationSpecifiers);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
        setState(517); 
        _errHandler.sync(this);
        _alt = 1;
        do {
            switch (_alt) {
            case 1:
                {
                {
                setState(516);
                declarationSpecifier();
                }
                }
                break;
            default:
                throw new NoViableAltException(this);
            }
            setState(519); 
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input,32,_ctx);
        } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
        }
    }
    catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    }
    finally {
        exitRule();
    }
    return _localctx;
}
CParser.java 文件源码 项目:BEAST 阅读 23 收藏 0 点赞 0 评论 0
public final DeclarationSpecifiers2Context declarationSpecifiers2() throws RecognitionException {
    DeclarationSpecifiers2Context _localctx = new DeclarationSpecifiers2Context(_ctx, getState());
    enterRule(_localctx, 52, RULE_declarationSpecifiers2);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
        setState(522); 
        _errHandler.sync(this);
        _alt = 1;
        do {
            switch (_alt) {
            case 1:
                {
                {
                setState(521);
                declarationSpecifier();
                }
                }
                break;
            default:
                throw new NoViableAltException(this);
            }
            setState(524); 
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input,33,_ctx);
        } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
        }
    }
    catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    }
    finally {
        exitRule();
    }
    return _localctx;
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 24 收藏 0 点赞 0 评论 0
public final SelectListContext selectList() throws RecognitionException {
    SelectListContext _localctx = new SelectListContext(_ctx, getState());
    enterRule(_localctx, 38, RULE_selectList);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(416);
            selectListElem();
            setState(421);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 40, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(417);
                            match(COMMA);
                            setState(418);
                            selectListElem();
                        }
                    }
                }
                setState(423);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 40, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 26 收藏 0 点赞 0 评论 0
public final TableSourcesContext tableSources() throws RecognitionException {
    TableSourcesContext _localctx = new TableSourcesContext(_ctx, getState());
    enterRule(_localctx, 42, RULE_tableSources);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(447);
            tableSource();
            setState(452);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 46, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(448);
                            match(COMMA);
                            setState(449);
                            tableSource();
                        }
                    }
                }
                setState(454);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 46, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
SqlGrammarParser.java 文件源码 项目:coherence-sql 阅读 21 收藏 0 点赞 0 评论 0
public final TableSourceItemJoinedContext tableSourceItemJoined() throws RecognitionException {
    TableSourceItemJoinedContext _localctx = new TableSourceItemJoinedContext(_ctx, getState());
    enterRule(_localctx, 46, RULE_tableSourceItemJoined);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(462);
            tableSourceItem();
            setState(466);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 48, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(463);
                            joinPart();
                        }
                    }
                }
                setState(468);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 48, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
CypherParser.java 文件源码 项目:cyp2sql 阅读 21 收藏 0 点赞 0 评论 0
public final NamespaceContext namespace() throws RecognitionException {
    NamespaceContext _localctx = new NamespaceContext(_ctx, getState());
    enterRule(_localctx, 164, RULE_namespace);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1399);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input,249,_ctx);
            while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
                if ( _alt==1 ) {
                    {
                        {
                            setState(1394);
                            symbolicName();
                            setState(1395);
                            match(T__23);
                        }
                    }
                }
                setState(1401);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input,249,_ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
GrammarParserInterpreter.java 文件源码 项目:codebuff 阅读 24 收藏 0 点赞 0 评论 0
public GrammarParserInterpreter(Grammar g,
                                String grammarFileName,
                                Vocabulary vocabulary,
                                Collection<String> ruleNames,
                                ATN atn,
                                TokenStream input) {
    super(grammarFileName, vocabulary, ruleNames, atn, input);
    this.g = g;
}
GrammarParserInterpreter.java 文件源码 项目:codebuff 阅读 19 收藏 0 点赞 0 评论 0
public GrammarParserInterpreter(Grammar g, ATN atn, TokenStream input) {
    super(g.fileName, g.getVocabulary(),
          Arrays.asList(g.getRuleNames()),
          atn, // must run ATN through serializer to set some state flags
          input);
    this.g = g;
    decisionStatesThatSetOuterAltNumInContext = findOuterMostDecisionStates();
    stateToAltsMap = new int[g.atn.states.size()][];
}
Grammar.java 文件源码 项目:codebuff 阅读 28 收藏 0 点赞 0 评论 0
public ATN getATN() {
    if ( atn==null ) {
        ParserATNFactory factory = new ParserATNFactory(this);
        atn = factory.createATN();
    }
    return atn;
}
Grammar.java 文件源码 项目:codebuff 阅读 32 收藏 0 点赞 0 评论 0
public LexerInterpreter createLexerInterpreter(CharStream input) {
    if (this.isParser()) {
        throw new IllegalStateException("A lexer interpreter can only be created for a lexer or combined grammar.");
    }

    if (this.isCombined()) {
        return implicitLexer.createLexerInterpreter(input);
    }

    char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn);
    ATN deserialized = new ATNDeserializer().deserialize(serializedAtn);
    return new LexerInterpreter(fileName, getVocabulary(), Arrays.asList(getRuleNames()), ((LexerGrammar)this).modes.keySet(), deserialized, input);
}
Grammar.java 文件源码 项目:codebuff 阅读 27 收藏 0 点赞 0 评论 0
/** @since 4.5.1 */
public GrammarParserInterpreter createGrammarParserInterpreter(TokenStream tokenStream) {
    if (this.isLexer()) {
        throw new IllegalStateException("A parser interpreter can only be created for a parser or combined grammar.");
    }
    char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn);
    ATN deserialized = new ATNDeserializer().deserialize(serializedAtn);
    return new GrammarParserInterpreter(this, deserialized, tokenStream);
}
Grammar.java 文件源码 项目:codebuff 阅读 25 收藏 0 点赞 0 评论 0
public ParserInterpreter createParserInterpreter(TokenStream tokenStream) {
    if (this.isLexer()) {
        throw new IllegalStateException("A parser interpreter can only be created for a parser or combined grammar.");
    }

    char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn);
    ATN deserialized = new ATNDeserializer().deserialize(serializedAtn);
    return new ParserInterpreter(fileName, getVocabulary(), Arrays.asList(getRuleNames()), deserialized, tokenStream);
}
ParserATNFactory.java 文件源码 项目:codebuff 阅读 24 收藏 0 点赞 0 评论 0
public ParserATNFactory(Grammar g) {
    if (g == null) {
        throw new NullPointerException("g");
    }

    this.g = g;

    ATNType atnType = g instanceof LexerGrammar ? ATNType.LEXER : ATNType.PARSER;
    int maxTokenType = g.getMaxTokenType();
    this.atn = new ATN(atnType, maxTokenType);
}
ParserATNFactory.java 文件源码 项目:codebuff 阅读 19 收藏 0 点赞 0 评论 0
@Override
public ATN createATN() {
    _createATN(g.rules.values());
    assert atn.maxTokenType == g.getMaxTokenType();
       addRuleFollowLinks();
    addEOFTransitionToStartRules();
    ATNOptimizer.optimize(g, atn);

    for (Triple<Rule, ATNState, ATNState> pair : preventEpsilonClosureBlocks) {
        LL1Analyzer analyzer = new LL1Analyzer(atn);
        if (analyzer.LOOK(pair.b, pair.c, null).contains(org.antlr.v4.runtime.Token.EPSILON)) {
            ErrorType errorType = pair.a instanceof LeftRecursiveRule ? ErrorType.EPSILON_LR_FOLLOW : ErrorType.EPSILON_CLOSURE;
            g.tool.errMgr.grammarError(errorType, g.fileName, ((GrammarAST)pair.a.ast.getChild(0)).getToken(), pair.a.name);
        }
    }

    optionalCheck:
    for (Triple<Rule, ATNState, ATNState> pair : preventEpsilonOptionalBlocks) {
        int bypassCount = 0;
        for (int i = 0; i < pair.b.getNumberOfTransitions(); i++) {
            ATNState startState = pair.b.transition(i).target;
            if (startState == pair.c) {
                bypassCount++;
                continue;
            }

            LL1Analyzer analyzer = new LL1Analyzer(atn);
            if (analyzer.LOOK(startState, pair.c, null).contains(org.antlr.v4.runtime.Token.EPSILON)) {
                g.tool.errMgr.grammarError(ErrorType.EPSILON_OPTIONAL, g.fileName, ((GrammarAST)pair.a.ast.getChild(0)).getToken(), pair.a.name);
                continue optionalCheck;
            }
        }

        if (bypassCount != 1) {
            throw new UnsupportedOperationException("Expected optional block with exactly 1 bypass alternative.");
        }
    }

    return atn;
}
SerializedATN.java 文件源码 项目:codebuff 阅读 19 收藏 0 点赞 0 评论 0
public SerializedATN(OutputModelFactory factory, ATN atn) {
        super(factory);
        IntegerList data = ATNSerializer.getSerialized(atn);
        serialized = new ArrayList<String>(data.size());
        for (int c : data.toArray()) {
            String encoded = factory.getGenerator().getTarget().encodeIntAsCharEscape(c == -1 ? Character.MAX_VALUE : c);
            serialized.add(encoded);
        }
//      System.out.println(ATNSerializer.getDecoded(factory.getGrammar(), atn));
    }
Verilog2001Parser.java 文件源码 项目:netlist-graph 阅读 23 收藏 0 点赞 0 评论 0
public final List_of_port_identifiersContext list_of_port_identifiers() throws RecognitionException {
    List_of_port_identifiersContext _localctx = new List_of_port_identifiersContext(_ctx, getState());
    enterRule(_localctx, 108, RULE_list_of_port_identifiers);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
        setState(1464);
        port_identifier();
        setState(1469);
        _errHandler.sync(this);
        _alt = getInterpreter().adaptivePredict(_input,133,_ctx);
        while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
            if ( _alt==1 ) {
                {
                {
                setState(1465);
                match(T__16);
                setState(1466);
                port_identifier();
                }
                } 
            }
            setState(1471);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input,133,_ctx);
        }
        }
    }
    catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    }
    finally {
        exitRule();
    }
    return _localctx;
}
Verilog2001Parser.java 文件源码 项目:netlist-graph 阅读 19 收藏 0 点赞 0 评论 0
public final List_of_param_assignmentsContext list_of_param_assignments() throws RecognitionException {
    List_of_param_assignmentsContext _localctx = new List_of_param_assignmentsContext(_ctx, getState());
    enterRule(_localctx, 112, RULE_list_of_param_assignments);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
        setState(1480);
        param_assignment();
        setState(1485);
        _errHandler.sync(this);
        _alt = getInterpreter().adaptivePredict(_input,135,_ctx);
        while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
            if ( _alt==1 ) {
                {
                {
                setState(1481);
                match(T__16);
                setState(1482);
                param_assignment();
                }
                } 
            }
            setState(1487);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input,135,_ctx);
        }
        }
    }
    catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    }
    finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 19 收藏 0 点赞 0 评论 0
public final Declaration_specifiersContext declaration_specifiers() throws RecognitionException {
    Declaration_specifiersContext _localctx = new Declaration_specifiersContext(_ctx, getState());
    enterRule(_localctx, 168, RULE_declaration_specifiers);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(913);
            _errHandler.sync(this);
            _alt = 1;
            do {
                switch (_alt) {
                    case 1: {
                        {
                            setState(912);
                            declaration_specifier();
                        }
                    }
                    break;
                    default:
                        throw new NoViableAltException(this);
                }
                setState(915);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 83, _ctx);
            } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 27 收藏 0 点赞 0 评论 0
public final Specifier_qualifier_listContext specifier_qualifier_list() throws RecognitionException {
    Specifier_qualifier_listContext _localctx = new Specifier_qualifier_listContext(_ctx, getState());
    enterRule(_localctx, 184, RULE_specifier_qualifier_list);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(967);
            _errHandler.sync(this);
            _alt = 1;
            do {
                switch (_alt) {
                    case 1: {
                        {
                            setState(966);
                            specifier_qualifier();
                        }
                    }
                    break;
                    default:
                        throw new NoViableAltException(this);
                }
                setState(969);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 92, _ctx);
            } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 21 收藏 0 点赞 0 评论 0
public final Parameter_declaration_listContext parameter_declaration_list() throws RecognitionException {
    Parameter_declaration_listContext _localctx = new Parameter_declaration_listContext(_ctx, getState());
    enterRule(_localctx, 216, RULE_parameter_declaration_list);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1176);
            parameter_declaration();
            setState(1181);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 130, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1177);
                            match(COMMA);
                            setState(1178);
                            parameter_declaration();
                        }
                    }
                }
                setState(1183);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 130, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 25 收藏 0 点赞 0 评论 0
public final Statement_listContext statement_list() throws RecognitionException {
    Statement_listContext _localctx = new Statement_listContext(_ctx, getState());
    enterRule(_localctx, 218, RULE_statement_list);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1185);
            _errHandler.sync(this);
            _alt = 1;
            do {
                switch (_alt) {
                    case 1: {
                        {
                            setState(1184);
                            statement();
                        }
                    }
                    break;
                    default:
                        throw new NoViableAltException(this);
                }
                setState(1187);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 131, _ctx);
            } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 20 收藏 0 点赞 0 评论 0
public final ExpressionContext expression() throws RecognitionException {
    ExpressionContext _localctx = new ExpressionContext(_ctx, getState());
    enterRule(_localctx, 250, RULE_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1337);
            assignment_expression();
            setState(1342);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 150, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1338);
                            match(COMMA);
                            setState(1339);
                            assignment_expression();
                        }
                    }
                }
                setState(1344);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 150, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 23 收藏 0 点赞 0 评论 0
public final Logical_or_expressionContext logical_or_expression() throws RecognitionException {
    Logical_or_expressionContext _localctx = new Logical_or_expressionContext(_ctx, getState());
    enterRule(_localctx, 260, RULE_logical_or_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1368);
            logical_and_expression();
            setState(1373);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 154, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1369);
                            match(OR);
                            setState(1370);
                            logical_and_expression();
                        }
                    }
                }
                setState(1375);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 154, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
ObjCParser.java 文件源码 项目:Objc2Lua 阅读 20 收藏 0 点赞 0 评论 0
public final Logical_and_expressionContext logical_and_expression() throws RecognitionException {
    Logical_and_expressionContext _localctx = new Logical_and_expressionContext(_ctx, getState());
    enterRule(_localctx, 262, RULE_logical_and_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1376);
            inclusive_or_expression();
            setState(1381);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 155, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1377);
                            match(AND);
                            setState(1378);
                            inclusive_or_expression();
                        }
                    }
                }
                setState(1383);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 155, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}


问题


面经


文章

微信
公众号

扫码关注公众号