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

Method search_from

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

Leftmost search starting no earlier than `from`. */

(&self, root: &Node, ngroups: usize, from: usize)

Source from the content-addressed store, hash-verified

39
40 /* Leftmost search starting no earlier than `from`. */
41 pub fn search_from(&self, root: &Node, ngroups: usize, from: usize) -> Option<Caps> {
42 self.steps.set(0);
43 for start in from..=self.input.len() {
44 if self.exceeded() { break; } // stop scanning once the budget is gone
45 let mut caps: Caps = empty_caps(ngroups);
46 let mut found: Option<usize> = None;
47 self.m(root, start, &mut caps, &mut |end, _| { found = Some(end); true });
48 if let Some(end) = found {
49 caps[0] = Some((start, end));
50 return Some(caps);
51 }
52 }
53 None
54 }
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> {

Callers 3

find_allFunction · 0.80
subFunction · 0.80
searchMethod · 0.80

Calls 5

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

Tested by

no test coverage detected