(mut self, expr: &Hir)
| 133 | } |
| 134 | |
| 135 | fn compile_one(mut self, expr: &Hir) -> result::Result<Program, Error> { |
| 136 | // If we're compiling a forward DFA and we aren't anchored, then |
| 137 | // add a `.*?` before the first capture group. |
| 138 | // Other matching engines handle this by baking the logic into the |
| 139 | // matching engine itself. |
| 140 | let mut dotstar_patch = Patch { hole: Hole::None, entry: 0 }; |
| 141 | self.compiled.is_anchored_start = expr.is_anchored_start(); |
| 142 | self.compiled.is_anchored_end = expr.is_anchored_end(); |
| 143 | if self.compiled.needs_dotstar() { |
| 144 | dotstar_patch = self.c_dotstar()?; |
| 145 | self.compiled.start = dotstar_patch.entry; |
| 146 | } |
| 147 | self.compiled.captures = vec![None]; |
| 148 | let patch = self.c_capture(0, expr)?; |
| 149 | if self.compiled.needs_dotstar() { |
| 150 | self.fill(dotstar_patch.hole, patch.entry); |
| 151 | } else { |
| 152 | self.compiled.start = patch.entry; |
| 153 | } |
| 154 | self.fill_to_next(patch.hole); |
| 155 | self.compiled.matches = vec![self.insts.len()]; |
| 156 | self.push_compiled(Inst::Match(0)); |
| 157 | self.compile_finish() |
| 158 | } |
| 159 | |
| 160 | fn compile_many( |
| 161 | mut self, |
no test coverage detected