mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Don't append invalid characters to symbol name
When a macro arg appears in a symbol name, the contents are appended. However, the contents of the macro arg were not being validated. Any character, regardless of whether it was allowed in a symbol name, would be appended. With this change, the contents of the macro arg are now validated character by character. The symbol name is considered to end at the last valid character. The remainder of the macro arg is treated as though it followed the symbol name in the asm source code.
This commit is contained in:
27
test/asm/label-macro-arg.asm
Normal file
27
test/asm/label-macro-arg.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
m1: MACRO
|
||||
x\1
|
||||
ENDM
|
||||
|
||||
S EQUS "y"
|
||||
S2 EQUS "yy"
|
||||
|
||||
m2: MACRO
|
||||
S\1
|
||||
ENDM
|
||||
|
||||
m1 = 5
|
||||
m2 = 6
|
||||
m1 x = 7
|
||||
m2 2 = 8
|
||||
|
||||
printv x
|
||||
printt "\n"
|
||||
|
||||
printv y
|
||||
printt "\n"
|
||||
|
||||
printv xx
|
||||
printt "\n"
|
||||
|
||||
printv yy
|
||||
printt "\n"
|
||||
4
test/asm/label-macro-arg.out
Normal file
4
test/asm/label-macro-arg.out
Normal file
@@ -0,0 +1,4 @@
|
||||
$5
|
||||
$6
|
||||
$7
|
||||
$8
|
||||
4
test/asm/label-macro-arg.out.pipe
Normal file
4
test/asm/label-macro-arg.out.pipe
Normal file
@@ -0,0 +1,4 @@
|
||||
$5
|
||||
$6
|
||||
$7
|
||||
$8
|
||||
Reference in New Issue
Block a user