Add more tests of lexer's skipToLeadingKeyword behavior (#1971)

The character after the ending keyword gets blue-painted.
This commit is contained in:
Rangi
2026-05-09 15:56:17 -04:00
committed by GitHub
parent c50a849757
commit 358e8fe636
7 changed files with 88 additions and 0 deletions
+25
View File
@@ -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"
+24
View File
@@ -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)
+2
View File
@@ -0,0 +1,2 @@
yes
x = $0
+13
View File
@@ -0,0 +1,13 @@
def hmm equs "else"
if 1
println "yes"
{hmm}
println "no"
endc
if 0
println "NO"
{hmm}
println "YES"
endc
+1
View File
@@ -0,0 +1 @@
yes
+20
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@