reduces constant overhead
(
prog: &'a Program,
cache: &ProgramCache,
quit_after_match: bool,
text: &[u8],
at: usize,
)
| 491 | |
| 492 | #[inline(always)] // reduces constant overhead |
| 493 | pub fn reverse( |
| 494 | prog: &'a Program, |
| 495 | cache: &ProgramCache, |
| 496 | quit_after_match: bool, |
| 497 | text: &[u8], |
| 498 | at: usize, |
| 499 | ) -> Result<usize> { |
| 500 | let mut cache = cache.borrow_mut(); |
| 501 | let cache = &mut cache.dfa_reverse; |
| 502 | let mut dfa = Fsm { |
| 503 | prog: prog, |
| 504 | start: 0, // filled in below |
| 505 | at: at, |
| 506 | quit_after_match: quit_after_match, |
| 507 | last_match_si: STATE_UNKNOWN, |
| 508 | last_cache_flush: at, |
| 509 | cache: &mut cache.inner, |
| 510 | }; |
| 511 | let (empty_flags, state_flags) = dfa.start_flags_reverse(text, at); |
| 512 | dfa.start = match dfa.start_state( |
| 513 | &mut cache.qcur, |
| 514 | empty_flags, |
| 515 | state_flags, |
| 516 | ) { |
| 517 | None => return Result::Quit, |
| 518 | Some(STATE_DEAD) => return Result::NoMatch(at), |
| 519 | Some(si) => si, |
| 520 | }; |
| 521 | debug_assert!(dfa.start != STATE_UNKNOWN); |
| 522 | dfa.exec_at_reverse(&mut cache.qcur, &mut cache.qnext, text) |
| 523 | } |
| 524 | |
| 525 | #[inline(always)] // reduces constant overhead |
| 526 | pub fn forward_many( |
no test coverage detected