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

Function scan_includes

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

964}
965
966/// INCLUDE_RE over RAW text: /#[ \t]*include[ \t]+"([^"\n]+)"/g
967fn scan_includes(raw: &[u8], out: &mut Vec<String>) {
968 let mut pos = 0usize;
969 while pos < raw.len() {
970 let Some(h) = find_bytes(raw, b"#", pos) else { break };
971 let mut i = skip_sp_tab(raw, h + 1);
972 if raw.len() < i + 7 || &raw[i..i + 7] != b"include" {
973 pos = h + 1;
974 continue;
975 }
976 i += 7;
977 let q = skip_sp_tab(raw, i);
978 if q == i || raw.get(q) != Some(&b'"') {
979 pos = h + 1;
980 continue;
981 }
982 let mut j = q + 1;
983 while j < raw.len() && raw[j] != b'"' && raw[j] != b'\n' {
984 j += 1;
985 }
986 if j > q + 1 && j < raw.len() && raw[j] == b'"' {
987 out.push(bytes_to_string(&raw[q + 1..j]));
988 pos = j + 1;
989 } else {
990 pos = h + 1;
991 }
992 }
993}
994
995// ---------- struct field parsing ----------

Callers 1

scan_fileFunction · 0.85

Calls 6

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

Tested by

no test coverage detected