From 2455567384c148ec6f96996b32990e08a6435338 Mon Sep 17 00:00:00 2001 From: Milo Turner Date: Mon, 18 Jun 2018 17:48:11 -0400 Subject: [PATCH 1/2] Add intdef-ctx argument to local-value --- syntax-classes-lib/syntax/parse/class/local-value.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax-classes-lib/syntax/parse/class/local-value.rkt b/syntax-classes-lib/syntax/parse/class/local-value.rkt index 6809dcb..091e153 100644 --- a/syntax-classes-lib/syntax/parse/class/local-value.rkt +++ b/syntax-classes-lib/syntax/parse/class/local-value.rkt @@ -10,10 +10,12 @@ (struct unbound-value ()) (unbound-value))) -(define-syntax-class (local-value [predicate? (const #t)] #:failure-message [message #f]) +(define-syntax-class (local-value [predicate? (const #t)] + [intdef-ctx #f] + #:failure-message [message #f]) #:description #f #:attributes [local-value] [pattern id:id - #:attr local-value (syntax-local-value #'id (const unbound-value)) + #:attr local-value (syntax-local-value #'id (const unbound-value) intdef-ctx) #:fail-when (eq? (attribute local-value) unbound-value) message #:fail-unless (predicate? (attribute local-value)) message]) From c7855d7f1e6894032f0ad8c5da27f81c0fd2ab64 Mon Sep 17 00:00:00 2001 From: Milo Turner Date: Mon, 18 Jun 2018 18:32:54 -0400 Subject: [PATCH 2/2] Added documentation for intdef-ctx parameter to local-value --- syntax-classes-doc/scribblings/syntax-classes.scrbl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/syntax-classes-doc/scribblings/syntax-classes.scrbl b/syntax-classes-doc/scribblings/syntax-classes.scrbl index 52326c2..f401cac 100644 --- a/syntax-classes-doc/scribblings/syntax-classes.scrbl +++ b/syntax-classes-doc/scribblings/syntax-classes.scrbl @@ -45,8 +45,13 @@ This library provides additional @syntax-class-tech{syntax classes} for use with @defmodule[syntax/parse/class/local-value] @defform[#:kind "syntax class" - (local-value @#,elem{[@racket[_predicate?]]} @#,elem{[@racket[#:failure-message _failure-message]]}) + (local-value @#,elem{[@racket[_predicate?]]} + @#,elem{[@racket[_intdef-ctx]]} + @#,elem{[@racket[#:failure-message _failure-message]]}) #:contracts ([_predicate? @#,elem{@racket[(any/c . -> . any/c)] = @racket[(const #t)]}] + [_intdef-ctx @#,elem{@racket[(or/c internal-definition-context? + (listof internal-definition-context?) + #f)] = @racket[#f]}] [_failure-message @#,elem{@racket[(or/c string? #f)] = @racket[#f]}])]{ A @syntax-class-tech{syntax class} for parsing identifiers bound to @guide-tech{transformer bindings}. It parses an identifier, then calls @racket[syntax-local-value] on it and binds the result to an @@ -56,6 +61,11 @@ If @racket[_predicate?] is specified, then @racket[_predicate?] will be applied @racket[syntax-local-value], and if the result is @racket[#f], then the syntax class will fail to match. +If @racket[_intdef-ctx] is not @racket[#f], bindings from all provided definition contexts are +considered when determining the local binding. Like the third argument to @racket[syntax-local-value], +the @syntax-tech{scopes} associated with the provided definition contexts are @italic{not} used to +enrich the matching identifier's @syntax-tech{lexical information}. + If the identifier is not bound to a @guide-tech{transformer binding}, or if the binding does not satisfy @racket[_predicate?], then @racket[_failure-message] will be used as the error message, if it is supplied.