light.scrbl (3299B)
1 #lang scribble/manual 2 @require[scriblib/footnote 3 @for-label[subtemplate/light 4 syntax/parse/experimental/template 5 racket/base]] 6 7 @(begin 8 (module m racket/base 9 (require scribble/manual 10 (for-template subtemplate) 11 (for-syntax racket/base 12 racket/syntax)) 13 (define-syntax (mk stx) 14 (syntax-case stx () 15 [(_ id) 16 (with-syntax ([full: (format-id #'id "full:~a" #'id)]) 17 #'(begin 18 (define full: @racket[id]) 19 (provide full:)))])) 20 (define-syntax-rule (mk* id ...) (begin (mk id) ...)) 21 (mk* subtemplate ?@@ ?attr ?cond ?if)) 22 (require 'm)) 23 24 @title{Lightweight Subtemplate} 25 26 @defmodule[subtemplate/light]{ 27 28 This module only provides stripped-down versions of @racket[subtemplate] and 29 @racket[quasisubtemplate], without overriding @racket[syntax] and 30 @racket[quasisyntax]. Note that some features will not work when using these 31 versions. Prefer using @racket[(require subtemplate)] instead. 32 33 Another limitation is that subscripted identifiers are not searched for 34 within unquoted parts of the template. 35 36 Note that you need to require @racketmodname[stxparse-info/parse] and 37 @racketmodname[stxparse-info/case], otherwise @racket[subtemplate] and 38 @racket[quasisubtemplate] will not be able to detect which pattern variables 39 are bound (and therefore will be unable to know from which @racket[xᵢ] an 40 @racket[yᵢ] should be derived.} 41 42 @defform*[{(subtemplate template) 43 (subtemplate template #:properties (prop ...))} 44 #:contracts 45 ([prop identifier?])]{ 46 47 Like @full:subtemplate from @racketmodname[subtemplate], but with a few 48 features missing (@full:?@@ @full:?attr @full:?cond @full:?if).} 49 50 @defform*[{(subtemplate template) 51 (subtemplate template #:properties (prop ...))} 52 #:contracts 53 ([prop identifier?])]{ 54 55 Like @full:subtemplate from @racketmodname[subtemplate], but with a few 56 features missing. The utilities @full:?@@ @full:?attr @full:?cond @full:?if 57 are not taken into account, and @racket[unsyntax] completely escapes the 58 ellipses. 59 60 Note that the syntax pattern variables must be matched with one of the 61 patched forms from @racketmodname[stxparse-info/parse] or 62 @racketmodname[stxparse-info/case], instead of the syntax pattern-matching 63 forms from @racketmodname[syntax/parse] or @racketmodname[racket/base], 64 respectively.} 65 66 @defform*[{(quasisubtemplate template) 67 (quasisubtemplate template #:properties (prop ...))} 68 #:contracts 69 ([prop identifier?])]{ 70 71 Like @full:subtemplate from @racketmodname[subtemplate], but with a few 72 features missing. The utilities @full:?@@ @full:?attr @full:?cond @full:?if 73 are not taken into account, and @racket[unsyntax] completely escapes the 74 ellipses 75 76 Another limitation is that subscripted identifiers are not searched for 77 within unquoted parts of the template. 78 79 Note that the syntax pattern variables must be matched with one of the 80 patched forms from @racketmodname[stxparse-info/parse] or 81 @racketmodname[stxparse-info/case], instead of the syntax pattern-matching 82 forms from @racketmodname[syntax/parse] or @racketmodname[racket/base], 83 respectively. }