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

Function scan_array_dispatch

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

ARRAY_DISPATCH_RE: /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g

(s: &[u8], out: &mut Vec<String>)

Source from the content-addressed store, hash-verified

917}
918
919/// ARRAY_DISPATCH_RE: /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g
920fn scan_array_dispatch(s: &[u8], out: &mut Vec<String>) {
921 let mut pos = 0usize;
922 while pos < s.len() {
923 let b = s[pos];
924 if b != b'(' && !(is_word(b) && boundary_before(s, pos)) {
925 pos += 1;
926 continue;
927 }
928 let name_start = if b == b'(' {
929 let i = skip_jsws(s, pos + 1);
930 if s.get(i) == Some(&b'*') {
931 let j = skip_jsws(s, i + 1);
932 // \b holds: the previous char is `*` or whitespace.
933 if is_word_at(s, j) { Some(j) } else { None }
934 } else {
935 None
936 }
937 } else {
938 Some(pos)
939 };
940 let matched = name_start.and_then(|ns| {
941 let ne = word_end(s, ns);
942 let sub = subscript_span(s, skip_jsws(s, ne))?;
943 let end = close_call_tail(s, sub)?;
944 Some(((ns, ne), end))
945 });
946 match matched {
947 Some(((ns, ne), end)) => {
948 push_str(out, &s[ns..ne]);
949 pos = end;
950 }
951 None => pos += 1,
952 }
953 }
954}
955
956/// INCLUDE_RE over RAW text: /#[ \t]*include[ \t]+"([^"\n]+)"/g

Callers 1

scan_fileFunction · 0.85

Calls 10

is_wordFunction · 0.85
boundary_beforeFunction · 0.85
skip_jswsFunction · 0.85
is_word_atFunction · 0.85
word_endFunction · 0.85
subscript_spanFunction · 0.85
close_call_tailFunction · 0.85
push_strFunction · 0.85
lenMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected