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

Function maskCppCommentsAndLiterals

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

* The source with comments and string/char literals turned to spaces, line * endings kept. The macro scans below match on this, so a word in a comment or * a literal (`* NOTE: …` in a doc comment) is never blanked, and every offset * still lines up with the source.

(source: string)

Source from the content-addressed store, hash-verified

731 * still lines up with the source.
732 */
733function maskCppCommentsAndLiterals(source: string): string {
734 return source.replace(CPP_COMMENT_OR_LITERAL_RE, (m) => (m.includes('\n') || m.includes('\r') ? m.replace(/[^\r\n]/g, ' ') : ' '.repeat(m.length)));
735}
736
737/**
738 * The code the macro scans below match on, at the source's offsets: comments

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected