lru_cache everywhere

This commit is contained in:
Zach White 2021-06-27 14:38:52 -07:00
parent 823a74ebae
commit dcbfdb5cfc
11 changed files with 54 additions and 7 deletions

View file

@ -3,6 +3,7 @@
Gratefully adapted from https://stackoverflow.com/a/241506
"""
import re
from functools import lru_cache
comment_pattern = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE)
@ -14,6 +15,7 @@ def _comment_stripper(match):
return ' ' if s.startswith('/') else s
@lru_cache(maxsize=0)
def comment_remover(text):
"""Remove C/C++ style comments from text.
"""