MCPcopy Index your code
hub / github.com/cpplint/cpplint / CleanseComments

Function CleanseComments

cpplint.py:2061–2074  ·  view source on GitHub ↗

Removes //-comments and single-line C-style /* */ comments. Args: line: A line of C++ source. Returns: The line with single-line comments removed.

(line)

Source from the content-addressed store, hash-verified

2059
2060
2061def CleanseComments(line):
2062 """Removes //-comments and single-line C-style /* */ comments.
2063
2064 Args:
2065 line: A line of C++ source.
2066
2067 Returns:
2068 The line with single-line comments removed.
2069 """
2070 commentpos = line.find("//")
2071 if commentpos != -1 and not IsCppString(line[:commentpos]):
2072 line = line[:commentpos].rstrip()
2073 # get rid of /* ... */
2074 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub("", line)
2075
2076
2077def ReplaceAlternateTokens(line):

Callers 2

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85

Calls 1

IsCppStringFunction · 0.85

Tested by

no test coverage detected