Skip to content

Commit 304a633

Browse files
author
Laurent Pinson
committed
added #error directive
1 parent 2d05991 commit 304a633

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pypreprocessor/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ def lexer(self, line):
317317
print('Warning trying to remove more blocks than present',
318318
self.input, self.__linenum)
319319

320+
elif self.__is_directive(line, 'error'):
321+
if self.__validate_ifs():
322+
print('File: "' + self.input + '", line ' + str(self.__linenum + 1))
323+
print('Error directive reached')
324+
sys.exit(1)
325+
320326
else:
321327
# escapechar + space ==> comment
322328
# starts with #!/ ==> shebang

0 commit comments

Comments
 (0)