commit 97078b60edd67e075def900508540130f1c21f0f
parent 7da79dd62b0f1c55d0f5ce8235615036423d42b6
Author: Dominik Joe Pantůček <dominik.pantucek@trustica.cz>
Date: Wed, 2 Oct 2019 05:01:06 +0200
scribble/srcdoc: add `class*-doc` and `class-doc` provide forms (#213)
* 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.
Diffstat:
3 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/scribble-doc/scribblings/scribble/srcdoc.scrbl b/scribble-doc/scribblings/scribble/srcdoc.scrbl
@@ -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
diff --git a/scribble-lib/info.rkt b/scribble-lib/info.rkt
@@ -23,4 +23,4 @@
(define pkg-authors '(mflatt eli))
-(define version "1.29")
+(define version "1.30")
diff --git a/scribble-lib/scribble/srcdoc.rkt b/scribble-lib/scribble/srcdoc.rkt
@@ -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 ()
[(_)