MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _blank_cpp_comment_keeping_splices

Function _blank_cpp_comment_keeping_splices

graphify/extract.py:3883–3894  ·  view source on GitHub ↗

Blank a comment while preserving newlines and line-splice backslashes.

(comment: bytes)

Source from the content-addressed store, hash-verified

3881
3882
3883def _blank_cpp_comment_keeping_splices(comment: bytes) -> bytes:
3884 """Blank a comment while preserving newlines and line-splice backslashes."""
3885 out = bytearray(comment)
3886 for index, byte in enumerate(out):
3887 if byte in b"\r\n":
3888 continue
3889 if byte == ord(b"\\") and comment[index + 1:index + 2] == b"\n":
3890 continue
3891 if byte == ord(b"\\") and comment[index + 1:index + 3] == b"\r\n":
3892 continue
3893 out[index] = ord(b" ")
3894 return bytes(out)
3895
3896
3897def _normalize_cpp_directive_comments(source: bytes) -> bytes:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected