fn cached_state_key(
        &mut self,
        q: &SparseSet,
        state_flags: &mut StateFlags,
    ) -> Option<StateKey> {
        use prog::Inst::*;
        use prog::EmptyLook::*;

        // We need to build up enough information to recognize pre-built states
        // in the DFA. Generally speaking, this includes every instruction
        // except for those which are purely epsilon transitions, e.g., the
        // Save and Split instructions.
        //
        // Empty width assertions are also epsilon transitions, but since they
        // are conditional, we need to make them part of a state's key in the
        // cache.
        let mut insts = vec![];
        for &ip in q {
            let ip = usize_to_u32(ip);
            match self.prog[ip as usize] {
                Char(_) | Ranges(_) => unreachable!(),
                Save(_) => {}
                Split(_) => {}
                Bytes(_) => insts.push(ip),
                EmptyLook(ref inst) => {
                    match inst.look {
                        StartLine => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        EndLine => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        StartText => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        EndText => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        WordBoundaryAscii => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        NotWordBoundaryAscii => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        WordBoundary | NotWordBoundary => unreachable!(),
                    }
                }
                Match(_) => {
                    insts.push(ip);
                    if !self.continue_past_first_match() {
                        break;
                    }
                }
            }
        }
        // If we couldn't transition to any other instructions and we didn't
        // see a match when expanding NFA states previously, then this is a
        // dead state and no amount of additional input can transition out
        // of this state.
        if insts.len() == 0 && !state_flags.is_match() {
            None
        } else {
            Some(StateKey {
                insts: insts.into_boxed_slice(),
                flags: *state_flags,
            })
        }
    }
/// Produces a key suitable for describing a state in the DFA cache.
///
/// The key invariant here is that equivalent keys are produced for any two
/// sets of ordered NFA states (and toggling of whether the previous NFA
/// states contain a match state) that do not discriminate a match for any
/// input.
///
/// Specifically, q should be an ordered set of NFA states and is_match
/// should be true if and only if the previous NFA states contained a match
/// state.
Produces a key suitable for describing a state in the DFA cache.
The key invariant here is that equivalent keys are produced for any two
sets of ordered NFA states (and toggling of whether the previous NFA
states contain a match state) that do not discriminate a match for any
input.

Specifically, q should be an ordered set of NFA states and is_match
should be true if and only if the previous NFA states contained a match
state.
Produces a key suitable for describing a state in the DFA cache . The key invariant here is that equivalent keys are produced for any two sets of ordered NFA states ( and toggling of whether the previous NFA states contain a match state ) that do not discriminate a match for any input . Specifically q should be an ordered set of NFA states and is_match should be true if and only if the previous NFA states contained a match state .
fn cached_state_key(
        &mut self,
        q: &SparseSet,
        state_flags: &mut StateFlags,
    ) -> Option<StateKey> {
        use prog::Inst::*;
        use prog::EmptyLook::*;
        // We need to build up enough information to recognize pre-built states
        // in the DFA. Generally speaking, this includes every instruction
        // except for those which are purely epsilon transitions, e.g., the
        // Save and Split instructions.
        //
        // Empty width assertions are also epsilon transitions, but since they
        // are conditional, we need to make them part of a state's key in the
        // cache.
        let mut insts = vec![];
        for &ip in q {
            let ip = usize_to_u32(ip);
            match self.prog[ip as usize] {
                Char(_) | Ranges(_) => unreachable!(),
                Save(_) => {}
                Split(_) => {}
                Bytes(_) => insts.push(ip),
                EmptyLook(ref inst) => {
                    match inst.look {
                        StartLine => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        EndLine => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        StartText => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        EndText => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        WordBoundaryAscii => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        NotWordBoundaryAscii => {
                            state_flags.set_empty();
                            insts.push(ip);
                        }
                        WordBoundary | NotWordBoundary => unreachable!(),
                    }
                }
                Match(_) => {
                    insts.push(ip);
                    if !self.continue_past_first_match() {
                        break;
                    }
                }
            }
        }
        // If we couldn't transition to any other instructions and we didn't
        // see a match when expanding NFA states previously, then this is a
        // dead state and no amount of additional input can transition out
        // of this state.
        if insts.len() == 0 && !state_flags.is_match() {
            None
        } else {
            Some(StateKey {
                insts: insts.into_boxed_slice(),
                flags: *state_flags,
            })
        }
    }
fn cached_state_key ( & mut self , q : & SparseSet , state_flags : & mut StateFlags , ) -> Option < StateKey > { use prog :: Inst :: * ; use prog :: EmptyLook :: * ; // We need to build up enough information to recognize pre-built states // in the DFA. Generally speaking, this includes every instruction // except for those which are purely epsilon transitions, e.g., the // Save and Split instructions. // // Empty width assertions are also epsilon transitions, but since they // are conditional, we need to make them part of a state's key in the // cache. let mut insts = vec ! [ ] ; for & ip in q { let ip = usize_to_u32 ( ip ) ; match self . prog [ ip as usize ] { Char ( _ ) | Ranges ( _ ) => unreachable ! ( ) , Save ( _ ) => { } Split ( _ ) => { } Bytes ( _ ) => insts . push ( ip ) , EmptyLook ( ref inst ) => { match inst . look { StartLine => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } EndLine => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } StartText => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } EndText => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } WordBoundaryAscii => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } NotWordBoundaryAscii => { state_flags . set_empty ( ) ; insts . push ( ip ) ; } WordBoundary | NotWordBoundary => unreachable ! ( ) , } } Match ( _ ) => { insts . push ( ip ) ; if ! self . continue_past_first_match ( ) { break ; } } } } // If we couldn't transition to any other instructions and we didn't // see a match when expanding NFA states previously, then this is a // dead state and no amount of additional input can transition out // of this state. if insts . len ( ) == 0 && ! state_flags . is_match ( ) { None } else { Some ( StateKey { insts : insts . into_boxed_slice ( ) , flags : * state_flags , } ) } }
Produces a key suitable for describing a state in the DFA cache.
Produces a key suitable for describing a state in the DFA cache .
&mut self
q
&SparseSet
state_flags
&mut StateFlags
&mut self
q
&SparseSet
state_flags
&mut StateFlags