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

Function firstCodeCharAfter

src/extraction/languages/c-cpp.ts:1506–1524  ·  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

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