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

Method find_dfa_forward

regex/src/exec.rs:686–716  ·  view source on GitHub ↗

reduces constant overhead

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

Source from the content-addressed store, hash-verified

684 /// matching engine should be used.
685 #[inline(always)] // reduces constant overhead
686 fn find_dfa_forward(
687 &self,
688 text: &[u8],
689 start: usize,
690 ) -> dfa::Result<(usize, usize)> {
691 use dfa::Result::*;
692 let end = match dfa::Fsm::forward(
693 &self.ro.dfa,
694 self.cache,
695 false,
696 text,
697 start,
698 ) {
699 NoMatch(i) => return NoMatch(i),
700 Quit => return Quit,
701 Match(end) if start == end => return Match((start, start)),
702 Match(end) => end,
703 };
704 // Now run the DFA in reverse to find the start of the match.
705 match dfa::Fsm::reverse(
706 &self.ro.dfa_reverse,
707 self.cache,
708 false,
709 &text[start..],
710 end - start,
711 ) {
712 Match(s) => Match((start + s, end)),
713 NoMatch(i) => NoMatch(i),
714 Quit => Quit,
715 }
716 }
717
718 /// Finds the leftmost-first match (start and end) using only the DFA,
719 /// but assumes the regex is anchored at the end and therefore starts at

Callers 3

find_atMethod · 0.80
captures_read_atMethod · 0.80

Calls 1

MatchClass · 0.70

Tested by

no test coverage detected