Remove // and /* */ comments.
(text)
| 57 | # --------------------------------------------------------------------------- |
| 58 | |
| 59 | def strip_comments(text): |
| 60 | """Remove // and /* */ comments.""" |
| 61 | # Block comments |
| 62 | text = re.sub(r'/\*.*?\*/', ' ', text, flags=re.DOTALL) |
| 63 | # Line comments |
| 64 | text = re.sub(r'//[^\n]*', '', text) |
| 65 | return text |
| 66 | |
| 67 | |
| 68 | def extract_structs(text): |