module

Noir::CComments

Blanks // line comments and /* */ block comments in C-family source with spaces, keeping every newline so line numbers and offsets in the cleaned copy match the original. String literals are tracked so a // or /* inside one ("http://x//y") is never read as a comment opener.

Class methods

strip(text : String, quotes : String = "\"'", raw_quotes : String = "", leak_unterminated_tail : Bool = false) : String

quotes open a string literal in which a backslash escapes the next char; raw_quotes open one that takes no escapes (Go's backtick).

An unterminated /* is blanked through the end of the text. With leak_unterminated_tail the scan instead stops one char early and the text's final character passes through verbatim — the Java/Go strippers always behaved that way, and their output is kept byte-identical.

Source