uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 26b90ac69cc0c423d96d99c626d9690edea85b87
parent 3967d27173bcb638ea974a94a49f8f1e1ff64cc1
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Thu,  7 Oct 2021 23:26:39 +0100

Added detection of recursive include errors.

Diffstat:
Metc/asma-test.sh | 5+++++
Mprojects/library/asma.tal | 13+++++++------
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git 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 @@ -759,9 +759,8 @@ include projects/library/heap.tal ( hex short ) ,asma-short-helper/raw JMP &not-hex - ;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-macro JCN - .System/rst DEI #e0 GTH ,&too-deep JCN + ;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-macro JCN &macro-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 ,&macro-error JCN ,&macro-loop JMP + &macro-error + POP2 + JMP2r + &not-macro POP2 ;&include-string ;asma/token LDA2 @@ -782,11 +785,9 @@ include projects/library/heap.tal &not-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 )