Implement EXPORT DEF to define and export symbols (#1422)

This commit is contained in:
Sylvie
2024-07-25 17:40:58 -04:00
committed by GitHub
parent 13a8895fca
commit 92abe24894
5 changed files with 103 additions and 20 deletions

View File

@@ -3,7 +3,7 @@ error: anon-label-bad.asm(2):
error: anon-label-bad.asm(6):
Reference to anonymous label 2 before, when only 1 has been created so far
error: anon-label-bad.asm(9):
syntax error, unexpected anonymous label, expecting label or identifier or local identifier
syntax error, unexpected anonymous label
error: anon-label-bad.asm(10):
syntax error, unexpected anonymous label, expecting label or identifier or local identifier
error: anon-label-bad.asm(22):

18
test/asm/export.asm Normal file
View File

@@ -0,0 +1,18 @@
EXPORT undefined
DEF equ_sym EQU 1
DEF var_sym = 2
EXPORT equ_sym, var_sym
EXPORT DEF constant EQU 42
EXPORT DEF variable = 1337
EXPORT DEF byte RB
EXPORT DEF word RW
EXPORT DEF long RL
EXPORT REDEF constant EQU 69
EXPORT REDEF variable = 1234
; String constants can't be exported or imported.
DEF equs_sym EQUS "hello"
EXPORT equs_sym ; exports undefined symbol `hello` due to EQUS expansion
EXPORT DEF string EQUS "goodbye" ; invalid syntax

3
test/asm/export.err Normal file
View File

@@ -0,0 +1,3 @@
error: export.asm(18):
syntax error, unexpected EQUS
error: Assembly aborted (1 error)!