From 87a5ee4cc1d0d40af658c015562c0f492c1035e5 Mon Sep 17 00:00:00 2001 From: Alexis King Date: Thu, 17 May 2018 13:32:46 -0500 Subject: [PATCH] Make syntax-local-introduce work in syntax/parse pattern expanders --- .../racket-doc/syntax/scribblings/parse/patterns.scrbl | 5 +++-- racket/collects/syntax/parse/private/rep.rkt | 10 +++------- racket/collects/syntax/parse/private/residual-ct.rkt | 8 +------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/pkgs/racket-doc/syntax/scribblings/parse/patterns.scrbl b/pkgs/racket-doc/syntax/scribblings/parse/patterns.scrbl index 3908793c9e..c2f73a1581 100644 --- a/pkgs/racket-doc/syntax/scribblings/parse/patterns.scrbl +++ b/pkgs/racket-doc/syntax/scribblings/parse/patterns.scrbl @@ -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?]{ -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) diff --git a/racket/collects/syntax/parse/private/rep.rkt b/racket/collects/syntax/parse/private/rep.rkt index 228b1762a7..490371b5a5 100644 --- a/racket/collects/syntax/parse/private/rep.rkt +++ b/racket/collects/syntax/parse/private/rep.rkt @@ -7,6 +7,7 @@ racket/contract/base "make.rkt" "minimatch.rkt" + syntax/apply-transformer syntax/private/id-table syntax/stx syntax/keyword @@ -616,13 +617,8 @@ ;; expand-pattern : pattern-expander Syntax -> Syntax (define (expand-pattern pe stx) - (let* ([proc (pattern-expander-proc pe)] - [introducer (make-syntax-introducer)] - [mstx (introducer (syntax-local-introduce stx))] - [mresult (parameterize ([current-syntax-parse-pattern-introducer introducer]) - (proc mstx))] - [result (syntax-local-introduce (introducer mresult))]) - result)) + (let ([proc (pattern-expander-proc pe)]) + (local-apply-transformer proc stx 'expression))) ;; parse-ellipsis-head-pattern : stx DeclEnv -> (listof EllipsisHeadPattern) (define (parse-ellipsis-head-pattern stx decls) diff --git a/racket/collects/syntax/parse/private/residual-ct.rkt b/racket/collects/syntax/parse/private/residual-ct.rkt index 9d9924b353..53ccd2c6fc 100644 --- a/racket/collects/syntax/parse/private/residual-ct.rkt +++ b/racket/collects/syntax/parse/private/residual-ct.rkt @@ -19,7 +19,6 @@ prop:pattern-expander pattern-expander? pattern-expander-proc - current-syntax-parse-pattern-introducer syntax-local-syntax-parse-pattern-introduce) (define-logger syntax-parse) @@ -94,10 +93,5 @@ An EH-alternative is (define get-proc (get-proc-getter 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) - ((current-syntax-parse-pattern-introducer) stx)) + (syntax-local-introduce stx))