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

Function scan_includes

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

INCLUDE_RE over RAW text: /#[ \t]*include[ \t]+"([^"\n]+)"/g

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

Source from the content-addressed store, hash-verified

936}
937
938/// INCLUDE_RE over RAW text: /#[ \t]*include[ \t]+"([^"\n]+)"/g
939fn scan_includes(raw: &[u8], out: &mut Vec<String>) {
940 let mut pos = 0usize;
941 while pos < raw.len() {
942 let Some(h) = find_bytes(raw, b"#", pos) else { break };
943 let mut i = skip_sp_tab(raw, h + 1);
944 if raw.len() < i + 7 || &raw[i..i + 7] != b"include" {
945 pos = h + 1;
946 continue;
947 }
948 i += 7;
949 let q = skip_sp_tab(raw, i);
950 if q == i || raw.get(q) != Some(&b'"') {
951 pos = h + 1;
952 continue;
953 }
954 let mut j = q + 1;
955 while j < raw.len() && raw[j] != b'"' && raw[j] != b'\n' {
956 j += 1;
957 }
958 if j > q + 1 && j < raw.len() && raw[j] == b'"' {
959 out.push(bytes_to_string(&raw[q + 1..j]));
960 pos = j + 1;
961 } else {
962 pos = h + 1;
963 }
964 }
965}
966
967// ---------- struct field parsing ----------

Callers 1

scan_fileFunction · 0.85

Calls 5

find_bytesFunction · 0.85
skip_sp_tabFunction · 0.85
bytes_to_stringFunction · 0.85
lenMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected