scribble/srcdoc: add class*-doc and class-doc provide forms ()

* scribble/srcdoc: add `class*-doc` and `class-doc` provide forms.

* Add missing require of racket/class which contains the class? predicate.

* Add @history stanza to class*-doc and class-doc scribblings and bump version number in scribble-lib/info.rkt to 1.30.
This commit is contained in:
Dominik Joe Pantůček 2019-10-02 05:01:06 +02:00 committed by Ben Greenman
parent 7da79dd62b
commit 97078b60ed
3 changed files with 67 additions and 1 deletions
scribble-doc/scribblings/scribble
scribble-lib

View File

@ -180,6 +180,27 @@ See @racket[defform] for information on @racket[options],
@history[#:added "1.6"]}
@defform[(class*-doc id super (intf-id ...) pre-flow)]{
Like @racket[proc-doc], but for class declarations that use @racket[class*].
The @racket[id], @racket[super], and @racket[intf-id] expressions have the same
meaning as in @racket[defclass].
@history[#:added "1.30"]}
@defform[(class-doc id super pre-flow)]{
Like @racket[class*-doc], but for class declarations that use @racket[class]
omitting @racket[interface-expr]s.
The @racket[id], and @racket[super] expressions have the same meaning as in
@racket[defclass].
@history[#:added "1.30"]}
@defform[(begin-for-doc form ...)]{
Like to @racket[begin-for-syntax], but for documentation time instead

View File

@ -23,4 +23,4 @@
(define pkg-authors '(mflatt eli))
(define version "1.29")
(define version "1.30")

View File

@ -1,5 +1,6 @@
#lang racket/base
(require racket/contract/base
racket/class
(for-syntax racket/base
racket/require-transform
racket/provide-transform
@ -16,6 +17,8 @@
struct-doc
struct*-doc
form-doc
class*-doc
class-doc
generate-delayed-documents
begin-for-doc)
@ -662,6 +665,48 @@
#'((only-in scribble/manual defform))
#'id))])))
(define-provide/doc-transformer class*-doc
(lambda (stx)
(syntax-case stx ()
[(_ id super (intf-id ...) pre-flow)
(begin
(unless (identifier? #'id)
(raise-syntax-error 'class*-doc
"expected an identifier"
stx
#'id))
(unless (identifier? #'super)
(raise-syntax-error 'class*-doc
"expected super class identifier"
stx
#'id))
(values
#'[id class?]
#'(defclass id super (intf-id ...) . pre-flow)
#'((only-in scribble/manual defclass defconstructor defmethod this-obj))
#'id))])))
(define-provide/doc-transformer class-doc
(lambda (stx)
(syntax-case stx ()
[(_ id super pre-flow)
(begin
(unless (identifier? #'id)
(raise-syntax-error 'class-doc
"expected an identifier"
stx
#'id))
(unless (identifier? #'super)
(raise-syntax-error 'class-doc
"expected super class identifier"
stx
#'id))
(values
#'[id class?]
#'(defclass id super () . pre-flow)
#'((only-in scribble/manual defclass defconstructor defmethod this-obj))
#'id))])))
(define-syntax (generate-delayed-documents stx)
(syntax-case stx ()
[(_)