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)
| 1761 | |
| 1762 | |
| 1763 | def IsCppString(line): |
| 1764 | """Does line terminate so, that the next symbol is in string constant. |
| 1765 | |
| 1766 | This function does not consider single-line nor multi-line comments. |
| 1767 | |
| 1768 | Args: |
| 1769 | line: is a partial line of code starting from the 0..n. |
| 1770 | |
| 1771 | Returns: |
| 1772 | True, if next character appended to 'line' is inside a |
| 1773 | string constant. |
| 1774 | """ |
| 1775 | |
| 1776 | line = line.replace(r'\\', 'XX') # after this, \\" does not match to \" |
| 1777 | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 |
| 1778 | |
| 1779 | |
| 1780 | def CleanseRawStrings(raw_lines): |