Finds which regular expressions match the given text. `matches` should have length equal to the number of regexes being searched. This is only useful when one wants to know which regexes in a set match some text.
(
&self,
matches: &mut [bool],
text: &[u8],
start: usize,
)
| 1060 | /// This is only useful when one wants to know which regexes in a set |
| 1061 | /// match some text. |
| 1062 | pub fn many_matches_at( |
| 1063 | &self, |
| 1064 | matches: &mut [bool], |
| 1065 | text: &[u8], |
| 1066 | start: usize, |
| 1067 | ) -> bool { |
| 1068 | use self::MatchType::*; |
| 1069 | if !self.is_anchor_end_match(text) { |
| 1070 | return false; |
| 1071 | } |
| 1072 | match self.ro.match_type { |
| 1073 | Literal(ty) => { |
| 1074 | debug_assert_eq!(matches.len(), 1); |
| 1075 | matches[0] = self.find_literals(ty, text, start).is_some(); |
| 1076 | matches[0] |
| 1077 | } |
| 1078 | Dfa | DfaAnchoredReverse | DfaSuffix | DfaMany => { |
| 1079 | match dfa::Fsm::forward_many( |
| 1080 | &self.ro.dfa, |
| 1081 | self.cache, |
| 1082 | matches, |
| 1083 | text, |
| 1084 | start, |
| 1085 | ) { |
| 1086 | dfa::Result::Match(_) => true, |
| 1087 | dfa::Result::NoMatch(_) => false, |
| 1088 | dfa::Result::Quit => { |
| 1089 | self.exec_nfa( |
| 1090 | MatchNfaType::Auto, |
| 1091 | matches, |
| 1092 | &mut [], |
| 1093 | false, |
| 1094 | text, |
| 1095 | start, |
| 1096 | text.len()) |
| 1097 | } |
| 1098 | } |
| 1099 | } |
| 1100 | Nfa(ty) => { |
| 1101 | self.exec_nfa( |
| 1102 | ty, matches, &mut [], false, text, start, text.len()) |
| 1103 | } |
| 1104 | Nothing => false, |
| 1105 | } |
| 1106 | } |
| 1107 | |
| 1108 | #[inline(always)] // reduces constant overhead |
| 1109 | fn is_anchor_end_match(&self, text: &[u8]) -> bool { |
nothing calls this directly
no test coverage detected