MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / CleanseComments

Function CleanseComments

src/tests/coding/cpplint.py:1885–1898  ·  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

1883
1884
1885def CleanseComments(line):
1886 """Removes //-comments and single-line C-style /* */ comments.
1887
1888 Args:
1889 line: A line of C++ source.
1890
1891 Returns:
1892 The line with single-line comments removed.
1893 """
1894 commentpos = line.find('//')
1895 if commentpos != -1 and not IsCppString(line[:commentpos]):
1896 line = line[:commentpos].rstrip()
1897 # get rid of /* ... */
1898 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1899
1900
1901class CleansedLines(object):

Callers 3

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85
UpdateIncludeStateFunction · 0.85

Calls 2

IsCppStringFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected