Consistently lex local labels after keywords, even when skipping/capturing

This commit is contained in:
Rangi42
2026-04-27 15:28:30 +02:00
parent 3f144b7713
commit a18b2f1049
4 changed files with 2 additions and 15 deletions
+1 -1
View File
@@ -2166,7 +2166,7 @@ static Token skipToLeadingKeyword() {
} else if (isLetter(c)) { } else if (isLetter(c)) {
shiftChar(); shiftChar();
std::string keyword(1, c); std::string keyword(1, c);
for (c = peek(); continuesIdentifier(c) && c != '.'; c = nextChar()) { for (c = peek(); continuesIdentifier(c); c = nextChar()) {
keyword += c; keyword += c;
} }
if (auto search = keywords.find(keyword); search != keywords.end()) { if (auto search = keywords.find(keyword); search != keywords.end()) {
+1 -1
View File
@@ -1,5 +1,5 @@
section "test", ROM0 section "test", ROM0
Global: Global: ; none of the `end*.local_*` identifiers below should get treated as keywords
if 0 if 0
println "no" println "no"
-12
View File
@@ -1,14 +1,2 @@
error: syntax error, unexpected local label, expecting end of line or end of buffer or end of fragment literal
at local-after-end.asm(6)
error: Identifier "endc.local_yes" begins with a keyword; did you mean to put a space between them?
at local-after-end.asm(9)
error: syntax error, unexpected local label, expecting end of line or end of buffer or end of fragment literal
at local-after-end.asm(13)
error: syntax error, unexpected local label, expecting end of line or end of buffer or end of fragment literal
at local-after-end.asm(16)
error: syntax error, unexpected local label, expecting end of line or end of buffer or end of fragment literal
at local-after-end.asm(20)
error: Undefined macro `mac`
at local-after-end.asm(21)
FATAL: Ended block with 2 unterminated conditionals (`IF`/`ELIF`/`ELSE` blocks) FATAL: Ended block with 2 unterminated conditionals (`IF`/`ELIF`/`ELSE` blocks)
at local-after-end.asm(22) at local-after-end.asm(22)
-1
View File
@@ -1 +0,0 @@
yes