reduces constant overhead
(
&self,
text: &[u8],
start: usize,
)
| 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 |
no test coverage detected