mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Allow periods to continue macro args
c75a953 broke my (previously-working) project that defined, via
macros, 'sizeof_.player'.
A test was added to confirm that those are indeed accepted
outside of macros.
This commit is contained in:
@@ -214,7 +214,8 @@ bool AppendMacroArg(char whichArg, char *dest, size_t *destIndex, char **rest)
|
|||||||
|| (ch >= '0' && ch <= '9')
|
|| (ch >= '0' && ch <= '9')
|
||||||
|| ch == '_'
|
|| ch == '_'
|
||||||
|| ch == '@'
|
|| ch == '@'
|
||||||
|| ch == '#') {
|
|| ch == '#'
|
||||||
|
|| ch == '.') {
|
||||||
if (*destIndex >= MAXSYMLEN)
|
if (*destIndex >= MAXSYMLEN)
|
||||||
fatalerror("Symbol too long");
|
fatalerror("Symbol too long");
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
print: MACRO
|
||||||
|
printv \1
|
||||||
|
printt "\n"
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
|
||||||
m1: MACRO
|
m1: MACRO
|
||||||
x\1
|
x\1
|
||||||
ENDM
|
ENDM
|
||||||
@@ -14,14 +20,26 @@ ENDM
|
|||||||
m1 x = 7
|
m1 x = 7
|
||||||
m2 2 = 8
|
m2 2 = 8
|
||||||
|
|
||||||
printv x
|
print x
|
||||||
printt "\n"
|
print y
|
||||||
|
print xx
|
||||||
|
print yy
|
||||||
|
|
||||||
printv y
|
|
||||||
printt "\n"
|
|
||||||
|
|
||||||
printv xx
|
test_char: MACRO
|
||||||
printt "\n"
|
VAR_DEF equs "sizeof_\1something = 0"
|
||||||
|
VAR_DEF
|
||||||
|
sizeof_\1something = 1
|
||||||
|
PURGE VAR_DEF
|
||||||
|
|
||||||
printv yy
|
VAR_PRINT equs "printt \"sizeof_\1something equals {sizeof_\1something}\\n\""
|
||||||
printt "\n"
|
VAR_PRINT
|
||||||
|
PURGE VAR_PRINT
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
test_char _
|
||||||
|
test_char @
|
||||||
|
test_char #
|
||||||
|
test_char .
|
||||||
|
|
||||||
|
test_char :
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
|
ERROR: label-macro-arg.asm(45) -> test_char(2):
|
||||||
|
Macro 'something' not defined
|
||||||
$5
|
$5
|
||||||
$6
|
$6
|
||||||
$7
|
$7
|
||||||
$8
|
$8
|
||||||
|
sizeof__something equals $1
|
||||||
|
sizeof_@something equals $1
|
||||||
|
sizeof_#something equals $1
|
||||||
|
sizeof_.something equals $1
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
|
ERROR: -(45) -> test_char(2):
|
||||||
|
Macro 'something' not defined
|
||||||
$5
|
$5
|
||||||
$6
|
$6
|
||||||
$7
|
$7
|
||||||
$8
|
$8
|
||||||
|
sizeof__something equals $1
|
||||||
|
sizeof_@something equals $1
|
||||||
|
sizeof_#something equals $1
|
||||||
|
sizeof_.something equals $1
|
||||||
|
|||||||
Reference in New Issue
Block a user