From 1aea43aeba4dd6918b539c74deb23c7aa6690138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Thu, 26 Jan 2017 05:33:38 +0100 Subject: [PATCH] Cleanup; documentation --- .travis.yml | 15 ++++++++----- info.rkt | 2 +- main.rkt | 5 +++-- scribblings/subtemplate.scrbl | 42 ++++++++++++++++++++++++++++++++--- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 975fd66..79a602d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,8 @@ env: # Supply more than one RACKET_VERSION (as in the example below) to # create a Travis-CI build matrix to test against multiple Racket # versions. - - RACKET_VERSION=6.0 - - RACKET_VERSION=6.1 + #- RACKET_VERSION=6.0 + #- RACKET_VERSION=6.1 - RACKET_VERSION=6.1.1 - RACKET_VERSION=6.2 - RACKET_VERSION=6.3 @@ -29,6 +29,7 @@ env: - RACKET_VERSION=6.5 - RACKET_VERSION=6.6 - RACKET_VERSION=6.7 + - RACKET_VERSION=6.8 - RACKET_VERSION=HEAD matrix: @@ -50,9 +51,11 @@ before_script: # `raco pkg install --deps search-auto` to install any required # packages without it getting stuck on a confirmation prompt. script: - - raco test -x -p subtemplate + - raco test -p subtemplate + - raco setup --check-pkg-deps --pkgs subtemplate + - raco pkg install doc-coverage + - raco doc-coverage subtemplate + - raco pkg install --deps search-auto cover cover-codecov + - raco cover -b -f codecov -d $TRAVIS_BUILD_DIR/coverage . after_success: - - raco setup --check-pkg-deps --pkgs subtemplate - - raco pkg install --deps search-auto cover cover-coveralls - - raco cover -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage . diff --git a/info.rkt b/info.rkt index ed778b7..e43515f 100644 --- a/info.rkt +++ b/info.rkt @@ -8,7 +8,7 @@ "stxparse-info")) (define build-deps '("scribble-lib" "racket-doc")) -(define scribblings '(("scribblings/subtemplate.scrbl" ()))) +(define scribblings '(("scribblings/subtemplate.scrbl" () (parsing-library)))) (define pkg-desc "Description Here") (define version "0.0") (define pkg-authors '(georges)) diff --git a/main.rkt b/main.rkt index 383d864..1167f73 100644 --- a/main.rkt +++ b/main.rkt @@ -171,7 +171,8 @@ (car depths) #'check-ellipsis-count-ddd)))) -(define-for-syntax/case-args ((sub*template tmpl-form) (self . tmpl)) +(define-for-syntax/case-args ((sub*template tmpl-form) + (self tmpl . maybe-props)) (define acc '()) ;; Finds identifiers of the form zᵢ, and return a list of existing xᵢ bindings @@ -195,7 +196,7 @@ ;; like (quasitemplate . tmpl) (define result (quasisyntax/top-loc #'self - (#,tmpl-form . tmpl))) + (#,tmpl-form tmpl . maybe-props))) ;; Make sure that we remove duplicates, otherwise we'll get errors if we ;; define the same derived id twice. (define/with-syntax ([bound diff --git a/scribblings/subtemplate.scrbl b/scribblings/subtemplate.scrbl index 5477926..4628f31 100644 --- a/scribblings/subtemplate.scrbl +++ b/scribblings/subtemplate.scrbl @@ -1,10 +1,46 @@ #lang scribble/manual @require[@for-label[subtemplate + syntax/parse/experimental/template racket/base]] -@title{subtemplate} -@author{georges} +@title{Subtemplate} +@author[@author+email["Georges Dupéron" "georges.duperon@gmail.com"]] @defmodule[subtemplate] -Package Description Here +@defform*[{(subtemplate template) + (subtemplate template #:properties (prop ...))} + #:contracts + ([prop identifier?])]{ + Like @racket[template], but automatically derives identifiers for any + @racket[yᵢ …] which is not bound as a syntax pattern variable, based on a + corresponding @racket[xᵢ …] which is bound as a syntax pattern variable. + + Note that the syntax pattern variables must be matched with one of the + patched forms from @racket[stxparse-info/parse] or + @racket[stxparse-info/case], instead of the syntax pattern-matching forms from + @racket[syntax/parse] or @racket[racket/base], respectively.} + +@defform*[{(quasisubtemplate template) + (quasisubtemplate template #:properties (prop ...))} + #:contracts + ([prop identifier?])]{ + Like @racket[quasitemplate], but automatically derives identifiers for any + @racket[yᵢ …] which is not bound as a syntax pattern variable, based on a + corresponding @racket[xᵢ …] which is bound as a syntax pattern variable, in + the same way as @racket[subtemplate]. + + Note that the syntax pattern variables must be matched with one of the + patched forms from @racket[stxparse-info/parse] or + @racket[stxparse-info/case], instead of the syntax pattern-matching forms from + @racket[syntax/parse] or @racket[racket/base], respectively. +} + +@subsection{Overriding the default @racket[#'…] and @racket[#`…]} + +@defmodule[subtemplate/override] + +The @racketmodname[subtemplate/override] module re-provides +@racket[subtemplate] as @racket[syntax], and @racket[quasisubtemplate] as +@racket[quasisyntax]. This allows @racketmodname[subtemplate] to be used via +the reader shorthands @racket[#'…] and @racket[#`…].