commit abbbc0201607c6189d54070f11a433cf9e7d808a
parent 04a6e274f9a7afb859cb55c50cb6bd2df12ca269
Author: Robby Findler <robby@racket-lang.org>
Date: Wed, 20 Mar 2013 21:31:19 -0500
add interaction/no-prompt and clarify that interaction-eval
doesn't catch errors
original commit: e5d91baa2c593f88f0510f61a3a0f65fe22ea7db
Diffstat:
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt
@@ -12,6 +12,7 @@
(provide interaction
interaction0
+ interaction/no-prompt
interaction-eval
interaction-eval-show
racketblock+eval (rename-out [racketblock+eval schemeblock+eval])
@@ -460,6 +461,12 @@
[(_ #:escape id (eval:alts a b)) (racketinput* #:escape id a)]
[(_ #:escape id e) (racketinput0 #:escape id e)]))
+(define-syntax racketblock*
+ (syntax-rules (eval:alts code:comment)
+ [(_ #:escape id (code:comment . rest)) (racketblock0 #:escape id (code:comment . rest))]
+ [(_ #:escape id (eval:alts a b)) (racketblock #:escape id a)]
+ [(_ #:escape id e) (racketblock0 #:escape id e)]))
+
(define-code racketblock0+line (to-paragraph/prefix "" "" (list " ")))
(define-syntax (racketdefinput* stx)
@@ -506,6 +513,12 @@
(syntax-case stx ()
[(H e ...) (syntax/loc stx (code-inset (-interaction H e ...)))]))
+(define-syntax (interaction/no-prompt stx)
+ (syntax-case stx ()
+ [(H e ...)
+ (syntax/loc stx
+ (code-inset (titled-interaction who #f #f racketblock* e ...)))]))
+
(define-syntax (interaction0 stx)
(syntax-case stx ()
[(H e ...) (syntax/loc stx (-interaction H e ...))]))
diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl
@@ -100,10 +100,14 @@ uses an evaluator whose language is @racketmodname[typed/racket/base].}
Like @racket[interaction], but without insetting the code via
@racket[nested].}
+@defform[(interaction/no-prompt maybe-eval maybe-escape datum)]{
+ Like @racket[interaction], but does not render the output with a prompt.
+}
+
@defform[(interaction-eval maybe-eval maybe-escape datum)]{
Like @racket[interaction], evaluates the @racket[quote]d form of
-@racket[datum], but returns the empty string.}
+@racket[datum], but returns the empty string and does not catch errors.}
@defform[(interaction-eval-show maybe-eval maybe-escape datum)]{