Strip C/C++ comments from content. Args: content (str): The content to strip comments from Returns: str: Content with comments removed
(content: str)
| 41 | |
| 42 | |
| 43 | def strip_comments(content: str) -> str: |
| 44 | """ |
| 45 | Strip C/C++ comments from content. |
| 46 | |
| 47 | Args: |
| 48 | content (str): The content to strip comments from |
| 49 | |
| 50 | Returns: |
| 51 | str: Content with comments removed |
| 52 | """ |
| 53 | # Remove multi-line comments |
| 54 | content = re.sub(r"/\*.*?\*/", "", content, flags=re.DOTALL) |
| 55 | # Remove single-line comments |
| 56 | content = re.sub(r"//.*$", "", content, flags=re.MULTILINE) |
| 57 | return content |
| 58 | |
| 59 | |
| 60 | def is_bracket_balanced(file_path: Path) -> bool: |
no outgoing calls
no test coverage detected