4.4 Racket
(require scribble/racket) | package: scribble-lib |
(require scribble/scheme) |
syntax
(define-code id typeset-expr)
(define-code id typeset-expr uncode-id) (define-code id typeset-expr uncode-id d->s-expr) (define-code id typeset-expr uncode-id d->s-expr stx-prop-expr)
The supplied typeset-expr expression should produce a procedure that performs the actual typesetting. This expression is normally to-element or to-paragraph. The argument supplied to typeset-expr is normally a syntax object, but more generally it is the result of applying d->s-expr.
The optional uncode-id specifies the default escape from literal code to be recognized by id, and the default for uncode-id is unsyntax. A use of the id form can specify an alternate escape via #:escape, as in racketblock and racket.
The optional d->s-expr should produce a procedure that accepts three arguments suitable for datum->syntax: a syntax object or #f, an arbitrary value, and a vector for a source location. The result should record as much or as little of the argument information as needed by typeset-expr to typeset the code. Normally, d->s-expr is datum->syntax.
The stx-prop-expr should produce a procedure for recording a 'paren-shape property when the source expression uses with id has such a property. The default is syntax-property.
procedure
(to-paragraph v [ #:expr? expr? #:escapes? escapes? #:color? color? #:wrap-elem wrap-elem]) → block? v : any/c expr? : any/c = #f escapes? : any/c = #t color? : any/c = #t wrap-elem : (element? . -> . element?) = (lambda (e) e)
Identifiers that have for-label bindings are typeset and hyperlinked based on definitions declared elsewhere (via defproc, defform, etc.). Unless escapes? is #f, the identifiers code:line, code:comment, code:blank, code:hilite, and code:quote are handled as in racketblock, as are identifiers that start with _.
In addition, the given v can contain var-id, shaped-parens, just-context, or literal-syntax structures to be typeset specially (see each structure type for details), or it can contain element structures that are used directly in the output.
If expr? is true, then v is rendered in expression style, much like print with the print-as-expression parameter set to #t. In that case, for-label bindings on identifiers are ignored, since the identifiers are all quoted in the output. Typically, expr? is set to true for printing result values.
If color? is #f, then the output is typeset without coloring.
The wrap-elem procedure is applied to each element constructed for the resulting block. When combined with #f for color?, for example, the wrap-elem procedure can be used to give a style to an element.
procedure
((to-paragraph/prefix prefix1 prefix suffix) v [ #:expr? expr? #:escapes? escapes? #:color? color? #:wrap-elem wrap-elem]) → block? prefix1 : any/c prefix : any/c suffix : any/c v : any/c expr? : any/c = #f escapes? : any/c = #t color? : any/c = #f wrap-elem : (element? . -> . element?) = (lambda (e) e)
procedure
(to-element v [ #:expr? expr? #:escapes? escapes? #:defn? defn?]) → element? v : any/c expr? : any/c = #f escapes? : any/c = #t defn? : any/c = #f
procedure
(to-element/no-color v [ #:expr? expr? #:escapes? escapes?]) → element? v : any/c expr? : any/c = #f escapes? : any/c = #t
struct
(struct var-id (sym) #:extra-constructor-name make-var-id) sym : (or/c symbol? identifier?)
struct
(struct shaped-parens (val shape) #:extra-constructor-name make-shaped-parens) val : any/c shape : char?
struct
(struct long-boolean (val) #:extra-constructor-name make-long-boolean) val : boolean?
struct
(struct just-context (val context) #:extra-constructor-name make-just-context) val : any/c context : syntax?
struct
(struct literal-syntax (stx) #:extra-constructor-name make-literal-syntax) stx : any/c
procedure
v : any/c
procedure
(make-element-id-transformer proc) → element-id-transformer?
proc : (syntax? . -> . syntax?)
procedure
(variable-id? v) → boolean?
v : any/c
procedure
(make-variable-id sym) → variable-id?
sym : (or/c symbol? identifier?)
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value