Removed automatic addition of -mixin, since now we don't implicitly define a splicing-syntax-class for each mixin.
This commit is contained in:
parent
643988a0b9
commit
68a7178b7e
3
main.rkt
3
main.rkt
|
@ -58,9 +58,8 @@
|
||||||
(syntax-parser
|
(syntax-parser
|
||||||
[(_ name ((~literal pattern) pat) ...)
|
[(_ name ((~literal pattern) pat) ...)
|
||||||
(let ()
|
(let ()
|
||||||
(define/with-syntax mixin (format-id #'name "~a-mixin" #'name))
|
|
||||||
(define-temp-ids "~a/clause" (pat ...))
|
(define-temp-ids "~a/clause" (pat ...))
|
||||||
#'(define-eh-mixin-expander mixin
|
#'(define-eh-mixin-expander name
|
||||||
(λ (_)
|
(λ (_)
|
||||||
(quote-syntax (~or pat ...)))))]))
|
(quote-syntax (~or pat ...)))))]))
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
structure-kw-fields-mixin
|
structure-kw-fields-mixin
|
||||||
structure-kw-all-mixin)
|
structure-kw-all-mixin)
|
||||||
|
|
||||||
(define-eh-alternative-mixin structure-kw-instance-or-builder
|
(define-eh-alternative-mixin structure-kw-instance-or-builder-mixin
|
||||||
(pattern
|
(pattern
|
||||||
{~optional {~and instance-or-builder
|
{~optional {~and instance-or-builder
|
||||||
{~or {~global-or instance #:instance}
|
{~or {~global-or instance #:instance}
|
||||||
{~global-or builder #:builder}}}
|
{~global-or builder #:builder}}}
|
||||||
#:name "either #:instance or #:builder"}))
|
#:name "either #:instance or #:builder"}))
|
||||||
|
|
||||||
(define-eh-alternative-mixin structure-kw-predicate
|
(define-eh-alternative-mixin structure-kw-predicate-mixin
|
||||||
(pattern {~optional {~seq #:? predicate:id}
|
(pattern {~optional {~seq #:? predicate:id}
|
||||||
#:name "#:? predicate"}))
|
#:name "#:? predicate"}))
|
||||||
|
|
||||||
|
@ -39,22 +39,26 @@
|
||||||
(~a "If no fields are specified, then either #:builder or #:instance"
|
(~a "If no fields are specified, then either #:builder or #:instance"
|
||||||
" must be present"))
|
" must be present"))
|
||||||
|
|
||||||
(define-eh-alternative-mixin structure-kw-fields
|
(define-eh-alternative-mixin structure-kw-fields-mixin
|
||||||
(pattern
|
(pattern
|
||||||
{~optional/else
|
{~optional/else
|
||||||
{~or {~seq {~or-bug [field:id] field:id} …+
|
{~or {~seq {~or-bug [field:id] field:id} …+
|
||||||
{~global-or builder}
|
{~global-or builder}
|
||||||
|
{~global-or no-types}
|
||||||
{~post-fail no-values-err #:when (attribute instance)}}
|
{~post-fail no-values-err #:when (attribute instance)}}
|
||||||
{~seq [field:id : type] …+
|
{~seq [field:id : type] …+
|
||||||
{~global-or builder}
|
{~global-or builder}
|
||||||
|
{~global-or types}
|
||||||
{~post-fail no-values-err #:when (attribute instance)}}
|
{~post-fail no-values-err #:when (attribute instance)}}
|
||||||
{~seq [field:id value:expr] …+
|
{~seq [field:id value:expr] …+
|
||||||
{~global-or instance}
|
{~global-or instance}
|
||||||
|
{~global-or no-types}
|
||||||
{~post-fail values-err #:when (attribute builder)}}
|
{~post-fail values-err #:when (attribute builder)}}
|
||||||
{~seq {~or-bug [field:id value:expr : type]
|
{~seq {~or-bug [field:id value:expr : type]
|
||||||
[field:id : type value:expr]}
|
[field:id : type value:expr]}
|
||||||
…+
|
…+
|
||||||
{~global-or instance}
|
{~global-or instance}
|
||||||
|
{~global-or types}
|
||||||
{~post-fail values-err #:when (attribute builder)}}}
|
{~post-fail values-err #:when (attribute builder)}}}
|
||||||
#:defaults ([(field 1) (list)]
|
#:defaults ([(field 1) (list)]
|
||||||
[(value 1) (list)]
|
[(value 1) (list)]
|
||||||
|
@ -65,7 +69,7 @@
|
||||||
" [field value] or [field : type value]"
|
" [field value] or [field : type value]"
|
||||||
" or [field value : type] for #:instance")}))
|
" or [field value : type] for #:instance")}))
|
||||||
|
|
||||||
(define-eh-alternative-mixin structure-kw-all
|
(define-eh-alternative-mixin structure-kw-all-mixin
|
||||||
(pattern {~or {structure-kw-instance-or-builder-mixin}
|
(pattern {~or {structure-kw-instance-or-builder-mixin}
|
||||||
{structure-kw-predicate-mixin}
|
{structure-kw-predicate-mixin}
|
||||||
{structure-kw-fields-mixin}}))
|
{structure-kw-fields-mixin}}))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user