listener: only call parser-quiet? off when listener starts

it probably shouldn't be called on every input loop because then if you
set parser-quiet? to t, the setting will be undone
db4
Björn Lindqvist 2015-10-05 17:04:36 +02:00
parent 0f387e750d
commit 2f4c8ee07a
2 changed files with 23 additions and 9 deletions

View File

@ -1,6 +1,6 @@
USING: io io.streams.string io.streams.duplex listener USING: compiler.units continuations definitions eval io
tools.test parser math namespaces continuations vocabs kernel io.streams.string kernel listener listener.private math namespaces
compiler.units eval vocabs.parser words definitions ; parser parser.notes tools.test vocabs vocabs.parser words ;
IN: listener.tests IN: listener.tests
SYNTAX: hello "Hi" print ; SYNTAX: hello "Hi" print ;
@ -56,7 +56,7 @@ SYNTAX: hello "Hi" print ;
[ "call" "scratchpad" create-word drop ] with-compilation-unit [ "call" "scratchpad" create-word drop ] with-compilation-unit
[ [
[ t ] { t }
[ [
"call" "scratchpad" lookup-word "call" "scratchpad" lookup-word
[ "call" search ] with-interactive-vocabs [ "call" search ] with-interactive-vocabs
@ -65,3 +65,14 @@ SYNTAX: hello "Hi" print ;
] with-file-vocabs ] with-file-vocabs
[ "call" "scratchpad" lookup-word forget ] with-compilation-unit [ "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

View File

@ -108,8 +108,7 @@ t error-summary? set-global
[ nl "--- Data stack:" title. trimmed-stack. ] unless-empty [ nl "--- Data stack:" title. trimmed-stack. ] unless-empty
] [ drop ] if ; ] [ drop ] if ;
:: (listener) ( datastack -- ) :: listener-step ( datastack -- datastack' )
parser-quiet? off
error-summary? get [ error-summary ] when error-summary? get [ error-summary ] when
visible-vars. visible-vars.
datastack datastack. datastack datastack.
@ -126,9 +125,10 @@ t error-summary? set-global
[ call-error-hook datastack ] [ call-error-hook datastack ]
[ rethrow ] [ rethrow ]
if if
] recover ] recover ;
(listener) ; : (listener) ( datastack -- )
listener-step (listener) ;
PRIVATE> PRIVATE>
@ -209,7 +209,10 @@ SYMBOL: interactive-vocabs
] with-manifest ; inline ] with-manifest ; inline
: listener ( -- ) : listener ( -- )
[ [ { } (listener) ] with-return ] with-interactive-vocabs ; [
parser-quiet? off
[ { } (listener) ] with-return
] with-interactive-vocabs ;
: listener-main ( -- ) : listener-main ( -- )
version-info print flush listener ; version-info print flush listener ;