]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/eval/eval.factor
basis: use lint.vocabs tool to trim using lists
[factor.git] / basis / eval / eval.factor
index 9f3d8f138823c323342dde819b7db99a554e0fe3..a4efaa366f6a3782d6c89a815b64175e2780c3f6 100644 (file)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators combinators.smart compiler.units
-continuations debugger effects.parser io io.streams.string
-kernel namespaces parser parser.notes prettyprint sequences
-splitting ;
+continuations debugger effects.parser io.streams.string
+kernel namespaces parser parser.notes prettyprint splitting ;
 IN: eval
 
 : parse-string ( str -- quot )
@@ -26,16 +25,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 ;