]> gitweb.factorcode.org Git - factor.git/commitdiff
eval: separate eval-with-stack and eval-with-stack>string
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 4 Feb 2022 23:24:19 +0000 (15:24 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 4 Feb 2022 23:24:19 +0000 (15:24 -0800)
these might need better names?

basis/command-line/startup/startup.factor
basis/eval/eval.factor
basis/help/lint/checks/checks.factor

index 67de6583d8d9cb0113f3b83a80e2ff858c4844b1..dea500418a15ebd2c6038bf1f7f86013e5d15d7c 100644 (file)
@@ -44,12 +44,7 @@ from within Factor for more information.
 
 : run-script ( file -- )
     t parser-quiet? [
-        [
-            parse-file [
-                output>array
-                [ nl "--- Data stack:" print stack. ] unless-empty
-            ] call( quot --  )
-        ]
+        [ parse-file [ output>array datastack. ] call( quot --  ) ]
         [ path>source-file main>> [ execute( -- ) ] when* ] bi
     ] with-variable ;
 
@@ -62,7 +57,7 @@ from within Factor for more information.
             run-user-init
             "e" get script get or [
                 t auto-use? [
-                    "e" get [ eval-with-stack print ] when*
+                    "e" get [ eval-with-stack ] when*
                     script get [ run-script ] when*
                 ] with-variable
             ] [
index 9f3d8f138823c323342dde819b7db99a554e0fe3..9256454863edf55913a0e487c3cee34b0e4291f3 100644 (file)
@@ -26,16 +26,17 @@ SYNTAX: eval( \ eval parse-call-paren ;
 : eval>string ( str -- output )
     [ (eval>string) ] with-file-vocabs ;
 
-: (eval-with-stack) ( str -- output )
+: (eval-with-stack) ( str -- )
+    parse-string [ output>array datastack. ] call( quot -- ) ;
+
+: eval-with-stack ( str -- )
+    [ (eval-with-stack) ] with-file-vocabs ;
+
+: (eval-with-stack>string) ( str -- output )
     [
-        [
-            parser-quiet? on parse-string [
-                output>array [
-                    nl "--- Data stack:" print stack.
-                ] unless-empty
-            ] call( quot -- )
-        ] [ nip print-error ] recover
+        parser-quiet? on
+        [ eval-with-stack ] [ nip print-error ] recover
     ] with-string-writer ;
 
-: eval-with-stack ( str -- output )
-    [ (eval-with-stack) ] with-file-vocabs ;
+: eval-with-stack>string ( str -- output )
+    [ (eval-with-stack>string) ] with-file-vocabs ;
index 42f657819d43f9037cee3dc32a8f34ab7746356f..6c994e01012baebb3f1209db5b80aae79d7078e4 100644 (file)
@@ -40,7 +40,7 @@ SYMBOL: vocab-articles
         '[
             _ rest [
                 but-last join-lines
-                eval-with-stack
+                (eval-with-stack>string)
                 "\n" ?tail drop
             ] keep
             last assert=