diff --git a/etc/asma-test.sh b/etc/asma-test.sh index 0d33f21..51f7ac5 100755 --- a/etc/asma-test.sh +++ b/etc/asma-test.sh @@ -62,6 +62,11 @@ expect_failure 'Memory overwrite: SUB' <<'EOD' |2000 ADD |1000 SUB EOD +expect_failure 'Recursion level too deep:' <<'EOD' +%me { you } +%you { me } +|1000 me +EOD echo 'All OK' diff --git a/projects/library/asma.tal b/projects/library/asma.tal index 19584cc..d75edde 100644 --- a/projects/library/asma.tal +++ b/projects/library/asma.tal @@ -759,9 +759,8 @@ include projects/library/heap.tal ( hex short ) ,asma-short-helper/raw JMP ¬-hex - ;asma-trees/macros ;asma-traverse-tree JSR2 ,¬-macro JCN - .System/rst DEI #e0 GTH ,&too-deep JCN + ;asma-trees/macros ;asma-traverse-tree JSR2 ,¬-macro JCN ¯o-loop LDAk ,&keep-going JCN @@ -770,9 +769,13 @@ include projects/library/heap.tal &keep-going DUP2k ;strlen JSR2 INC2 ADD2 - SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,&error JCN + SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,¯o-error JCN ,¯o-loop JMP + ¯o-error + POP2 + JMP2r + ¬-macro POP2 ;&include-string ;asma/token LDA2 @@ -782,11 +785,9 @@ include projects/library/heap.tal ¬-include ;asma-msg-label ;asma/error STA2 - &error JMP2r &too-deep - POP2 ;asma-msg-too-deep ;asma/error STA2 JMP2r @@ -808,7 +809,7 @@ include projects/library/heap.tal @asma-msg-label "Label 20 "not 20 "found 00 @asma-msg-macro "Macro 20 "already 20 "exists 00 @asma-msg-rewound "Memory 20 "overwrite 00 -@asma-msg-too-deep "Macro 20 "expansion 20 "level 20 "too 20 "deep 00 +@asma-msg-too-deep "Recursion 20 "level 20 "too 20 "deep 00 ( trees )