MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / match_at

Method match_at

std/re/src/main/matcher.rs:57–68  ·  view source on GitHub ↗

Anchored match at position zero, optionally requiring full consumption. */

(&self, root: &Node, ngroups: usize, full: bool)

Source from the content-addressed store, hash-verified

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 {

Callers 1

findFunction · 0.80

Calls 4

empty_capsFunction · 0.85
setMethod · 0.80
mMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected