mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Allow NUL characters in strings (#1405)
This commit is contained in:
12
test/asm/null-character.asm
Normal file
12
test/asm/null-character.asm
Normal file
@@ -0,0 +1,12 @@
|
||||
MACRO echo
|
||||
print "\#"
|
||||
ENDM
|
||||
; '\0' can be printed like any other character
|
||||
print "hello\0world\0"
|
||||
echo left\0right\0
|
||||
|
||||
SECTION "test", ROM0
|
||||
; '\0' can be included in ROM like any other character
|
||||
db "foo\0bar", 0
|
||||
charmap "a\0b", $42
|
||||
db "a\0b\0"
|
||||
2
test/asm/null-character.err
Normal file
2
test/asm/null-character.err
Normal file
@@ -0,0 +1,2 @@
|
||||
warning: null-character.asm(12): [-Wunmapped-char]
|
||||
Unmapped character '\0'
|
||||
BIN
test/asm/null-character.out
Normal file
BIN
test/asm/null-character.out
Normal file
Binary file not shown.
BIN
test/asm/null-character.out.bin
Normal file
BIN
test/asm/null-character.out.bin
Normal file
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
error: null-in-macro.asm(4) -> null-in-macro.asm::foo(2):
|
||||
Unknown character 0x00
|
||||
Unknown character '\0'
|
||||
error: Assembly aborted (1 error)!
|
||||
|
||||
7
test/asm/null-outside-string.asm
Normal file
7
test/asm/null-outside-string.asm
Normal file
@@ -0,0 +1,7 @@
|
||||
SECTION "test", ROM0
|
||||
; '\0' is not special here; it's lexed as a line continuation...
|
||||
DEF foo\0bar EQU 42
|
||||
db foo\0bar
|
||||
; ...just like any other non-whitespace character
|
||||
DEF spam\Xeggs EQU 69
|
||||
db spam\Xeggs
|
||||
17
test/asm/null-outside-string.err
Normal file
17
test/asm/null-outside-string.err
Normal file
@@ -0,0 +1,17 @@
|
||||
error: null-outside-string.asm(3):
|
||||
Begun line continuation, but encountered character '0'
|
||||
error: null-outside-string.asm(3):
|
||||
syntax error, unexpected number
|
||||
error: null-outside-string.asm(4):
|
||||
Begun line continuation, but encountered character '0'
|
||||
error: null-outside-string.asm(4):
|
||||
syntax error, unexpected number
|
||||
error: null-outside-string.asm(6):
|
||||
Begun line continuation, but encountered character 'X'
|
||||
error: null-outside-string.asm(6):
|
||||
syntax error, unexpected identifier
|
||||
error: null-outside-string.asm(7):
|
||||
Begun line continuation, but encountered character 'X'
|
||||
error: null-outside-string.asm(7):
|
||||
syntax error, unexpected identifier
|
||||
error: Assembly aborted (8 errors)!
|
||||
@@ -1,2 +1,2 @@
|
||||
def x\0 = 10
|
||||
def x\<0> = 10
|
||||
println x
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
error: symbol-invalid-macro-arg.asm(1):
|
||||
Invalid macro argument '\0'
|
||||
Invalid bracketed macro argument '\<0>'
|
||||
error: Assembly aborted (1 error)!
|
||||
|
||||
Reference in New Issue
Block a user