Closed DBJ314 closed 5 years ago
So it interprets the 999:
as a valid label and therefore MOV B, 999
will use 999 as a label for a memory adress?
999 is a valid label, but MOV B, 999
just does 999. DW 999
, on the other hand, resolves to the address of 999.
Right. What would be a valid label regex? Would an identifier be sufficient? ^[a-zA-Z_][a-zA-Z0-9_]+:
?
I think ^[a-zA-Z_]\w*:
. \w
is a convenient shortcut for [a-zA-Z0-9_]
The current regex used for parsing labels,
^\\s*\\b\\w*\\b:
, allows labels to consist entirely of numeric characters. The DW directive trys to treat an operand as a label before seeing if it is a number, but the instruction parsing does it the other way around. You can use numbers as labels in DW directives, but not in instructions.