mirror of
https://github.com/gbdev/rgbds.git
synced 2026-01-21 07:51:51 +00:00
Implement a '#' prefix for raw identifiers that may alias keywords (#1480)
* Implement a '#' prefix for raw identifiers that may alias keywords * Review comments * Disallow hashless raw identifiers in interpolations * Run clang-format
This commit is contained in:
36
test/asm/raw-identifiers.asm
Normal file
36
test/asm/raw-identifiers.asm
Normal file
@@ -0,0 +1,36 @@
|
||||
def #DEF equ 1
|
||||
def #def equ 2
|
||||
def #ghi equ 3
|
||||
export #def, #ghi
|
||||
|
||||
def #align = 0
|
||||
def #rb rb #def
|
||||
|
||||
MACRO #macro
|
||||
println "\<#def> is not \<#DEF>"
|
||||
ENDM
|
||||
#macro first, second
|
||||
purge #macro
|
||||
assert !def(#macro)
|
||||
|
||||
section "section", rom0
|
||||
#section::
|
||||
dw #section
|
||||
#.rom0:
|
||||
db BANK(#section.rom0)
|
||||
#section.romx:
|
||||
println "section.romx is in ", SECTION(.romx)
|
||||
|
||||
def #sub equs "def"
|
||||
{#sub} #add equs "#"
|
||||
|
||||
for #for, {{#add}{#sub}}
|
||||
println "for == ", #for
|
||||
endr
|
||||
assert #for == 2
|
||||
assert !{#sub}(#FOR)
|
||||
|
||||
newcharmap #charmap, #main
|
||||
charmap "#", $42
|
||||
setcharmap #charmap
|
||||
db "#"
|
||||
Reference in New Issue
Block a user