Skip to content

Commit a7d0f16

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

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
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

pypreprocessor/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
p=preprocessor(inFile=args.input, defines=args.define, mode=None, removeMeta=args.removeMeta, escapeChar=None,
2828
run=args.run, resume=False, save=True, overload=args.overload, quiet=args.quiet)
2929
if args.output:
30-
p.define = args.output
30+
p.output = args.output
3131
if args.escape:
3232
p.escape = args.escape
3333

0 commit comments

Comments
 (0)