MCPcopy Create free account
hub / github.com/alibaba/graph-learn / IsCppString

Function IsCppString

dynamic_graph_service/ci/cpplint.py:1487–1501  ·  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

1485
1486
1487def IsCppString(line):
1488 """Does line terminate so, that the next symbol is in string constant.
1489
1490 This function does not consider single-line nor multi-line comments.
1491
1492 Args:
1493 line: is a partial line of code starting from the 0..n.
1494
1495 Returns:
1496 True, if next character appended to 'line' is inside a
1497 string constant.
1498 """
1499
1500 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
1501 return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
1502
1503
1504def CleanseRawStrings(raw_lines):

Callers 1

CleanseCommentsFunction · 0.85

Calls 1

countMethod · 0.80

Tested by

no test coverage detected