matchATN method

int matchATN(
  1. CharStream input
)

Implementation

int matchATN(CharStream input) {
  ATNState startState = atn.modeToStartState[mode];

  if (debug) {
    log('matchATN mode $mode start: $startState\n', level: Level.FINE.value);
  }

  final old_mode = mode;

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

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

  final predict = execATN(input, next);

  if (debug) {
    log('DFA after matchATN: ${decisionToDFA[old_mode].toLexerString()}\n',
        level: Level.FINE.value);
  }

  return predict;
}