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

Function blankCNamedVariadicDefineDots

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

Source from the content-addressed store, hash-verified

1492 */
1493const C_NAMED_VARIADIC_DEFINE_RE = /^([ \t]*#[ \t]*define[ \t]+[A-Za-z_]\w*\([^()\n]*?\b\w+)\.\.\./;
1494export function blankCNamedVariadicDefineDots(source: string): string {
1495 if (source.indexOf('...') === -1) return source;
1496 const lines = source.split('\n');
1497 let changed = false;
1498 for (let i = 0; i < lines.length; i++) {
1499 const line = lines[i] as string;
1500 const m = C_NAMED_VARIADIC_DEFINE_RE.exec(line);
1501 if (!m) continue;
1502 const keep = m[1] as string;
1503 lines[i] = keep + ' ' + line.slice(keep.length + 3);
1504 changed = true;
1505 }
1506 return changed ? lines.join('\n') : source;
1507}
1508
1509/** C source pre-processing: neutralize `#ifdef __cplusplus` compat-guard
1510 * 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