doclang2.rkt (1030B)
1 #lang racket/base 2 3 ;; A slightly nicer version of doclang where the parameters are keyword-based 4 ;; rather than positional. Delegates off to the original doclang. 5 6 (require (prefix-in doclang: "doclang.rkt") 7 (for-syntax racket/base 8 syntax/parse)) 9 10 (provide (except-out (all-from-out racket/base) #%module-begin) 11 (rename-out [*module-begin #%module-begin])) 12 13 ;; Module wrapper ---------------------------------------- 14 15 (define-syntax (*module-begin stx) 16 (syntax-parse stx 17 [(_ (~or (~optional (~seq #:id id)) 18 (~optional (~seq #:post-process post-process)) 19 (~optional (~seq #:exprs exprs))) 20 ... 21 . body) 22 (with-syntax ([id (or (attribute id) 23 #'doc)] 24 [post-process (or (attribute post-process) 25 #'values)] 26 [exprs (or (attribute exprs) 27 #'())]) 28 #'(doclang:#%module-begin id post-process exprs . body))]))