Browse code

Fixed uncontrolled expansion of recursive macros in asma

Andrew Alderwick authored on 04/06/2021 07:25:31
Showing 1 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 ( devices )
2 2
 
3
+|00 @System     [ &vector $2 &wst      $1 &rst    $1 &pad   $4 &r      $2 &g     $2 &b      $2 ]
3 4
 |10 @Console    [ &pad    $8 &char     $1 &byte   $1 &short $2 &string $2 ]
4 5
 |a0 @File       [ &vector $2 &success  $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2 ]
5 6
 
... ...
@@ -818,9 +819,10 @@
818 819
 	&not-hex
819 820
 	;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-macro JCN
820 821
 
822
+	.System/rst DEI #e0 GTH ,&too-deep JCN
823
+
821 824
 	&macro-loop
822 825
 	LDAk ,&keep-going JCN
823
-	&error
824 826
 	POP2
825 827
 	JMP2r
826 828
 
... ...
@@ -830,9 +832,14 @@
830 832
 	,&macro-loop JMP
831 833
 
832 834
 	&not-macro
835
+	;asma-msg-label ;asma/error STA2
836
+	&error
833 837
 	POP2
838
+	JMP2r
834 839
 
835
-	;asma-msg-label ;asma/error STA2
840
+	&too-deep
841
+	;asma-msg-too-deep ;asma/error STA2
842
+	POP2
836 843
 	JMP2r
837 844
 
838 845
 ( Error messages )
... ...
@@ -843,6 +850,7 @@
843 850
 @asma-msg-label     "Label 20 "not 20 "found 00
844 851
 @asma-msg-macro     "Macro 20 "already 20 "exists 00
845 852
 @asma-msg-rewound   "Memory 20 "overwrite 00
853
+@asma-msg-too-deep  "Macro 20 "expansion 20 "level 20 "too 20 "deep 00
846 854
 
847 855
 ( trees )
848 856