From 5e81f59359e7d99789e1cfd66caecbaa8a3a47f2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 11 Mar 2008 21:59:41 -0500 Subject: [PATCH] walk now wraps the whole thing in a recover with a breakpoint so you can step back from an error --- extra/tools/walker/walker.factor | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/extra/tools/walker/walker.factor b/extra/tools/walker/walker.factor index 1b37673c38..e86cee0c47 100755 --- a/extra/tools/walker/walker.factor +++ b/extra/tools/walker/walker.factor @@ -32,14 +32,17 @@ SYMBOL: walking-thread \ break t "break?" set-word-prop +: walk ( quot -- quot' ) + \ break add* [ break rethrow ] recover ; + : add-breakpoint ( quot -- quot' ) dup [ break ] head? [ \ break add* ] unless ; -: walk ( quot -- ) add-breakpoint call ; +: (step-into-quot) ( quot -- ) add-breakpoint call ; -: (step-into-if) ? walk ; +: (step-into-if) ? (step-into-quot) ; -: (step-into-dispatch) nth walk ; +: (step-into-dispatch) nth (step-into-quot) ; : (step-into-execute) ( word -- ) dup "step-into" word-prop [ @@ -48,7 +51,7 @@ SYMBOL: walking-thread dup primitive? [ execute break ] [ - word-def walk + word-def (step-into-quot) ] if ] ?if ; @@ -104,8 +107,8 @@ SYMBOL: +detached+ [ nip \ break add ] change-frame ; { - { call [ walk ] } - { (throw) [ drop walk ] } + { call [ (step-into-quot) ] } + { (throw) [ drop (step-into-quot) ] } { execute [ (step-into-execute) ] } { if [ (step-into-if) ] } { dispatch [ (step-into-dispatch) ] }