MCPcopy Create free account
hub / github.com/tensorflow/tfjs / IsCppString

Function IsCppString

tfjs-backend-wasm/tools/cpplint.py:1271–1285  ·  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

1269
1270
1271def IsCppString(line):
1272 """Does line terminate so, that the next symbol is in string constant.
1273
1274 This function does not consider single-line nor multi-line comments.
1275
1276 Args:
1277 line: is a partial line of code starting from the 0..n.
1278
1279 Returns:
1280 True, if next character appended to 'line' is inside a
1281 string constant.
1282 """
1283
1284 line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
1285 return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
1286
1287
1288def CleanseRawStrings(raw_lines):

Callers 1

CleanseCommentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…