Fix REDEF EQUS behavior

Redefining an EQUS constant will now update its filename,
like redefining a SET/= constant.

Attempting to redefine as EQUS a non-EQUS constant will
print an appropriate error message.

This also standardizes on `sym` versus `symbol` as a
variable name (which pairs with `symName`).
This commit is contained in:
Rangi
2021-04-28 12:11:26 -04:00
parent d37aa93a7d
commit ee67f1039c
2 changed files with 51 additions and 48 deletions

View File

@@ -958,7 +958,7 @@ is used to define numerical constant symbols.
Unlike
.Ic SET
below, constants defined this way cannot be redefined.
They can, for example, be used for things such as bit definitions of hardware registers.
These constants can be used for unchanging values such as properties of the hardware.
.Bd -literal -offset indent
def SCREEN_WIDTH equ 160 ;\ In pixels
def SCREEN_HEIGHT equ 144
@@ -1075,7 +1075,7 @@ For example:
DEF s EQUS "Hello, "
REDEF s EQUS "{s}world!"
; prints "Hello, world!"
PRINTT "{s}\n"
PRINTLN "{s}\n"
.Ed
.Pp
.Sy Important note :