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

Function scan_alias_names

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

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

Callers 1

scan_fileFunction · 0.85

Calls 5

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

Tested by

no test coverage detected