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

Function IsCppString

analytical_engine/misc/cpplint.py:1752–1766  ·  view source on GitHub ↗

Does line terminate so, that the next symbol is in string constant. This function does not consider single-line nor multi-line comments. Args: line: is a partial line of code starting from the 0..n. Returns: True, if next character appended to 'line' is inside a string constant.

(line)

Source from the content-addressed store, hash-verified

1750
1751
1752def IsCppString(line):
1753 """Does line terminate so, that the next symbol is in string constant.
1754
1755 This function does not consider single-line nor multi-line comments.
1756
1757 Args:
1758 line: is a partial line of code starting from the 0..n.
1759
1760 Returns:
1761 True, if next character appended to 'line' is inside a
1762 string constant.
1763 """
1764
1765 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
1766 return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
1767
1768
1769def CleanseRawStrings(raw_lines):

Callers 1

CleanseCommentsFunction · 0.85

Calls 1

countMethod · 0.65

Tested by

no test coverage detected