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

Function blankCNamedVariadicDefineDots

src/extraction/languages/c-cpp.ts:1484–1497  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

1482 */
1483const C_NAMED_VARIADIC_DEFINE_RE = /^([ \t]*#[ \t]*define[ \t]+[A-Za-z_]\w*\([^()\n]*?\b\w+)\.\.\./;
1484export function blankCNamedVariadicDefineDots(source: string): string {
1485 if (source.indexOf('...') === -1) return source;
1486 const lines = source.split('\n');
1487 let changed = false;
1488 for (let i = 0; i < lines.length; i++) {
1489 const line = lines[i] as string;
1490 const m = C_NAMED_VARIADIC_DEFINE_RE.exec(line);
1491 if (!m) continue;
1492 const keep = m[1] as string;
1493 lines[i] = keep + ' ' + line.slice(keep.length + 3);
1494 changed = true;
1495 }
1496 return changed ? lines.join('\n') : source;
1497}
1498
1499/** C source pre-processing: neutralize `#ifdef __cplusplus` compat-guard
1500 * bodies (invisible to a C compiler; `extern "C" {` otherwise errors every

Callers 2

preParseCSourceFunction · 0.85
extraction.test.tsFile · 0.85

Calls 2

execMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected