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

Function firstCodeCharAfter

src/extraction/languages/c-cpp.ts:1507–1525  ·  view source on GitHub ↗

The first character of code at or after line `from`, past blank lines and * comments; undefined at the end of the file.

(lines: readonly string[], from: number)

Source from the content-addressed store, hash-verified

1505/** The first character of code at or after line `from`, past blank lines and
1506 * comments; undefined at the end of the file. */
1507function firstCodeCharAfter(lines: readonly string[], from: number): string | undefined {
1508 let inBlock = false;
1509 for (let k = from; k < lines.length; k++) {
1510 let text = (lines[k] as string).trim();
1511 for (;;) {
1512 if (inBlock) {
1513 const end = text.indexOf('*/');
1514 if (end < 0) { text = ''; break; }
1515 text = text.slice(end + 2).trim();
1516 inBlock = false;
1517 }
1518 if (text.startsWith('//')) text = '';
1519 else if (text.startsWith('/*')) { inBlock = true; text = text.slice(2); continue; }
1520 break;
1521 }
1522 if (text !== '') return text[0];
1523 }
1524 return undefined;
1525}
1526
1527/**
1528 * Blank an export/visibility macro sitting in front of a *member* or *method*

Callers 1

blankLoneMacroLinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected