diff --git a/pypreprocessor/__init__.py b/pypreprocessor/__init__.py index 04542fe..4c5371e 100644 --- a/pypreprocessor/__init__.py +++ b/pypreprocessor/__init__.py @@ -317,6 +317,12 @@ def lexer(self, line): print('Warning trying to remove more blocks than present', self.input, self.__linenum) + elif self.__is_directive(line, 'error'): + if self.__validate_ifs(): + print('File: "' + self.input + '", line ' + str(self.__linenum + 1)) + print('Error directive reached') + sys.exit(1) + else: # escapechar + space ==> comment # starts with #!/ ==> shebang diff --git a/pypreprocessor/__main__.py b/pypreprocessor/__main__.py index 0ecd8ee..73235b2 100644 --- a/pypreprocessor/__main__.py +++ b/pypreprocessor/__main__.py @@ -27,7 +27,7 @@ p=preprocessor(inFile=args.input, defines=args.define, mode=None, removeMeta=args.removeMeta, escapeChar=None, run=args.run, resume=False, save=True, overload=args.overload, quiet=args.quiet) if args.output: - p.define = args.output + p.output = args.output if args.escape: p.escape = args.escape