]> gitweb.factorcode.org Git - factor.git/commitdiff
debugger: Add support for command line debugger.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 30 Dec 2021 17:09:11 +0000 (11:09 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 30 Dec 2021 17:09:11 +0000 (11:09 -0600)
s/no-op-action/no-op-restart/ and move to continuations

basis/debugger/debugger.factor
basis/fixups/fixups.factor
basis/ui/tools/debugger/debugger.factor
core/continuations/continuations.factor

index adadb7cb06a85fae9d34fa7b28596bc2de272b15..ad70b533512b3cfd1263e809d134030c4f4ab86f 100644 (file)
@@ -4,7 +4,7 @@ USING: accessors alien alien.strings arrays assocs classes
 classes.builtin classes.mixin classes.tuple classes.tuple.parser
 combinators combinators.short-circuit compiler.errors
 compiler.units continuations definitions destructors
-effects.parser fry generic generic.math generic.parser
+effects.parser fixups fry generic generic.math generic.parser
 generic.single grouping io io.encodings io.styles kernel
 kernel.private lexer libc make math math.order math.parser
 math.ratios namespaces parser prettyprint sequences
@@ -43,7 +43,9 @@ M: string error. print ;
     error-continuation get name>> assoc-stack ;
 
 : :res ( n -- * )
-    1 - restarts [ nth f ] change-global continue-restart ;
+    1 - restarts [ nth f ] change-global
+    [ dup no-op-restart = [ drop f ] when ] change-obj
+    continue-restart ;
 
 : :1 ( -- * ) 1 :res ;
 : :2 ( -- * ) 2 :res ;
@@ -350,7 +352,7 @@ M: lexer-error summary
     error>> summary ;
 
 M: lexer-error compute-restarts
-    error>> compute-restarts ;
+    [ error-continuation get swap compute-fixups ] [ error>> compute-restarts ] bi append ;
 
 M: lexer-error error-help
     error>> error-help ;
index 4b4f6420cb4aeac2ad056475cf25eb11d3d25c13..7ef97d84f448464f14bbc9b0be57e61790fc682d 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2021 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs continuations formatting kernel
-sequences ui.tools.debugger vocabs vocabs.parser ;
+sequences vocabs vocabs.parser ;
 IN: fixups
 
 CONSTANT: vocab-renames {
@@ -43,7 +43,7 @@ CONSTANT: word-renames {
     ] [
         swap '[
             first2 dupd first2 "Fixup: %s renamed to %s in Factor %s" sprintf
-            swap drop no-op-action
+            swap drop no-op-restart
             _ <restart>
         ] map
     ] if-empty ;
index 7d2a70f8ba7142f329b35a2d4a87f46d65151cfc..0b2b5e5a6c8985fcafca09f5f74b3a4c0a294c38 100644 (file)
@@ -15,10 +15,6 @@ IN: ui.tools.debugger
 
 TUPLE: debugger < track error restarts restart-hook restart-list continuation ;
 
-! The "Abort" restart is actually an `f` object, so to show a restart
-! with information but do nothing, we define a no-op-action
-SINGLETON: no-op-action
-
 <PRIVATE
 
 SINGLETON: restart-renderer
@@ -30,7 +26,9 @@ M: restart-renderer row-columns
     dup restarts>> f prefix <model> restart-renderer <table>
         [
             [
-                dup obj>> no-op-action =
+                ! The "Abort" restart is actually an `f` object, so to show a restart
+                ! with information but do nothing, we define a no-op-restart
+                dup obj>> no-op-restart =
                 [ drop ] [ \ continue-restart invoke-command ] if
             ] when*
         ] >>action
index 12bb976a0aeeb7a41ec12322bb1ea938540ce6b0..7cc989e27ab04d5a09b46fa652f0d7c0cd91a22d 100644 (file)
@@ -17,6 +17,8 @@ SYMBOL: error-continuation
 SYMBOL: error-thread
 SYMBOL: restarts
 
+SINGLETON: no-op-restart
+
 <PRIVATE
 
 : (get-catchstack) ( -- catchstack )