reduces constant overhead
(
prog: &'a Program,
cache: &ProgramCache,
quit_after_match: bool,
text: &[u8],
at: usize,
)
| 458 | impl<'a> Fsm<'a> { |
| 459 | #[inline(always)] // reduces constant overhead |
| 460 | pub fn forward( |
| 461 | prog: &'a Program, |
| 462 | cache: &ProgramCache, |
| 463 | quit_after_match: bool, |
| 464 | text: &[u8], |
| 465 | at: usize, |
| 466 | ) -> Result<usize> { |
| 467 | let mut cache = cache.borrow_mut(); |
| 468 | let cache = &mut cache.dfa; |
| 469 | let mut dfa = Fsm { |
| 470 | prog: prog, |
| 471 | start: 0, // filled in below |
| 472 | at: at, |
| 473 | quit_after_match: quit_after_match, |
| 474 | last_match_si: STATE_UNKNOWN, |
| 475 | last_cache_flush: at, |
| 476 | cache: &mut cache.inner, |
| 477 | }; |
| 478 | let (empty_flags, state_flags) = dfa.start_flags(text, at); |
| 479 | dfa.start = match dfa.start_state( |
| 480 | &mut cache.qcur, |
| 481 | empty_flags, |
| 482 | state_flags, |
| 483 | ) { |
| 484 | None => return Result::Quit, |
| 485 | Some(STATE_DEAD) => return Result::NoMatch(at), |
| 486 | Some(si) => si, |
| 487 | }; |
| 488 | debug_assert!(dfa.start != STATE_UNKNOWN); |
| 489 | dfa.exec_at(&mut cache.qcur, &mut cache.qnext, text) |
| 490 | } |
| 491 | |
| 492 | #[inline(always)] // reduces constant overhead |
| 493 | pub fn reverse( |
nothing calls this directly
no test coverage detected