remove unneeded dependency of framework on parts of Scribble; Redex doc repairs; add #:style? argument to deftech

svn: r13696
This commit is contained in:
Matthew Flatt 2009-02-17 15:22:55 +00:00
parent e0e6fcb465
commit 941a8935aa
4 changed files with 38 additions and 39 deletions

View File

@ -21,11 +21,7 @@ WARNING: printf is rebound in the body of the unit to always
(prefix-in srfi1: srfi/1)) (prefix-in srfi1: srfi/1))
(require setup/xref (require setup/xref
scribble/xref scribble/xref
scribble/struct scribble/manual-struct)
scribble/manual-struct
scribble/decode
scribble/basic
(prefix-in s/m: scribble/manual))
(import mred^ (import mred^
[prefix icon: framework:icon^] [prefix icon: framework:icon^]

View File

@ -16,7 +16,7 @@
[(_ arg) [(_ arg)
(identifier? #'arg) (identifier? #'arg)
(let ([as (symbol->string (syntax-e #'arg))]) (let ([as (symbol->string (syntax-e #'arg))])
#`(index '("Redex Pattern" #,as) (deftech #,as)))])) #`(index '("Redex Pattern" #,as) (deftech #:style? #f @scheme[arg])))]))
@(define-syntax (pattech stx) @(define-syntax (pattech stx)
(syntax-case stx () (syntax-case stx ()
@ -27,8 +27,8 @@
@(define-syntax (ttpattern stx) @(define-syntax (ttpattern stx)
(syntax-case stx () (syntax-case stx ()
[(_ args ...) [(_ args ...)
#'((tech (tt "pattern")) args ...)] #'((tech (schemevarfont "pattern")) args ...)]
[x (identifier? #'x) #'(tech (tt "pattern"))])) [x (identifier? #'x) #'(tech (schemevarfont "pattern"))]))
@(define-syntax (pattern stx) @(define-syntax (pattern stx)
(syntax-case stx () (syntax-case stx ()
@ -39,8 +39,8 @@
@(define-syntax (tttterm stx) @(define-syntax (tttterm stx)
(syntax-case stx () (syntax-case stx ()
[(_ args ...) [(_ args ...)
#'((tech (tt "term")) args ...)] #'((tech (schemevarfont "term")) args ...)]
[x (identifier? #'x) #'(tech (tt "term"))])) [x (identifier? #'x) #'(tech (schemevarfont "term"))]))
@(define-syntax (tterm stx) @(define-syntax (tterm stx)
(syntax-case stx () (syntax-case stx ()
@ -372,7 +372,7 @@ the visible representation of terms.
The grammar of @deftech{term}s is (note that an ellipsis The grammar of @deftech{term}s is (note that an ellipsis
stands for repetition unless otherwise indicated): stands for repetition unless otherwise indicated):
@(schemegrammar* #:literals (in-hole hole) @(schemegrammar* #:literals (in-hole hole unquote unquote-splicing)
[term identifier [term identifier
(term-sequence ...) (term-sequence ...)
,scheme-expression ,scheme-expression
@ -387,28 +387,28 @@ stands for repetition unless otherwise indicated):
@itemize{ @itemize{
@item{A term written @tt{identifier} is equivalent to the @item{A term written @scheme[_identifier] is equivalent to the
corresponding symbol, unless the identifier is bound by corresponding symbol, unless the identifier is bound by
@scheme[term-let] (or in a @|pattern| elsewhere) or is @scheme[term-let] (or in a @|pattern| elsewhere) or is
@tt{hole} (as below). } @tt{hole} (as below). }
@item{A term written @tt{(term-sequence ...)} constructs a list of @item{A term written @scheme[(_term-sequence ...)] constructs a list of
the terms constructed by the sequence elements.} the terms constructed by the sequence elements.}
@item{A term written @scheme[,scheme-expression] evaluates the @item{A term written @scheme[,_scheme-expression] evaluates the
@scheme[scheme-expression] and substitutes its value into the term at @scheme[scheme-expression] and substitutes its value into the term at
that point.} that point.}
@item{A term written @scheme[,@scheme-expression] evaluates the @item{A term written @scheme[,@_scheme-expression] evaluates the
@scheme[scheme-expression], which must produce a list. It then splices @scheme[scheme-expression], which must produce a list. It then splices
the contents of the list into the expression at that point in the sequence.} the contents of the list into the expression at that point in the sequence.}
@item{A term written @tt{(in-hole @|tttterm| @|tttterm|)} @item{A term written @scheme[(in-hole @|tttterm| @|tttterm|)]
is the dual to the @pattern `in-hole' -- it accepts is the dual to the @pattern @scheme[in-hole] -- it accepts
a context and an expression and uses @scheme[plug] to combine a context and an expression and uses @scheme[plug] to combine
them.} them.}
@item{A term written @tt{hole} produces a hole.} @item{A term written @scheme[hole] produces a hole.}
@item{A term written as a literal boolean or a string @item{A term written as a literal boolean or a string
produces the boolean or the string.} produces the boolean or the string.}
@ -418,13 +418,11 @@ produces the boolean or the string.}
This form is used for construction of a term. This form is used for construction of a term.
in It behaves similarly to @scheme[quasiquote], except for a few special
the right-hand sides of reductions. It behaves similarly to forms that are recognized (listed below) and that names bound by
quasiquote except for a few special forms that are @scheme[term-let] are implicitly substituted with the values that
recognized (listed below) and that names bound by @scheme[term-let] are those names were bound to, expanding ellipses as in-place sublists (in
implicitly substituted with the values that those names were the same manner as syntax-case patterns).
bound to, expanding ellipses as in-place sublists (in the
same manner as syntax-case patterns).
For example, For example,
@ -461,16 +459,15 @@ the id pattern to the appropriate value (described
below). These bindings are then accessible to the `term' below). These bindings are then accessible to the `term'
syntactic form. syntactic form.
Note that each @scheme[ellipsis] should be the literal Note that each ellipsis should be the literal symbol consisting of
symbol consisting of three dots (and the ... elsewhere three dots (and the ... elsewhere indicates repetition as usual). If
indicates repetition as usual). If @scheme[tl-pat] is an identifier, @scheme[tl-pat] is an identifier, it matches any value and binds it to
it matches any value and binds it to the identifier, for use the identifier, for use inside @scheme[term]. If it is a list, it
inside @scheme[term]. If it is a list, it matches only if the value matches only if the value being matched is a list value and only if
being matched is a list value and only if every subpattern every subpattern recursively matches the corresponding list
recursively matches the corresponding list element. There element. There may be a single ellipsis in any list pattern; if one is
may be a single ellipsis in any list pattern; if one is present, the pattern before the ellipses may match multiple adjacent
present, the pattern before the ellipses may match multiple elements in the list value (possibly none).
adjacent elements in the list value (possibly none).
This form is a lower-level form in Redex, and not really designed to This form is a lower-level form in Redex, and not really designed to
be used directly. If you want a @scheme[let]-like form that uses be used directly. If you want a @scheme[let]-like form that uses

View File

@ -15,8 +15,10 @@
[s (regexp-replace* #px"[-\\s]+" s " ")]) [s (regexp-replace* #px"[-\\s]+" s " ")])
(make-elem style c (list 'tech (doc-prefix doc s))))) (make-elem style c (list 'tech (doc-prefix doc s)))))
(define (deftech . s) (define (deftech #:style? [style? #t] . s)
(let* ([e (apply defterm s)] (let* ([e (if style?
(apply defterm s)
(make-element #f (decode-content s)))]
[t (*tech make-target-element #f #f (list e))]) [t (*tech make-target-element #f #f (list e))])
(make-index-element #f (make-index-element #f
(list t) (list t)

View File

@ -929,7 +929,8 @@ The @tech{decode}d @scheme[pre-content] is hyperlinked to @scheme[t],
which is normally defined using @scheme[elemtag].} which is normally defined using @scheme[elemtag].}
@defproc[(deftech [pre-content any/c] ...) element?]{ @defproc[(deftech [pre-content any/c] ...
[#:style? style? any/c #t]) element?]{
Produces an element for the @tech{decode}d @scheme[pre-content], and Produces an element for the @tech{decode}d @scheme[pre-content], and
also defines a term that can be referenced elsewhere using also defines a term that can be referenced elsewhere using
@ -952,7 +953,10 @@ as follows:
These normalization steps help support natural-language references These normalization steps help support natural-language references
that differ slightly from a defined form. For example, a definition of that differ slightly from a defined form. For example, a definition of
``bananas'' can be referenced with a use of ``banana''.} ``bananas'' can be referenced with a use of ``banana''.
If @scheme[style?] is true, then @scheme[defterm] is used on
@scheme[pre-content].}
@defproc[(tech [pre-content any/c] ... @defproc[(tech [pre-content any/c] ...
[#:doc module-path (or/c module-path? false/c) #f]) [#:doc module-path (or/c module-path? false/c) #f])