ref: dafef5a953f2ad7c21c8662f1764057fcffc6d96
parent: 929e2a44901092fc7a7aad2bf767da5aa9b7d618
author: Eldred Habert <eldredhabert0@gmail.com>
date: Tue Feb 23 15:42:24 EST 2021
Remove column 1 restriction for labels with colons (#635) Partial fix for #457
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -2026,7 +2026,7 @@
}
}
- if (tokenType == T_ID && lexerState->atLineStart)
+ if (tokenType == T_ID && (lexerState->atLineStart || peek(0) == ':'))
return T_LABEL;
return tokenType;
--- /dev/null
+++ b/test/asm/label-indent.asm
@@ -1,0 +1,30 @@
+
+SECTION "Label testing", WRAMX
+
+ Lab:
+ .loc
+ Lab.loc2
+
+; X = 0
+; ; Should not believe X is a label!
+; IF X == 1
+; FAIL "Wrong!"
+; ENDC
+; X \
+; = 1
+; IF X != 1
+; FAIL "Wrong!"
+; ENDC
+;
+; Y equ 42
+; PRINTT "Y={Y}\n"
+; PURGE Y
+;
+; Y equs "mac"
+; mac: MACRO
+; PRINTT "\1\n"
+; ENDM
+; ; Should invoke macro Y, and not match "equ" due to the "a" behind it
+; Y equates 69
+; Y equsquisite (isn't that English?)
+; Y eq
--- a/test/link/all-instructions.asm
+++ b/test/link/all-instructions.asm
@@ -2,7 +2,7 @@
; 8-bit Arithmetic and Logic Instructions
-alu_instruction_list : MACRO
+alu_instruction_list: MACRO
\1 a,a
\1 a,b
\1 a,c
@@ -23,7 +23,7 @@
alu_instruction_list sub
alu_instruction_list xor
-incdec_8bit_instruction_list : MACRO
+incdec_8bit_instruction_list: MACRO
\1 a
\1 b
\1 c
@@ -56,7 +56,7 @@
; Bit Operations Instructions
-bitop_u3_instruction_list : MACRO
+bitop_u3_instruction_list: MACRO
NBIT SET 0
REPT 8
\1 NBIT,a
@@ -75,7 +75,7 @@
bitop_u3_instruction_list res
bitop_u3_instruction_list set
-bitop_noarg_instruction_list : MACRO
+bitop_noarg_instruction_list: MACRO
\1 a
\1 b
\1 c
@@ -105,7 +105,7 @@
; Load Instructions
-ld_r8_x_instruction_list : MACRO
+ld_r8_x_instruction_list: MACRO
ld \1,a
ld \1,b
ld \1,c
@@ -125,7 +125,7 @@
ld_r8_x_instruction_list [hl]
ld_r8_x_instruction_list l
-ld_x_r8_instruction_list : MACRO
+ld_x_r8_instruction_list: MACRO
ld a,\1
ld b,\1
ld c,\1