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

Function scan_array_dispatch

codegraph-kernel/src/cfnptr.rs:929–963  ·  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

927}
928
929/// ARRAY_DISPATCH_RE: /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g
930fn scan_array_dispatch(s: &[u8], out: &mut Vec<String>) {
931 let mut pos = 0usize;
932 while pos < s.len() {
933 let b = s[pos];
934 if b != b'(' && !(is_word(b) && boundary_before(s, pos)) {
935 pos += 1;
936 continue;
937 }
938 let name_start = if b == b'(' {
939 let i = skip_jsws(s, pos + 1);
940 if s.get(i) == Some(&b'*') {
941 let j = skip_jsws(s, i + 1);
942 // \b holds: the previous char is `*` or whitespace.
943 if is_word_at(s, j) { Some(j) } else { None }
944 } else {
945 None
946 }
947 } else {
948 Some(pos)
949 };
950 let matched = name_start.and_then(|ns| {
951 let ne = word_end(s, ns);
952 let sub = subscript_span(s, skip_jsws(s, ne))?;
953 let end = close_call_tail(s, sub)?;
954 Some(((ns, ne), end))
955 });
956 match matched {
957 Some(((ns, ne), end)) => {
958 push_str(out, &s[ns..ne]);
959 pos = end;
960 }
961 None => pos += 1,
962 }
963 }
964}
965
966/// 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
subscript_spanFunction · 0.85
close_call_tailFunction · 0.85
push_strFunction · 0.85
lenMethod · 0.80
word_endFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected