MCPcopy Create free account
hub / github.com/alibaba/GraphScope / CleanseComments

Function CleanseComments

analytical_engine/misc/cpplint.py:1889–1902  ·  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

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

Callers 3

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85
UpdateIncludeStateFunction · 0.85

Calls 3

IsCppStringFunction · 0.85
findMethod · 0.80
subMethod · 0.80

Tested by

no test coverage detected