Function regex_automata::util::determinize::epsilon_closure
source ยท pub(crate) fn epsilon_closure(
nfa: &NFA,
start_nfa_id: StateID,
look_have: LookSet,
stack: &mut Vec<StateID>,
set: &mut SparseSet,
)
Expand description
Compute the epsilon closure for the given NFA state. The epsilon closure
consists of all NFA state IDs, including start_nfa_id
, that can be
reached from start_nfa_id
without consuming any input. These state IDs
are written to set
in the order they are visited, but only if they are
not already in set
. start_nfa_id
must be a valid state ID for the NFA
given.
look_have
consists of the satisfied assertions at the current
position. For conditional look-around epsilon transitions, these are
only followed if they are satisfied by look_have
.
stack
must have length 0. It is used as scratch space for depth first
traversal. After returning, it is guaranteed that stack
will have length
0.