MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / CleanseComments

Function CleanseComments

steps/cpplint.py:1900–1913  ·  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

1898
1899
1900def CleanseComments(line):
1901 """Removes //-comments and single-line C-style /* */ comments.
1902
1903 Args:
1904 line: A line of C++ source.
1905
1906 Returns:
1907 The line with single-line comments removed.
1908 """
1909 commentpos = line.find('//')
1910 if commentpos != -1 and not IsCppString(line[:commentpos]):
1911 line = line[:commentpos].rstrip()
1912 # get rid of /* ... */
1913 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1914
1915
1916class CleansedLines(object):

Callers 3

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85
UpdateIncludeStateFunction · 0.85

Calls 1

IsCppStringFunction · 0.85

Tested by

no test coverage detected