MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fnptr_paren_tail

Function fnptr_paren_tail

codegraph-kernel/src/cfnptr.rs:305–335  ·  view source on GitHub ↗

`\(\s*(?:\w+\s+)*\*\s*(\w+)\s*\)\s*\(` matched at `open` (which must hold `(`). Returns (name_range, end_after_second_paren). The `(?:\w+\s+)*` group is greedy without backtracking: giving back an iteration repositions `\*` onto a word char, which can never match, so greedy ≡ backtracked.

(s: &[u8], open: usize)

Source from the content-addressed store, hash-verified

303/// `(`). Returns (name_range, end_after_second_paren). The `(?:\w+\s+)*`
304/// group is greedy without backtracking: giving back an iteration repositions
305/// `\*` onto a word char, which can never match, so greedy ≡ backtracked.
306fn fnptr_paren_tail(s: &[u8], open: usize) -> Option<((usize, usize), usize)> {
307 let mut i = skip_jsws(s, open + 1);
308 loop {
309 if !is_word_at(s, i) {
310 break;
311 }
312 let we = word_end(s, i);
313 let wse = skip_jsws(s, we);
314 if wse == we {
315 break; // \w+ not followed by \s+ — the iteration fails, word not consumed
316 }
317 i = wse;
318 }
319 if s.get(i) != Some(&b'*') {
320 return None;
321 }
322 i = skip_jsws(s, i + 1);
323 if !is_word_at(s, i) {
324 return None;
325 }
326 let name = (i, word_end(s, i));
327 i = skip_jsws(s, name.1);
328 if s.get(i) != Some(&b')') {
329 return None;
330 }
331 i = skip_jsws(s, i + 1);
332 if s.get(i) != Some(&b'(') {
333 return None;
334 }
335 Some((name, i + 1))
336}
337
338/// `\s*\)?\s*\(` at `i` → position after the `(`. The optional `)` needs no

Callers 2

scan_fnptr_typedefsFunction · 0.85
fnptr_declFunction · 0.85

Calls 4

skip_jswsFunction · 0.85
is_word_atFunction · 0.85
word_endFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected