protected int matchATN(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; }
/** When we hit an accept state in either the DFA or the ATN, we * have to notify the character stream to start buffering characters * via {@link IntStream#mark} and record the current state. The current sim state * includes the current index into the input, the current line, * and current character position in that line. Note that the Lexer is * tracking the starting line and characterization of the token. These * variables track the "state" of the simulator when it hits an accept state. * * <p>We track these variables separately for the DFA and ATN simulation * because the DFA simulation often has to fail over to the ATN * simulation. If the ATN simulation fails, we need the DFA to fall * back to its previously accepted state, if any. If the ATN succeeds, * then the ATN does the accept and the DFA simulator that invoked it * can simply return the predicted token type.</p> */ protected static class SimState { protected int index = -1; protected int line = 0; protected int charPos = -1; protected DFAState dfaState; protected void reset() { index = -1; line = 0; charPos = -1; dfaState = null; } }
protected int matchATN(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; }
protected int matchATN(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; }
protected int matchATN(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; }
/** When we hit an accept state in either the DFA or the ATN, we * have to notify the character stream to start buffering characters * via {@link IntStream#mark} and record the current state. The current sim state * includes the current index into the input, the current line, * and current character position in that line. Note that the Lexer is * tracking the starting line and characterization of the token. These * variables track the "state" of the simulator when it hits an accept state. * * <p>We track these variables separately for the DFA and ATN simulation * because the DFA simulation often has to fail over to the ATN * simulation. If the ATN simulation fails, we need the DFA to fall * back to its previously accepted state, if any. If the ATN succeeds, * then the ATN does the accept and the DFA simulator that invoked it * can simply return the predicted token type.</p> */ protected static class SimState { protected int index = -1; protected int line = 0; protected int charPos = -1; protected DFAState dfaState; protected void reset() { index = -1; line = 0; charPos = -1; dfaState = null; } }
/** When we hit an accept state in either the DFA or the ATN, we * have to notify the character stream to start buffering characters * via {@link IntStream#mark} and record the current state. The current sim state * includes the current index into the input, the current line, * and current character position in that line. Note that the Lexer is * tracking the starting line and characterization of the token. These * variables track the "state" of the simulator when it hits an accept state. * * <p>We track these variables separately for the DFA and ATN simulation * because the DFA simulation often has to fail over to the ATN * simulation. If the ATN simulation fails, we need the DFA to fall * back to its previously accepted state, if any. If the ATN succeeds, * then the ATN does the accept and the DFA simulator that invoked it * can simply return the predicted token type.</p> */ protected static class SimState { protected int index = -1; protected int line = 0; protected int charPos = -1; protected DFAState dfaState; protected void reset() { index = -1; line = 0; charPos = -1; dfaState = null; } }
/** When we hit an accept state in either the DFA or the ATN, we * have to notify the character stream to start buffering characters * via {@link IntStream#mark} and record the current state. The current sim state * includes the current index into the input, the current line, * and current character position in that line. Note that the Lexer is * tracking the starting line and characterization of the token. These * variables track the "state" of the simulator when it hits an accept state. * * <p>We track these variables separately for the DFA and ATN simulation * because the DFA simulation often has to fail over to the ATN * simulation. If the ATN simulation fails, we need the DFA to fall * back to its previously accepted state, if any. If the ATN succeeds, * then the ATN does the accept and the DFA simulator that invoked it * can simply return the predicted token type.</p> */ protected static class SimState { protected int index = -1; protected int line = 0; protected int charPos = -1; protected DFAState dfaState; protected void reset() { index = -1; line = 0; charPos = -1; dfaState = null; } }
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(); if (suppressEdge) { s0_closure.clearExplicitSemanticContext(); } DFAState next = addDFAState(s0_closure); if (!suppressEdge) { if (!atn.modeToDFA[mode].s0.compareAndSet(null, next)) { next = atn.modeToDFA[mode].s0.get(); } } int predict = execATN(input, next); if ( debug ) { System.out.format(Locale.getDefault(), "DFA after matchATN: %s\n", atn.modeToDFA[old_mode].toLexerString()); } return predict; }
/** When we hit an accept state in either the DFA or the ATN, we * have to notify the character stream to start buffering characters * via {@link IntStream#mark} and record the current state. The current sim state * includes the current index into the input, the current line, * and current character position in that line. Note that the Lexer is * tracking the starting line and characterization of the token. These * variables track the "state" of the simulator when it hits an accept state. * * <p>We track these variables separately for the DFA and ATN simulation * because the DFA simulation often has to fail over to the ATN * simulation. If the ATN simulation fails, we need the DFA to fall * back to its previously accepted state, if any. If the ATN succeeds, * then the ATN does the accept and the DFA simulator that invoked it * can simply return the predicted token type.</p> */ protected static class SimState { protected int index = -1; protected int line = 0; protected int charPos = -1; protected DFAState dfaState; protected void reset() { index = -1; line = 0; charPos = -1; dfaState = null; } }