Add test for labels when expecting symbols

This commit is contained in:
Rangi42
2025-07-14 00:10:14 -04:00
parent 80df858ee3
commit 35335aadbe
3 changed files with 23 additions and 1 deletions

View File

@@ -1976,7 +1976,7 @@ static Token yylex_NORMAL() {
} }
} }
// We need it to distinguish between label definitions (which start with `LABEL`) and // We need to distinguish between label definitions (which start with `LABEL`) and
// macro invocations (which start with `SYMBOL`). // macro invocations (which start with `SYMBOL`).
// //
// If we had one `IDENTIFIER` token, the parser would need to perform "lookahead" to // If we had one `IDENTIFIER` token, the parser would need to perform "lookahead" to

9
test/asm/lex-label.asm Normal file
View File

@@ -0,0 +1,9 @@
def var: equ 42
macro mac:
endm
for idx:, 10
endr
newcharmap french:

13
test/asm/lex-label.err Normal file
View File

@@ -0,0 +1,13 @@
error: lex-label.asm(1):
syntax error, unexpected label, expecting symbol
error: lex-label.asm(3):
syntax error, unexpected label, expecting symbol
error: lex-label.asm(4):
syntax error, unexpected ENDM
error: lex-label.asm(6):
syntax error, unexpected label, expecting symbol
error: lex-label.asm(7):
syntax error, unexpected ENDR
error: lex-label.asm(9):
syntax error, unexpected label, expecting symbol
Assembly aborted with 6 errors!