getExistingTargetState method

DFAState? getExistingTargetState(
  1. DFAState s,
  2. int t
)

Get an existing target state for an edge in the DFA. If the target state for the edge has not yet been computed or is otherwise not available, this method returns null.

@param s The current DFA state @param t The next input symbol @return The existing target DFA state for the given input symbol t, or null if the target state for this edge is not already cached

Implementation

DFAState? getExistingTargetState(DFAState s, int t) {
  if (s.edges == null || t < MIN_DFA_EDGE || t > MAX_DFA_EDGE) {
    return null;
  }

  final target = s.edges![t - MIN_DFA_EDGE];
  if (debug && target != null) {
    log('reuse state ${s.stateNumber} edge to ${target.stateNumber}',
        level: Level.FINE.value);
  }

  return target;
}