MCPcopy Create free account
hub / github.com/davidblewett/rure-python / find_dfa_reverse_suffix

Method find_dfa_reverse_suffix

regex/src/exec.rs:823–853  ·  view source on GitHub ↗

reduces constant overhead

(
        &self,
        text: &[u8],
        start: usize,
    )

Source from the content-addressed store, hash-verified

821 /// matching engine should be used.
822 #[inline(always)] // reduces constant overhead
823 fn find_dfa_reverse_suffix(
824 &self,
825 text: &[u8],
826 start: usize,
827 ) -> dfa::Result<(usize, usize)> {
828 use dfa::Result::*;
829
830 let match_start = match self.exec_dfa_reverse_suffix(text, start) {
831 None => return self.find_dfa_forward(text, start),
832 Some(Match((start, _))) => start,
833 Some(r) => return r,
834 };
835 // At this point, we've found a match. The only way to quit now
836 // without a match is if the DFA gives up (seems unlikely).
837 //
838 // Now run the DFA forwards to find the proper end of the match.
839 // (The suffix literal match can only indicate the earliest
840 // possible end location, which may appear before the end of the
841 // leftmost-first match.)
842 match dfa::Fsm::forward(
843 &self.ro.dfa,
844 self.cache,
845 false,
846 text,
847 match_start,
848 ) {
849 NoMatch(_) => panic!("BUG: reverse match implies forward match"),
850 Quit => Quit,
851 Match(e) => Match((match_start, e)),
852 }
853 }
854
855 /// Executes the NFA engine to return whether there is a match or not.
856 ///

Callers 2

find_atMethod · 0.80
captures_read_atMethod · 0.80

Calls 3

find_dfa_forwardMethod · 0.80
MatchClass · 0.70

Tested by

no test coverage detected