addDFAEdgeByConfig method

DFAState addDFAEdgeByConfig(
  1. DFAState from,
  2. int t,
  3. ATNConfigSet q
)

Implementation

DFAState addDFAEdgeByConfig(DFAState from, int t, ATNConfigSet q) {
  /* leading to this call, ATNConfigSet.hasSemanticContext is used as a
		 * marker indicating dynamic predicate evaluation makes this edge
		 * dependent on the specific input sequence, so the static edge in the
		 * DFA should be omitted. The target DFAState is still created since
		 * execATN has the ability to resynchronize with the DFA state cache
		 * following the predicate evaluation step.
		 *
		 * TJP notes: next time through the DFA, we see a pred again and eval.
		 * If that gets us to a previously created (but dangling) DFA
		 * state, we can continue in pure DFA mode from there.
		 */
  final suppressEdge = q.hasSemanticContext;
  q.hasSemanticContext = false;

  final to = addDFAState(q);

  if (suppressEdge) {
    return to;
  }

  addDFAEdge(from, t, to);
  return to;
}