! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel prettyprint io io.styles colors.constants compiler.units
-fry debugger sequences locals.rewrite.closures smalltalk.ast
-smalltalk.parser smalltalk.compiler smalltalk.printer ;
+USING: colors debugger io io.styles kernel smalltalk.ast
+smalltalk.eval smalltalk.printer ;
IN: smalltalk.listener
-: eval-smalltalk ( string -- )
- [
- parse-smalltalk compile-smalltalk
- ] with-compilation-unit call( -- result )
- dup nil? [ drop ] [ "Result: " write smalltalk>string print ] if ;
+: eval-interactively ( string -- )
+ '[
+ _ eval-smalltalk
+ dup nil? [ drop ] [ "Result: " write smalltalk>string print ] if
+ ] try ;
: smalltalk-listener ( -- )
"Smalltalk>" { { background COLOR: light-blue } } format bl flush readln
- [ '[ _ eval-smalltalk ] try smalltalk-listener ] when* ;
+ [ eval-interactively smalltalk-listener ] when* ;
-MAIN: smalltalk-listener
\ No newline at end of file
+MAIN: smalltalk-listener