Make syntax-local-introduce work in syntax/parse pattern expanders
This commit is contained in:
parent
33546008b3
commit
87a5ee4cc1
|
@ -1181,7 +1181,8 @@ Returns @racket[#t] if @racket[v] is a @tech{pattern expander},
|
||||||
|
|
||||||
@defproc[(syntax-local-syntax-parse-pattern-introduce [stx syntax?]) syntax?]{
|
@defproc[(syntax-local-syntax-parse-pattern-introduce [stx syntax?]) syntax?]{
|
||||||
|
|
||||||
Like @racket[syntax-local-introduce], but for @tech{pattern expanders}.
|
For backward compatibility only; equivalent to @racket[syntax-local-introduce].
|
||||||
}
|
|
||||||
|
@history[#:changed "6.90.0.29" @elem{Made equivalent to @racket[syntax-local-introduce].}]}
|
||||||
|
|
||||||
@(close-eval the-eval)
|
@(close-eval the-eval)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
racket/contract/base
|
racket/contract/base
|
||||||
"make.rkt"
|
"make.rkt"
|
||||||
"minimatch.rkt"
|
"minimatch.rkt"
|
||||||
|
syntax/apply-transformer
|
||||||
syntax/private/id-table
|
syntax/private/id-table
|
||||||
syntax/stx
|
syntax/stx
|
||||||
syntax/keyword
|
syntax/keyword
|
||||||
|
@ -616,13 +617,8 @@
|
||||||
|
|
||||||
;; expand-pattern : pattern-expander Syntax -> Syntax
|
;; expand-pattern : pattern-expander Syntax -> Syntax
|
||||||
(define (expand-pattern pe stx)
|
(define (expand-pattern pe stx)
|
||||||
(let* ([proc (pattern-expander-proc pe)]
|
(let ([proc (pattern-expander-proc pe)])
|
||||||
[introducer (make-syntax-introducer)]
|
(local-apply-transformer proc stx 'expression)))
|
||||||
[mstx (introducer (syntax-local-introduce stx))]
|
|
||||||
[mresult (parameterize ([current-syntax-parse-pattern-introducer introducer])
|
|
||||||
(proc mstx))]
|
|
||||||
[result (syntax-local-introduce (introducer mresult))])
|
|
||||||
result))
|
|
||||||
|
|
||||||
;; parse-ellipsis-head-pattern : stx DeclEnv -> (listof EllipsisHeadPattern)
|
;; parse-ellipsis-head-pattern : stx DeclEnv -> (listof EllipsisHeadPattern)
|
||||||
(define (parse-ellipsis-head-pattern stx decls)
|
(define (parse-ellipsis-head-pattern stx decls)
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
prop:pattern-expander
|
prop:pattern-expander
|
||||||
pattern-expander?
|
pattern-expander?
|
||||||
pattern-expander-proc
|
pattern-expander-proc
|
||||||
current-syntax-parse-pattern-introducer
|
|
||||||
syntax-local-syntax-parse-pattern-introduce)
|
syntax-local-syntax-parse-pattern-introduce)
|
||||||
|
|
||||||
(define-logger syntax-parse)
|
(define-logger syntax-parse)
|
||||||
|
@ -94,10 +93,5 @@ An EH-alternative is
|
||||||
(define get-proc (get-proc-getter pat-expander))
|
(define get-proc (get-proc-getter pat-expander))
|
||||||
(get-proc pat-expander))
|
(get-proc pat-expander))
|
||||||
|
|
||||||
(define current-syntax-parse-pattern-introducer
|
|
||||||
(make-parameter
|
|
||||||
(lambda (stx)
|
|
||||||
(error 'syntax-local-syntax-parse-pattern-introduce "not expanding syntax-parse pattern"))))
|
|
||||||
|
|
||||||
(define (syntax-local-syntax-parse-pattern-introduce stx)
|
(define (syntax-local-syntax-parse-pattern-introduce stx)
|
||||||
((current-syntax-parse-pattern-introducer) stx))
|
(syntax-local-introduce stx))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user