-USING: io io.streams.string io.streams.duplex listener
-tools.test parser math namespaces continuations vocabs kernel
-compiler.units eval vocabs.parser words definitions ;
+USING: compiler.units continuations definitions eval io
+io.streams.string kernel listener listener.private math namespaces
+parser parser.notes tools.test vocabs vocabs.parser words ;
IN: listener.tests
SYNTAX: hello "Hi" print ;
[ "call" "scratchpad" create-word drop ] with-compilation-unit
[
- [ t ]
+ { t }
[
"call" "scratchpad" lookup-word
[ "call" search ] with-interactive-vocabs
] with-file-vocabs
[ "call" "scratchpad" lookup-word forget ] with-compilation-unit
+
+[
+ { t } [
+ "[ ]" [
+ t parser-quiet? [
+ { } listener-step drop
+ parser-quiet? get
+ ] with-variable
+ ] with-string-reader
+ ] unit-test
+] with-file-vocabs
[ nl "--- Data stack:" title. trimmed-stack. ] unless-empty
] [ drop ] if ;
-:: (listener) ( datastack -- )
- parser-quiet? off
+:: listener-step ( datastack -- datastack' )
error-summary? get [ error-summary ] when
visible-vars.
datastack datastack.
[ call-error-hook datastack ]
[ rethrow ]
if
- ] recover
+ ] recover ;
- (listener) ;
+: (listener) ( datastack -- )
+ listener-step (listener) ;
PRIVATE>
] with-manifest ; inline
: listener ( -- )
- [ [ { } (listener) ] with-return ] with-interactive-vocabs ;
+ [
+ parser-quiet? off
+ [ { } (listener) ] with-return
+ ] with-interactive-vocabs ;
: listener-main ( -- )
version-info print flush listener ;