Blank a comment while preserving newlines and line-splice backslashes.
(comment: bytes)
| 3881 | |
| 3882 | |
| 3883 | def _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 | |
| 3897 | def _normalize_cpp_directive_comments(source: bytes) -> bytes: |
no outgoing calls
no test coverage detected