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

Function blankCNamedVariadicDefineDots

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

Source from the content-addressed store, hash-verified

2692 */
2693const C_NAMED_VARIADIC_DEFINE_RE = /^([ \t]*#[ \t]*define[ \t]+[A-Za-z_]\w*\([^()\n]*?\b\w+)\.\.\./;
2694export function blankCNamedVariadicDefineDots(source: string): string {
2695 if (source.indexOf('...') === -1) return source;
2696 const lines = source.split('\n');
2697 let changed = false;
2698 for (let i = 0; i < lines.length; i++) {
2699 const line = lines[i] as string;
2700 const m = C_NAMED_VARIADIC_DEFINE_RE.exec(line);
2701 if (!m) continue;
2702 const keep = m[1] as string;
2703 lines[i] = keep + ' ' + line.slice(keep.length + 3);
2704 changed = true;
2705 }
2706 return changed ? lines.join('\n') : source;
2707}
2708
2709/** C source pre-processing: neutralize `#ifdef __cplusplus` compat-guard
2710 * 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