mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-08 19:09:36 +00:00
Consolidate, refactor, and bugfix the lexer's handling of captures and skips (#1957)
- Do not error about local labels following keywords in skips or captures (fixes #1955) - Do not incompletely attempt to handle line continuations in skips (fixes #1956) - Rename `skipToLeadingIdentifier` to `skipToLeadingKeyword`, refactor to merge `skipToEOL` into it, and use it for both skips and captures
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
MACRO m
|
||||
ENDM
|
||||
|
||||
IF 0
|
||||
m
|
||||
ENDC
|
||||
|
||||
IF 0
|
||||
m \
|
||||
ENDC
|
||||
|
||||
IF 1
|
||||
m
|
||||
ELSE
|
||||
m
|
||||
ENDC
|
||||
|
||||
IF 1
|
||||
m
|
||||
ELSE
|
||||
m \
|
||||
ENDC
|
||||
|
||||
IF 1
|
||||
m
|
||||
ELIF 0
|
||||
m
|
||||
ENDC
|
||||
|
||||
IF 1
|
||||
m
|
||||
ELIF 0
|
||||
m \
|
||||
ENDC
|
||||
@@ -0,0 +1,20 @@
|
||||
section "test", rom0
|
||||
|
||||
if 0
|
||||
section.local "oops"
|
||||
else
|
||||
println "*sips coffee*"
|
||||
endc
|
||||
|
||||
rept 0
|
||||
assert.local "lol"
|
||||
endr
|
||||
rept 1
|
||||
println "this is fine"
|
||||
endr
|
||||
|
||||
macro m
|
||||
db.local 42
|
||||
endm
|
||||
|
||||
db.local 123
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Identifier "db.local" begins with a keyword; did you mean to put a space between them?
|
||||
at local-after-keyword.asm(20)
|
||||
error: syntax error, unexpected number
|
||||
at local-after-keyword.asm(20)
|
||||
Assembly aborted with 2 errors
|
||||
@@ -0,0 +1,2 @@
|
||||
*sips coffee*
|
||||
this is fine
|
||||
Reference in New Issue
Block a user