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

Function lineCommentEnd

src/extraction/languages/cpp-brace-scopes.ts:104–113  ·  view source on GitHub ↗

The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment).

(source: string, i: number)

Source from the content-addressed store, hash-verified

102
103/** The end of a `//` comment starting at `i`: its newline (a `\` before it continues the comment). */
104function lineCommentEnd(source: string, i: number): number {
105 for (;;) {
106 const nl = source.indexOf('\n', i);
107 if (nl < 0) return source.length;
108 let k = nl - 1;
109 if (source.charCodeAt(k) === 13) k--;
110 if (source.charCodeAt(k) !== 92) return nl;
111 i = nl + 1;
112 }
113}
114
115/** Past whitespace and comments from `i`. */
116function skipBlank(source: string, i: number): number {

Callers 2

skipBlankFunction · 0.85
scanCppBraceScopesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected