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

Function scan_alias_names

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

674
675/// OBJ_ALIAS_RE over the continuation-joined text:
676/// /^[ \t]*#[ \t]*define[ \t]+(\w+)[ \t]+(?:struct[ \t]+)*[A-Za-z_]\w*[ \t\r]*$/gm
677fn scan_alias_names(stripped: &[u8], out: &mut Vec<String>) {
678 // joined = stripped.replace(/\\\r?\n/g, ' ')
679 let mut joined = Vec::with_capacity(stripped.len());
680 let mut i = 0;
681 while i < stripped.len() {
682 let b = stripped[i];
683 if b == b'\\' {
684 if stripped.get(i + 1) == Some(&b'\n') {
685 joined.push(b' ');
686 i += 2;
687 continue;
688 }
689 if stripped.get(i + 1) == Some(&b'\r') && stripped.get(i + 2) == Some(&b'\n') {
690 joined.push(b' ');
691 i += 3;
692 continue;
693 }
694 }
695 joined.push(b);
696 i += 1;
697 }
698 for line in joined.split(|&b| b == b'\n') {
699 if let Some(name) = alias_line(line) {
700 push_str(out, name);
701 }
702 }
703}
704
705#[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