if # an if
\s+ # 1 or more space
(?P<val> # open the group val
-\w+ # the group contain 1 or more alphanumeric characters
+[^\s]+ # the group contain 1 or more non space characters
) # close the group
""", re.VERBOSE)
def initialize(self, newlines):
if self.root == self.the_root:
+ # --
+ newlines.append("""
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+ IF(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ ENDIF(COMMAND cmake_policy)
+ """)
# --
if self.module == "kernel":
newlines.append("""
match = p_if.match(line)
if match:
theif = match.group("val")
+ if theif[0] == "!":
+ theif = "NOT " + theif[1:]
+ pass
line = p_if.sub(r"IF(%s)"%(theif), line)
opened_ifs.append(theif)
newlines.append(line)