Skip to content

Commit

Permalink
added #error directive
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Pinson committed Dec 21, 2021
1 parent 2d05991 commit aa9a9aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pypreprocessor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ def lexer(self, line):
print('Warning trying to remove more blocks than present',
self.input, self.__linenum)

elif self.__is_directive(line, 'error'):
print('File: "' + self.input + '", line ' + str(self.__linenum + 1))
print('Error directive reached')
sys.exit(1)

else:
# escapechar + space ==> comment
# starts with #!/ ==> shebang
Expand Down

0 comments on commit aa9a9aa

Please sign in to comment.