diff --git a/collects/syntax/parse/private/parse.rkt b/collects/syntax/parse/private/parse.rkt index 10eef457e2..0634de5a07 100644 --- a/collects/syntax/parse/private/parse.rkt +++ b/collects/syntax/parse/private/parse.rkt @@ -8,6 +8,7 @@ "rep.rkt" "kws.rkt" "txlift.rkt") + racket/syntax racket/stxparam syntax/stx unstable/struct @@ -242,9 +243,10 @@ Conventions: [es null] [cx x] [fh0 (syntax-patterns-fail ctx0)]) - (with ([fail-handler fh0] - [cut-prompt fh0]) - (try alternative ...)))))))])) + (parameterize ((current-syntax-context ctx0)) + (with ([fail-handler fh0] + [cut-prompt fh0]) + (try alternative ...))))))))])) ;; ---- diff --git a/collects/syntax/parse/private/sc.rkt b/collects/syntax/parse/private/sc.rkt index 00bd0332e3..e60d83d712 100644 --- a/collects/syntax/parse/private/sc.rkt +++ b/collects/syntax/parse/private/sc.rkt @@ -4,6 +4,7 @@ racket/syntax "rep-data.rkt" "rep.rkt") + racket/syntax "parse.rkt" "keywords.rkt" "runtime.rkt" @@ -163,14 +164,15 @@ [(def ...) defs] [expr expr]) #'(defattrs/unpack (a ...) - (let* ([x expr] + (let* ([x (datum->syntax #f expr)] [cx x] [pr (ps-empty x x)] [es null] [fh0 (syntax-patterns-fail x)]) - def ... - (#%expression - (with ([fail-handler fh0] - [cut-prompt fh0]) - (parse:S x cx pattern pr es - (list (attribute name) ...)))))))))])) + (parameterize ((current-syntax-context x)) + def ... + (#%expression + (with ([fail-handler fh0] + [cut-prompt fh0]) + (parse:S x cx pattern pr es + (list (attribute name) ...))))))))))])) diff --git a/collects/syntax/scribblings/parse/parsing.scrbl b/collects/syntax/scribblings/parse/parsing.scrbl index 5972197acb..6ba87ee86e 100644 --- a/collects/syntax/scribblings/parse/parsing.scrbl +++ b/collects/syntax/scribblings/parse/parsing.scrbl @@ -3,7 +3,8 @@ scribble/struct scribble/decode scribble/eval - "parse-common.rkt") + "parse-common.rkt" + (for-label racket/syntax)) @title{Parsing Syntax} @@ -58,7 +59,9 @@ The following options are supported: #:contracts ([context-expr syntax?])]{ When present, @racket[context-expr] is used in reporting parse -failures; otherwise @racket[stx-expr] is used. +failures; otherwise @racket[stx-expr] is used. The +@racket[current-syntax-context] parameter is also set to the value of +@racket[context-expr]. @(myexamples (syntax-parse #'(a b 3)