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

Function IsCppString

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

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

Callers 1

CleanseCommentsFunction · 0.85

Calls 2

countMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected