M src/drifblim.tal => src/drifblim.tal +16 -6
@@ 205,9 205,12 @@
@lib/macros ( t* -- )
INC2
( | validate )
- is-hex ?&invalid-macro
- is-opcode ?&invalid-macro
- is-runic ?&invalid-macro
+ is-hex ?¯o-invalid
+ is-opcode ?¯o-invalid
+ is-runic ?¯o-invalid
+ DUP2 syms/find INC2 ORA ?¯o-duplicate
+ DUP2 macros/find INC2 ORA ?¯o-duplicate
+ ( | record )
macros/<push-string>
#20 ;macros/last STA
( walk to macro start )
@@ 220,10 223,14 @@
EQU ?{ !&>sb } }
#00 !macros/<push-byte>
- &invalid-macro ( t* -- )
+ ¯o-invalid ( t* -- )
POP2
( ! ) ;token ;err/macro !<set-error>
+ ¯o-duplicate ( t* -- )
+ POP2
+ ( ! ) ;token ;err/duplicate !<set-error>
+
(
@|Lambda )
@@ 297,6 304,7 @@
NIP2 JMP2r
@syms/<create> ( name* -- )
+ DUP2 macros/find INC2 ORA ?&duplicate
DUP2 /find INC2k ORA ?{
( alloc ) POP2 .SymType/declared rom/get-head !/<push> }
( | name* sym* -- )
@@ 304,8 312,10 @@
( addr* ) rom/get-head OVR2 STA2
( type ) INC2 INC2 LDAk .SymType/declared ORA ROT ROT STA
( name* ) POP2 JMP2r }
- POP2 POP2
- ( ! ) ;token ;err/duplicate !<set-error-scope>
+ POP2
+ &duplicate ( name* -- )
+ POP2
+ ( ! ) ;token ;err/duplicate !<set-error>
@syms/get-bounds ( -- to* from* )
,&ptr LDR2 ;&mem JMP2r
M tests.sh => tests.sh +13 -1
@@ 24,7 24,11 @@ $asm "tests/err-file.tal" "bin/res.rom"
echo ""
echo "Label duplicate: &sub"
-$asm "tests/err-dup.tal" "bin/res.rom"
+$asm "tests/err-dup1.tal" "bin/res.rom"
+
+echo ""
+echo "Label duplicate: @TEST"
+$asm "tests/err-dup2.tal" "bin/res.rom"
echo ""
echo "Label invalid: @1234"
@@ 74,5 78,13 @@ echo ""
echo "Macro invalid: %ADD"
$asm "tests/err-macro.tal" "bin/res.rom"
+echo ""
+echo "Label duplicate: %TEST"
+$asm "tests/err-macrodup1.tal" "bin/res.rom"
+
+echo ""
+echo "Label duplicate: %TEST"
+$asm "tests/err-macrodup2.tal" "bin/res.rom"
+
R tests/err-dup.tal => tests/err-dup1.tal +0 -0
A tests/err-dup2.tal => tests/err-dup2.tal +6 -0
@@ 0,0 1,6 @@
+
+%TEST { #1234 }
+
+@TEST ( -- ) #1234
+
+
A tests/err-macrodup1.tal => tests/err-macrodup1.tal +3 -0
@@ 0,0 1,3 @@
+
+%TEST { #1234 }
+%TEST { #1234 }
A tests/err-macrodup2.tal => tests/err-macrodup2.tal +4 -0
@@ 0,0 1,4 @@
+
+@TEST ( -- ) #1234
+
+%TEST { #1234 }