Lines Matching refs:at

4 A DFA provides faster matching because the engine is in exactly one state at
104 /// and the set of empty-width flags set at the byte in the input when the
116 /// given state `s` and byte `b`, the next state can be found at index
180 at: usize,
239 fn set_non_match(self, at: usize) -> Result<T> {
241 Result::NoMatch(_) => Result::NoMatch(at),
257 /// at data[1], and each following pointer is stored as an offset
452 at: usize,
459 at,
462 last_cache_flush: at,
465 let (empty_flags, state_flags) = dfa.start_flags(text, at);
469 Some(STATE_DEAD) => return Result::NoMatch(at),
482 at: usize,
489 at,
492 last_cache_flush: at,
495 let (empty_flags, state_flags) = dfa.start_flags_reverse(text, at);
499 Some(STATE_DEAD) => return Result::NoMatch(at),
512 at: usize,
520 at,
523 last_cache_flush: at,
526 let (empty_flags, state_flags) = dfa.start_flags(text, at);
530 Some(STATE_DEAD) => return Result::NoMatch(at),
599 let mut result = Result::NoMatch(self.at);
601 let mut at = self.at;
602 while at < text.len() {
615 while next_si <= STATE_MAX && at < text.len() {
617 prev_si = unsafe { self.next_si(next_si, text, at) };
618 at += 1;
619 if prev_si > STATE_MAX || at + 2 >= text.len() {
623 next_si = unsafe { self.next_si(prev_si, text, at) };
624 at += 1;
628 prev_si = unsafe { self.next_si(next_si, text, at) };
629 at += 1;
634 next_si = unsafe { self.next_si(prev_si, text, at) };
635 at += 1;
643 result = Result::Match(at - 1);
667 let cur = at;
669 && at + 2 < text.len()
673 self.next_si(next_si & !STATE_MATCH, text, at)
675 at += 1;
677 if at > cur {
678 result = Result::Match(at - 2);
688 at = match self.prefix_at(text, at) {
700 let byte = Byte::byte(text[at - 1]);
707 self.at = at;
710 Some(STATE_DEAD) => return result.set_non_match(at),
716 result = Result::Match(at - 1);
761 let mut result = Result::NoMatch(self.at);
763 let mut at = self.at;
764 while at > 0 {
765 while next_si <= STATE_MAX && at > 0 {
767 at -= 1;
768 prev_si = unsafe { self.next_si(next_si, text, at) };
769 if prev_si > STATE_MAX || at <= 4 {
773 at -= 1;
774 next_si = unsafe { self.next_si(prev_si, text, at) };
778 at -= 1;
779 prev_si = unsafe { self.next_si(next_si, text, at) };
784 at -= 1;
785 next_si = unsafe { self.next_si(prev_si, text, at) };
789 result = Result::Match(at + 1);
795 let cur = at;
796 while (next_si & !STATE_MATCH) == prev_si && at >= 2 {
798 at -= 1;
800 self.next_si(next_si & !STATE_MATCH, text, at)
803 if at < cur {
804 result = Result::Match(at + 2);
810 let byte = Byte::byte(text[at]);
812 self.at = at;
815 Some(STATE_DEAD) => return result.set_non_match(at),
821 result = Result::Match(at + 1);
1030 /// Follows the epsilon transitions starting at (and including) `ip`. The
1035 /// represent the flags set at the current location in the input.
1045 /// If matching starts at the beginning of the input, then start text and
1157 // we should follow epsilon transitions at the empty string preceding
1288 && self.at >= self.last_cache_flush
1289 && (self.at - self.last_cache_flush) <= 10 * nstates
1294 self.last_cache_flush = self.at;
1360 /// Computes and returns the start state, where searching begins at
1361 /// position `at` in `text`. If the state has already been computed,
1374 // of empty/state flags set at the current position in the input. We
1410 fn start_flags(&self, text: &[u8], at: usize) -> (EmptyFlags, StateFlags) {
1413 empty_flags.start = at == 0;
1415 empty_flags.start_line = at == 0 || text[at - 1] == b'\n';
1418 let is_word_last = at > 0 && Byte::byte(text[at - 1]).is_ascii_word();
1419 let is_word = at < text.len() && Byte::byte(text[at]).is_ascii_word();
1438 at: usize,
1442 empty_flags.start = at == text.len();
1444 empty_flags.start_line = at == text.len() || text[at] == b'\n';
1448 at < text.len() && Byte::byte(text[at]).is_ascii_word();
1449 let is_word = at > 0 && Byte::byte(text[at - 1]).is_ascii_word();
1512 fn prefix_at(&self, text: &[u8], at: usize) -> Option<usize> {
1513 self.prog.prefixes.find(&text[at..]).map(|(s, _)| at + s)
1898 // pointers at or above 2**31. We should fix that, but it seems