| 187 | } |
| 188 | |
| 189 | fn look(&self, inner: &Node, behind: bool, negative: bool, pos: usize, caps: &mut Caps, k: &mut dyn FnMut(usize, &mut Caps) -> bool) -> bool { |
| 190 | let matched = if behind { |
| 191 | match fixed_len(inner) { |
| 192 | Some(w) if pos >= w => { |
| 193 | let mut hit = false; |
| 194 | self.m(inner, pos - w, caps, &mut |end, _| { |
| 195 | if end == pos { hit = true; true } else { false } |
| 196 | }); |
| 197 | hit |
| 198 | } |
| 199 | _ => false, |
| 200 | } |
| 201 | } else { |
| 202 | let mut hit = false; |
| 203 | self.m(inner, pos, caps, &mut |_, _| { hit = true; true }); |
| 204 | hit |
| 205 | }; |
| 206 | if matched != negative { k(pos, caps) } else { false } |
| 207 | } |
| 208 | |
| 209 | /* True when node consumes input[pos] as a single codepoint. */ |
| 210 | fn single_match(&self, node: &Node, pos: usize) -> bool { |