commit c17636d399bf70c91d348854bd6ebce6306a87b3
parent ef02b4039cc852c0eeec94a48352d27ab61ed54a
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sat, 3 Dec 2011 10:03:13 -0700
fix `defform[*]' handling of #:id and grammar production
In @defform*[#:id x1 [(qqq x1)]], for example, `#:id x1' needs to
calcel the default treatment of `x1' within `(qqq x1)' as
a metavariable, while treating `qqq' as a meta-variable.
original commit: 7d2914fc8a8f2647605da1d6699d0bc54685a5f3
Diffstat:
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/collects/scribble/private/manual-form.rkt b/collects/scribble/private/manual-form.rkt
@@ -55,7 +55,7 @@
(syntax->list #'(lit ...)))
#'(with-togetherable-racket-variables
(lit ...)
- ([form spec] [form spec1] ...
+ ([form [defined-id spec]] [form [defined-id spec1]] ...
[non-term (non-term-id non-term-form ...)] ...)
(*defforms defined-id-expr
'(spec spec1 ...)
diff --git a/collects/scribble/private/manual-vars.rkt b/collects/scribble/private/manual-vars.rkt
@@ -75,12 +75,18 @@
(do-proc (car s-exp)))))])
(do-proc s-exp))]
[(form form/none form/maybe non-term)
+ (define skip-id (case (syntax-e kind)
+ [(form)
+ (syntax-case s-exp ()
+ [(defined-id actual-s-exp) (let ([id #'defined-id])
+ (and (identifier? id)
+ id))]
+ [_ #f])]
+ [else #f]))
(let loop ([form (case (syntax-e kind)
- [(form) (if (identifier? s-exp)
- null
- (if (pair? (syntax-e s-exp))
- (cdr (syntax-e s-exp))
- null))]
+ [(form)
+ (syntax-case s-exp ()
+ [(defined-id actual-s-exp) #'actual-s-exp])]
[(form/none) s-exp]
[(form/maybe)
(syntax-case s-exp ()
@@ -88,7 +94,9 @@
[(#t (id . form)) #'form])]
[(non-term) s-exp])])
(if (identifier? form)
- (unless (or (eq? (syntax-e form) '...)
+ (unless (or (and skip-id
+ (free-identifier=? skip-id form))
+ (eq? (syntax-e form) '...)
(eq? (syntax-e form) '...+)
(eq? (syntax-e form) 'code:line)
(eq? (syntax-e form) 'code:blank)