Anchored match at position zero, optionally requiring full consumption. */
(&self, root: &Node, ngroups: usize, full: bool)
| 55 | |
| 56 | /* Anchored match at position zero, optionally requiring full consumption. */ |
| 57 | pub fn match_at(&self, root: &Node, ngroups: usize, full: bool) -> Option<Caps> { |
| 58 | self.steps.set(0); |
| 59 | let mut caps = empty_caps(ngroups); |
| 60 | let mut found: Option<usize> = None; |
| 61 | let len = self.input.len(); |
| 62 | self.m(root, 0, &mut caps, &mut |end, _| { |
| 63 | if full && end != len { return false; } |
| 64 | found = Some(end); |
| 65 | true |
| 66 | }); |
| 67 | found.map(|end| { caps[0] = Some((0, end)); caps }) |
| 68 | } |
| 69 | |
| 70 | /* Core dispatch, k is the continuation called with the position after node. */ |
| 71 | fn m(&self, node: &Node, pos: usize, caps: &mut Caps, k: &mut dyn FnMut(usize, &mut Caps) -> bool) -> bool { |
no test coverage detected