Start backtracking at the given position in the input, but also look for literal prefixes.
(&mut self, mut at: InputAt, end: usize)
| 149 | /// Start backtracking at the given position in the input, but also look |
| 150 | /// for literal prefixes. |
| 151 | fn exec_(&mut self, mut at: InputAt, end: usize) -> bool { |
| 152 | self.clear(); |
| 153 | // If this is an anchored regex at the beginning of the input, then |
| 154 | // we're either already done or we only need to try backtracking once. |
| 155 | if self.prog.is_anchored_start { |
| 156 | return if !at.is_start() { |
| 157 | false |
| 158 | } else { |
| 159 | self.backtrack(at) |
| 160 | }; |
| 161 | } |
| 162 | let mut matched = false; |
| 163 | loop { |
| 164 | if !self.prog.prefixes.is_empty() { |
| 165 | at = match self.input.prefix_at(&self.prog.prefixes, at) { |
| 166 | None => break, |
| 167 | Some(at) => at, |
| 168 | }; |
| 169 | } |
| 170 | matched = self.backtrack(at) || matched; |
| 171 | if matched && self.prog.matches.len() == 1 { |
| 172 | return true; |
| 173 | } |
| 174 | if at.pos() == end { |
| 175 | break; |
| 176 | } |
| 177 | at = self.input.at(at.next_pos()); |
| 178 | } |
| 179 | matched |
| 180 | } |
| 181 | |
| 182 | /// The main backtracking loop starting at the given input position. |
| 183 | fn backtrack(&mut self, start: InputAt) -> bool { |