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

Function scan_alias_names

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

OBJ_ALIAS_RE over the continuation-joined text: /^[ \t]*#[ \t]*define[ \t]+(\w+)[ \t]+(?:struct[ \t]+)*[A-Za-z_]\w*[ \t\r]*$/gm

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

Source from the content-addressed store, hash-verified

685
686/// OBJ_ALIAS_RE over the continuation-joined text:
687/// /^[ \t]*#[ \t]*define[ \t]+(\w+)[ \t]+(?:struct[ \t]+)*[A-Za-z_]\w*[ \t\r]*$/gm
688fn scan_alias_names(stripped: &[u8], out: &mut Vec<String>) {
689 // joined = stripped.replace(/\\\r?\n/g, ' ')
690 let mut joined = Vec::with_capacity(stripped.len());
691 let mut i = 0;
692 while i < stripped.len() {
693 let b = stripped[i];
694 if b == b'\\' {
695 if stripped.get(i + 1) == Some(&b'\n') {
696 joined.push(b' ');
697 i += 2;
698 continue;
699 }
700 if stripped.get(i + 1) == Some(&b'\r') && stripped.get(i + 2) == Some(&b'\n') {
701 joined.push(b' ');
702 i += 3;
703 continue;
704 }
705 }
706 joined.push(b);
707 i += 1;
708 }
709 for line in joined.split(|&b| b == b'\n') {
710 if let Some(name) = alias_line(line) {
711 push_str(out, name);
712 }
713 }
714}
715
716#[inline]

Callers 1

scan_fileFunction · 0.85

Calls 4

alias_lineFunction · 0.85
push_strFunction · 0.85
lenMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected