|
|
@ -9,7 +9,7 @@
|
|
|
|
syntax/define
|
|
|
|
syntax/define
|
|
|
|
racket/string))
|
|
|
|
racket/string))
|
|
|
|
(provide (all-defined-out)
|
|
|
|
(provide (all-defined-out)
|
|
|
|
(for-syntax with-shared-id with-calling-site-id))
|
|
|
|
(for-syntax with-shared-id))
|
|
|
|
|
|
|
|
|
|
|
|
(module+ test
|
|
|
|
(module+ test
|
|
|
|
(require rackunit))
|
|
|
|
(require rackunit))
|
|
|
@ -116,9 +116,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
(begin-for-syntax
|
|
|
|
(begin-for-syntax
|
|
|
|
(define-syntax-rule (with-shared-id (id ...) . body)
|
|
|
|
(define-syntax-rule (with-shared-id (id ...) . body)
|
|
|
|
(with-syntax ([id (shared-syntax 'id)] ...)
|
|
|
|
(with-syntax ([id (datum->syntax caller-stx (if (syntax? id)
|
|
|
|
. body))
|
|
|
|
(syntax-e id)
|
|
|
|
(define-syntax with-calling-site-id (make-rename-transformer #'with-shared-id)))
|
|
|
|
id))] ...)
|
|
|
|
|
|
|
|
. body)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; `syntax-parse` classes shared by `define-macro` and `define-macro-cases`
|
|
|
|
;; `syntax-parse` classes shared by `define-macro` and `define-macro-cases`
|
|
|
@ -172,8 +173,8 @@
|
|
|
|
(define result
|
|
|
|
(define result
|
|
|
|
(syntax-parameterize ([caller-stx (make-rename-transformer #'stx)])
|
|
|
|
(syntax-parameterize ([caller-stx (make-rename-transformer #'stx)])
|
|
|
|
(syntax-case stx LITERALS
|
|
|
|
(syntax-case stx LITERALS
|
|
|
|
[pat . result-exprs] ...
|
|
|
|
[pat . result-exprs] ...
|
|
|
|
else-clause)))
|
|
|
|
else-clause)))
|
|
|
|
(if (syntax? result)
|
|
|
|
(if (syntax? result)
|
|
|
|
result
|
|
|
|
result
|
|
|
|
(datum->syntax #'id result)))))]
|
|
|
|
(datum->syntax #'id result)))))]
|
|
|
|