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

Method backref

std/re/src/main/matcher.rs:175–187  ·  view source on GitHub ↗
(&self, n: usize, pos: usize, caps: &mut Caps, k: &mut dyn FnMut(usize, &mut Caps) -> bool)

Source from the content-addressed store, hash-verified

173 }
174
175 fn backref(&self, n: usize, pos: usize, caps: &mut Caps, k: &mut dyn FnMut(usize, &mut Caps) -> bool) -> bool {
176 match caps.get(n).copied().flatten() {
177 None => k(pos, caps), // unmatched group behaves like empty
178 Some((s, e)) => {
179 let len = e - s;
180 if pos + len > self.input.len() { return false; }
181 for i in 0..len {
182 if !self.ci_eq(self.input[pos + i], self.input[s + i]) { return false; }
183 }
184 k(pos + len, caps)
185 }
186 }
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 {

Callers 1

mMethod · 0.80

Calls 3

ci_eqMethod · 0.80
getMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected