Skip to content

Commit a83da71

Browse files
authored
Merge pull request #251 from boriel/bugfix/define_empty
Bugfix: Allow defining empty macros
2 parents 8f27965 + d007f8d commit a83da71

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

tests/functional/test_cmdline.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ usage: zxb [-h] [-d] [-O OPTIMIZE] [-o OUTPUT_FILE] [-T] [-t] [-B] [-a] [-A]
1313
[--append-headless-binary APPEND_HEADLESS_BINARY]
1414
PROGRAM
1515
zxb: error: Option --asm and --mmap cannot be used together
16+
17+
>>> process_file('arrbase1.bas', ['-q', '-S', '-O -D EMPTY_MACRO'])

zxb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def main(args=None):
181181

182182
if options.defines:
183183
for i in options.defines:
184-
name, val = tuple(i.split('=', 1))
184+
macro = list(i.split('=', 1))
185+
name = macro[0]
186+
val = ''.join(macro[1:])
185187
OPTIONS.__DEFINES.value[name] = val
186188
zxbpp.ID_TABLE.define(name, lineno=0)
187189

0 commit comments

Comments
 (0)