mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-10 03:49:36 +00:00
Add more tests of lexer's skipToLeadingKeyword behavior (#1971)
The character after the ending keyword gets blue-painted.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
DEF x = 0
|
||||
DEF s EQUS "\nprintln \"lol\", x\ndef x += 1"
|
||||
|
||||
if 0
|
||||
println "no"
|
||||
endc{#s}
|
||||
|
||||
if 1
|
||||
println "yes"
|
||||
else{#s}
|
||||
println "nope"
|
||||
endc{#s}
|
||||
|
||||
rept 0
|
||||
println "no way"
|
||||
endr{#s}
|
||||
|
||||
println "x = ", x
|
||||
|
||||
MACRO m
|
||||
if 0
|
||||
println "no how"
|
||||
endc\1
|
||||
ENDM
|
||||
m \nprintln "haha"
|
||||
@@ -0,0 +1,24 @@
|
||||
error: Invalid character '{'
|
||||
at expansion-after-end.asm(6)
|
||||
error: syntax error, unexpected symbol, expecting end of line or end of buffer or end of fragment literal
|
||||
at expansion-after-end.asm(6)
|
||||
error: Invalid character '}'
|
||||
at expansion-after-end.asm(6)
|
||||
error: Invalid character '{'
|
||||
at expansion-after-end.asm(12)
|
||||
error: syntax error, unexpected symbol, expecting end of line or end of buffer or end of fragment literal
|
||||
at expansion-after-end.asm(12)
|
||||
error: Invalid character '}'
|
||||
at expansion-after-end.asm(12)
|
||||
error: Invalid character '{'
|
||||
at expansion-after-end.asm(16)
|
||||
error: syntax error, unexpected symbol, expecting end of line or end of buffer or end of fragment literal
|
||||
at expansion-after-end.asm(16)
|
||||
error: Invalid character '}'
|
||||
at expansion-after-end.asm(16)
|
||||
error: Invalid character '1' after line continuation
|
||||
at expansion-after-end.asm::m(23) <- expansion-after-end.asm(25)
|
||||
error: syntax error, unexpected number, expecting end of line or end of buffer or end of fragment literal
|
||||
at expansion-after-end.asm::m(23) <- expansion-after-end.asm(25)
|
||||
FATAL: Ended block with 1 unterminated conditional (`IF`/`ELIF`/`ELSE` block)
|
||||
at expansion-after-end.asm::m(24) <- expansion-after-end.asm(25)
|
||||
@@ -0,0 +1,2 @@
|
||||
yes
|
||||
x = $0
|
||||
@@ -0,0 +1,13 @@
|
||||
def hmm equs "else"
|
||||
|
||||
if 1
|
||||
println "yes"
|
||||
{hmm}
|
||||
println "no"
|
||||
endc
|
||||
|
||||
if 0
|
||||
println "NO"
|
||||
{hmm}
|
||||
println "YES"
|
||||
endc
|
||||
@@ -0,0 +1 @@
|
||||
yes
|
||||
@@ -0,0 +1,20 @@
|
||||
; This covers some edge cases of `skipToLeadingKeyword`
|
||||
|
||||
SECTION "test", ROM0
|
||||
|
||||
MACRO mac
|
||||
if 1
|
||||
DEF x = \1_WIDTH
|
||||
DEF y = \1_HEIGHT
|
||||
elif 0
|
||||
DEF x = \1_HEIGHT
|
||||
DEF y = \1_WIDTH
|
||||
else
|
||||
fail "nope"
|
||||
endc
|
||||
db \1_WIDTH, \1_HEIGHT, x, y
|
||||
ENDM
|
||||
|
||||
DEF NAME_WIDTH EQU 10
|
||||
DEF NAME_HEIGHT EQU 9
|
||||
mac NAME
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user