Implement REDEF to allow redefining EQUS string equates

Fixes #677
This commit is contained in:
Rangi
2021-01-01 14:28:59 -05:00
committed by Eldred Habert
parent 18f3c8ff9a
commit 9d2d5cfcfe
8 changed files with 99 additions and 11 deletions

23
test/asm/redef-equs.asm Normal file
View File

@@ -0,0 +1,23 @@
s EQUS "Hello, "
REDEF s EQUS "{s}world!"
; prints "Hello, world!"
PRINTT "{s}\n"
list: MACRO
LIST_NAME EQUS "\1"
REDEF {LIST_NAME} EQUS "["
REPT _NARG - 1
REDEF {LIST_NAME} EQUS "{{LIST_NAME}}\2;"
SHIFT
ENDR
REDEF {LIST_NAME} EQUS "{{LIST_NAME}}]"
PURGE LIST_NAME
ENDM
list FOO
PRINTT "{FOO}\n"
list FOO, 1, A, 2, B
PRINTT "{FOO}\n"
N EQU 42
REDEF N EQUS "X"

3
test/asm/redef-equs.err Normal file
View File

@@ -0,0 +1,3 @@
ERROR: redef-equs.asm(23):
'N' already defined as non-EQUS at redef-equs.asm(22)
error: Assembly aborted (1 errors)!

3
test/asm/redef-equs.out Normal file
View File

@@ -0,0 +1,3 @@
Hello, world!
[]
[1;A;2;B;]