From 6b45d4efcf103e0f88797a53f21daac3c73a014f Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 27 Jun 2016 21:03:18 +0200 Subject: [PATCH] Add comment on the validity of the RE for detecting certain defines. --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 144ca91..918858d 100755 --- a/main.py +++ b/main.py @@ -502,6 +502,13 @@ def main(): return status del p, status + # This method is very imperfect, in several senses. However, since + # it's applied to the output of the preprocessor, all of the concerns + # should be addressed: + # - \s includes \n, but \n should not be allowed. + # - Comments preceding the directive should not cause problems. + # e.g.: /* test */ #directive + # - #directive within a comment or string should be ignored. for x in re.findall(r'(?:(?<=\n)|^)\s*#\s*define\s+(' r'USE_SWITCHES' r'|USE_LAZY_LISTS'