Skip to content

Commit 62ac6e0

Browse files
author
H_Leusmann
committed
Added #endififdef X is the same as the two liner #endif #ifdef X
1 parent 25650c5 commit 62ac6e0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pypreprocessor/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,22 @@ def lexer(self, line):
132132
self.exit_error(self.escapeChar + 'else')
133133
else:
134134
self.__ifblocks[-1]=not(self.__ifblocks[-1])#self.search_defines(self.__ifconditions[-1]))
135-
return False, True
136-
# handle #endif..
135+
return False, True
136+
# handle #endif..
137+
# handle #endififdef
138+
elif line[:11] == self.escapeChar + 'endififdef':
139+
if len(line.split()) != 2:
140+
self.exit_error(self.escapeChar + 'endififdef')
141+
else:
142+
if len(self.__ifconditions)>=1:
143+
self.__ifblocks.pop(-1)
144+
self.__ifcondition=self.__ifconditions.pop(-1)
145+
else:
146+
self.__ifblocks = []
147+
self.__ifconditions = []
148+
self.__ifblocks.append(self.search_defines(line.split()[1]))
149+
self.__ifconditions.append(line.split()[1])
150+
return False, True
137151
# handle #endifall directives
138152
elif line[:9] == self.escapeChar + 'endifall':
139153
if len(line.split()) != 1:

0 commit comments

Comments
 (0)