]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/lisp/listener/listener.factor
Fix Windows bootstrap
[factor.git] / unmaintained / lisp / listener / listener.factor
1
2 USING: kernel parser namespaces io prettyprint math arrays sequences
3        words listener debugger
4        lisp lisp.lexer lisp.parser.mod lisp.listener.mod ;
5
6 IN: lisp.listener
7
8 : parse-stdio ( -- quot/f ) stdio get read-quot ;
9
10 : stuff? ( -- ? ) datastack length 0 > ;
11
12 : lisp-listen ( -- )
13 [ parse-stdio [ call stuff? [ eval ] when ] [ bye ] if* ] try ;
14
15 : until-quit ( -- )
16 quit-flag get
17 [ quit-flag off ]
18 [ listener-hook get call prompt. lisp-listen until-quit ]
19 if ;
20
21 : lisp-listener ( -- ) [
22 use [ clone ] change
23 [ <sexp-lexer> ] >listener-lexer
24 [ in get create dup define-symbol ] >new-symbol-action
25 { "lisp" "lisp.syntax" } add-use
26 ! [ listener-hook get call prompt. lisp-listen ] until-quit
27 until-quit
28 ] with-scope ;