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

Function scan_array_dispatch

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

899}
900
901/// ARRAY_DISPATCH_RE: /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g
902fn scan_array_dispatch(s: &[u8], out: &mut Vec<String>) {
903 let mut pos = 0usize;
904 while pos < s.len() {
905 let b = s[pos];
906 if b != b'(' && !(is_word(b) && boundary_before(s, pos)) {
907 pos += 1;
908 continue;
909 }
910 let name_start = if b == b'(' {
911 let i = skip_jsws(s, pos + 1);
912 if s.get(i) == Some(&b'*') {
913 let j = skip_jsws(s, i + 1);
914 // \b holds: the previous char is `*` or whitespace.
915 if is_word_at(s, j) { Some(j) } else { None }
916 } else {
917 None
918 }
919 } else {
920 Some(pos)
921 };
922 let matched = name_start.and_then(|ns| {
923 let ne = word_end(s, ns);
924 let sub = subscript_span(s, skip_jsws(s, ne))?;
925 let end = close_call_tail(s, sub)?;
926 Some(((ns, ne), end))
927 });
928 match matched {
929 Some(((ns, ne), end)) => {
930 push_str(out, &s[ns..ne]);
931 pos = end;
932 }
933 None => pos += 1,
934 }
935 }
936}
937
938/// 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