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

Function scan_includes

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

954}
955
956/// INCLUDE_RE over RAW text: /#[ \t]*include[ \t]+"([^"\n]+)"/g
957fn scan_includes(raw: &[u8], out: &mut Vec<String>) {
958 let mut pos = 0usize;
959 while pos < raw.len() {
960 let Some(h) = find_bytes(raw, b"#", pos) else { break };
961 let mut i = skip_sp_tab(raw, h + 1);
962 if raw.len() < i + 7 || &raw[i..i + 7] != b"include" {
963 pos = h + 1;
964 continue;
965 }
966 i += 7;
967 let q = skip_sp_tab(raw, i);
968 if q == i || raw.get(q) != Some(&b'"') {
969 pos = h + 1;
970 continue;
971 }
972 let mut j = q + 1;
973 while j < raw.len() && raw[j] != b'"' && raw[j] != b'\n' {
974 j += 1;
975 }
976 if j > q + 1 && j < raw.len() && raw[j] == b'"' {
977 out.push(bytes_to_string(&raw[q + 1..j]));
978 pos = j + 1;
979 } else {
980 pos = h + 1;
981 }
982 }
983}
984
985// ---------- 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