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

项目:codebuff    文件:ATNOptimizer.java   
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);
    }
项目:goworks    文件:StatisticsParserATNSimulator.java   
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;
    }
}
项目:goworks    文件:StatisticsParserATNSimulator.java   
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;
    }
}
项目:goworks    文件:GoParserFactory.java   
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);
}
项目:Scratch-ApuC    文件:LexerInterpreter.java   
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);
}
项目:Scratch-ApuC    文件:Parser.java   
/**
 * 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;
    }
}
项目:BEAST    文件:CParser.java   
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;
}
项目:BEAST    文件:CParser.java   
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;
}
项目:coherence-sql    文件:SqlGrammarParser.java   
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;
}
项目:coherence-sql    文件:SqlGrammarParser.java   
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;
}
项目:coherence-sql    文件:SqlGrammarParser.java   
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;
}
项目:cyp2sql    文件:CypherParser.java   
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;
}
项目:codebuff    文件:GrammarParserInterpreter.java   
public GrammarParserInterpreter(Grammar g,
                                String grammarFileName,
                                Vocabulary vocabulary,
                                Collection<String> ruleNames,
                                ATN atn,
                                TokenStream input) {
    super(grammarFileName, vocabulary, ruleNames, atn, input);
    this.g = g;
}
项目:codebuff    文件:GrammarParserInterpreter.java   
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()][];
}
项目:codebuff    文件:Grammar.java   
public ATN getATN() {
    if ( atn==null ) {
        ParserATNFactory factory = new ParserATNFactory(this);
        atn = factory.createATN();
    }
    return atn;
}
项目:codebuff    文件:Grammar.java   
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);
}
项目:codebuff    文件:Grammar.java   
/** @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);
}
项目:codebuff    文件:Grammar.java   
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);
}
项目:codebuff    文件:ParserATNFactory.java   
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);
}
项目:codebuff    文件:ParserATNFactory.java   
@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;
}
项目:codebuff    文件:SerializedATN.java   
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));
    }
项目:netlist-graph    文件:Verilog2001Parser.java   
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;
}
项目:netlist-graph    文件:Verilog2001Parser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
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;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Inclusive_or_expressionContext inclusive_or_expression() throws RecognitionException {
    Inclusive_or_expressionContext _localctx = new Inclusive_or_expressionContext(_ctx, getState());
    enterRule(_localctx, 264, RULE_inclusive_or_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1384);
            exclusive_or_expression();
            setState(1389);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 156, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1385);
                            match(BITOR);
                            setState(1386);
                            exclusive_or_expression();
                        }
                    }
                }
                setState(1391);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 156, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Exclusive_or_expressionContext exclusive_or_expression() throws RecognitionException {
    Exclusive_or_expressionContext _localctx = new Exclusive_or_expressionContext(_ctx, getState());
    enterRule(_localctx, 266, RULE_exclusive_or_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1392);
            and_expression();
            setState(1397);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 157, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1393);
                            match(CARET);
                            setState(1394);
                            and_expression();
                        }
                    }
                }
                setState(1399);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 157, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final And_expressionContext and_expression() throws RecognitionException {
    And_expressionContext _localctx = new And_expressionContext(_ctx, getState());
    enterRule(_localctx, 268, RULE_and_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1400);
            equality_expression();
            setState(1405);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 158, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1401);
                            match(BITAND);
                            setState(1402);
                            equality_expression();
                        }
                    }
                }
                setState(1407);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 158, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Equality_expressionContext equality_expression() throws RecognitionException {
    Equality_expressionContext _localctx = new Equality_expressionContext(_ctx, getState());
    enterRule(_localctx, 270, RULE_equality_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1408);
            relational_expression();
            setState(1414);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 159, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1409);
                            equality_op();
                            setState(1410);
                            relational_expression();
                        }
                    }
                }
                setState(1416);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 159, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Relational_expressionContext relational_expression() throws RecognitionException {
    Relational_expressionContext _localctx = new Relational_expressionContext(_ctx, getState());
    enterRule(_localctx, 274, RULE_relational_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1419);
            shift_expression();
            setState(1425);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 160, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1420);
                            relational_op();
                            setState(1421);
                            shift_expression();
                        }
                    }
                }
                setState(1427);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 160, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Shift_expressionContext shift_expression() throws RecognitionException {
    Shift_expressionContext _localctx = new Shift_expressionContext(_ctx, getState());
    enterRule(_localctx, 278, RULE_shift_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1430);
            additive_expression();
            setState(1436);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 161, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1431);
                            shift_op();
                            setState(1432);
                            additive_expression();
                        }
                    }
                }
                setState(1438);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 161, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Additive_expressionContext additive_expression() throws RecognitionException {
    Additive_expressionContext _localctx = new Additive_expressionContext(_ctx, getState());
    enterRule(_localctx, 282, RULE_additive_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1441);
            multiplicative_expression();
            setState(1447);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 162, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1442);
                            add_op();
                            setState(1443);
                            multiplicative_expression();
                        }
                    }
                }
                setState(1449);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 162, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Multiplicative_expressionContext multiplicative_expression() throws RecognitionException {
    Multiplicative_expressionContext _localctx = new Multiplicative_expressionContext(_ctx, getState());
    enterRule(_localctx, 286, RULE_multiplicative_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1452);
            cast_expression();
            setState(1458);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 163, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1453);
                            multiply_op();
                            setState(1454);
                            cast_expression();
                        }
                    }
                }
                setState(1460);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 163, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:Objc2Lua    文件:ObjCParser.java   
public final Postfix_expressionContext postfix_expression() throws RecognitionException {
    Postfix_expressionContext _localctx = new Postfix_expressionContext(_ctx, getState());
    enterRule(_localctx, 296, RULE_postfix_expression);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(1491);
            primary_expression();
            setState(1495);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 167, _ctx);
            while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {
                if (_alt == 1) {
                    {
                        {
                            setState(1492);
                            postfix_expression_complete();
                        }
                    }
                }
                setState(1497);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 167, _ctx);
            }
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}
项目:groovy    文件:AtnManager.java   
public ATN checkAndClear() {
    if (0 != counter.incrementAndGet() % DFA_CACHE_THRESHOLD) {
        return atn;
    }

    RRWL.writeLock().lock();
    try {
        atn.clearDFA();
    } finally {
        RRWL.writeLock().unlock();
    }

    return atn;
}