Disable EQUS expansion for raw symbols (by parsing them as strings) (#1648)

This commit is contained in:
Rangi
2025-02-15 10:44:51 +01:00
committed by GitHub
parent 3feb75f84f
commit b2e865ee2a
8 changed files with 206 additions and 17 deletions

View File

@@ -1125,7 +1125,9 @@ Additionally, label names can contain up to a single dot
.Ql \&. ,
which may not be the first character.
.Pp
A symbol cannot have the same name as a reserved keyword, unless it is prefixed by a hash
A symbol cannot have the same name as a reserved keyword, unless its name is a
.Dq raw identifier
prefixed by a hash
.Sq # .
For example,
.Ql #load
@@ -1300,7 +1302,7 @@ it at the same time.
below).
.Ss Numeric constants
.Ic EQU
is used to define immutable numeric symbols.
is used to define numeric constant symbols.
Unlike
.Sq =
above, constants defined this way cannot be redefined.
@@ -1408,6 +1410,8 @@ This expansion is disabled in a few contexts:
and
.Ql MACRO name
will not expand string constants in their names.
Expansion is also disabled if the string constant's name is a raw identifier prefixed by a hash
.Sq # .
.Bd -literal -offset indent
DEF COUNTREG EQUS "[hl+]"
ld a, COUNTREG
@@ -1873,7 +1877,7 @@ being the second, and so on. Since there are only nine digits, you can only use
To use the rest, you put the argument number in angle brackets, like
.Ic \e<10> .
.Pp
This bracketed syntax supports decimal numbers and numeric constant symbols.
This bracketed syntax supports decimal numbers and numeric symbols.
For example,
.Ql \e<_NARG>
will get the last argument.