]> gitweb.factorcode.org Git - factor.git/blob - basis/eval/eval.factor
Merge branch 'irc' of git://www.tiodante.com/git/factor
[factor.git] / basis / eval / eval.factor
1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: splitting parser parser.notes compiler.units kernel namespaces
4 debugger io.streams.string fry combinators effects.parser ;
5 IN: eval
6
7 : parse-string ( str -- quot )
8     [ string-lines parse-lines ] with-compilation-unit ;
9
10 : (eval) ( str effect -- )
11     [ parse-string ] dip call-effect ; inline
12
13 : eval ( str effect -- )
14     [ (eval) ] with-file-vocabs ; inline
15
16 SYNTAX: eval( \ eval parse-call( ;
17
18 : (eval>string) ( str -- output )
19     [
20         "quiet" on
21         parser-notes off
22         '[ _ (( -- )) (eval) ] try
23     ] with-string-writer ;
24
25 : eval>string ( str -- output )
26     [ (eval>string) ] with-file-vocabs ;