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

Method look

std/re/src/main/matcher.rs:189–207  ·  view source on GitHub ↗
(&self, inner: &Node, behind: bool, negative: bool, pos: usize, caps: &mut Caps, k: &mut dyn FnMut(usize, &mut Caps) -> bool)

Source from the content-addressed store, hash-verified

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 {

Callers 1

mMethod · 0.45

Calls 2

fixed_lenFunction · 0.85
mMethod · 0.80

Tested by

no test coverage detected