Strip Pascal comments ({}, (* *), //) while preserving newlines.
(text: str)
| 13113 | |
| 13114 | |
| 13115 | def _pascal_strip_comments(text: str) -> str: |
| 13116 | """Strip Pascal comments ({}, (* *), //) while preserving newlines.""" |
| 13117 | def _sub(m: re.Match) -> str: |
| 13118 | tok = m.group(0) |
| 13119 | if tok.startswith("'"): |
| 13120 | return tok |
| 13121 | return "".join(c if c == "\n" else " " for c in tok) |
| 13122 | return _PAS_TOKEN_RE.sub(_sub, text) |
| 13123 | |
| 13124 | |
| 13125 | def _pascal_split_sections(text: str) -> tuple[str, int, str, int]: |
no outgoing calls
no test coverage detected