Revert previous bad addition to trunk, forgot to switch first.

svn: r17147
This commit is contained in:
Stevie Strickland 2009-12-01 20:36:38 +00:00
parent a22d201d85
commit 53eb309b75
4 changed files with 6 additions and 35 deletions

View File

@ -316,8 +316,6 @@
(let loop ([sexp full-sexp]) (let loop ([sexp full-sexp])
(match sexp (match sexp
[`((#%module-begin ,body ...))
(loop body)]
[`((provide/doc (,x ,name ,ctc ,other ...) ...) ,rest ...) [`((provide/doc (,x ,name ,ctc ,other ...) ...) ,rest ...)
#`(let #,(map (λ (name ctc) #`(let #,(map (λ (name ctc)
(with-syntax ([name (datum->syntax #'tool-name name)] (with-syntax ([name (datum->syntax #'tool-name name)]
@ -333,7 +331,7 @@
[`(,a . ,b) [`(,a . ,b)
(loop b)] (loop b)]
[`() [`()
(error 'tcl.ss "did not find provide/doc: ~a" full-sexp)])))])) (error 'tcl.ss "did not find provide/doc" full-sexp)])))]))
;; invoke-tool : unit/sig string -> (values (-> void) (-> void)) ;; invoke-tool : unit/sig string -> (values (-> void) (-> void))
;; invokes the tools and returns the two phase thunks. ;; invokes the tools and returns the two phase thunks.

View File

@ -7,8 +7,8 @@
(provide lp-include) (provide lp-include)
(define-syntax (module stx) (define-syntax (module stx)
(syntax-case stx (#%module-begin) (syntax-case stx ()
[(module name base (#%module-begin body ...)) [(module name base body ...)
(begin (begin
#'(begin body ...))])) #'(begin body ...))]))

View File

@ -10,20 +10,6 @@
(define ar? procedure-arity-includes?) (define ar? procedure-arity-includes?)
;; Takes either a syntax object representing a list of expressions
;; or a list of s-expressions, and checks to see if it's a single
;; expression that begins with the literal #%module-begin.
(define (contains-#%module-begin exps)
(let ([exps (if (syntax? exps) (syntax->list exps) exps)])
(and exps
(pair? exps)
(null? (cdr exps))
(let ([exp (car exps)])
(let ([lst (if (syntax? exp) (syntax->list exp) exp)])
(and lst
(let ([head (if (syntax? (car lst)) (syntax-e (car lst)) (car lst))])
(eq? '#%module-begin head))))))))
(define-syntax (provide-module-reader stx) (define-syntax (provide-module-reader stx)
(define (err str [sub #f]) (define (err str [sub #f])
(raise-syntax-error 'syntax/module-reader str sub)) (raise-syntax-error 'syntax/module-reader str sub))
@ -184,15 +170,7 @@
(- (or (syntax-position modpath) (add1 pos)) (- (or (syntax-position modpath) (add1 pos))
pos))) pos)))
v))] v))]
;; Since there are users that wrap with #%module-begin in their reader, [r `(,(tag-src 'module) ,(tag-src name) ,lang . ,body)])
;; we need to avoid double-wrapping.
[wrapped-body (if (contains-#%module-begin body)
body
(let ([wrapped `(#%module-begin . ,body)])
(if stx?
(datum->syntax #f wrapped all-loc)
wrapped)))]
[r `(,(tag-src 'module) ,(tag-src name) ,lang ,wrapped-body)])
(if stx? (datum->syntax #f r all-loc) r))) (if stx? (datum->syntax #f r all-loc) r)))
(define (wrap lang port read modpath src line col pos) (define (wrap lang port read modpath src line col pos)

View File

@ -46,7 +46,7 @@ into
@schemeblock[ @schemeblock[
(module _name-id module-path (module _name-id module-path
(#%module-begin ....)) ....)
] ]
where @scheme[_name-id] is derived from the name of the port used by where @scheme[_name-id] is derived from the name of the port used by
@ -136,12 +136,7 @@ In some cases, the reader functions read the whole file, so there is
no need to iterate them (e.g., Scribble's @scheme[read-inside] and no need to iterate them (e.g., Scribble's @scheme[read-inside] and
@scheme[read-syntax-inside]). In these cases you can specify @scheme[read-syntax-inside]). In these cases you can specify
@scheme[#:whole-body-readers?] as @scheme[#t] --- the readers are @scheme[#:whole-body-readers?] as @scheme[#t] --- the readers are
expected to return a list of expressions in this case. If those expected to return a list of expressions in this case.
reader functions return a list with a single expression that begins
with @scheme[#%module-begin], then the @scheme[syntax/module-reader]
language will not inappropriately add another. This is to be
backwards-compatible with older code, and adding @scheme[#%module-begin]
in the reader functions should be considered deprecated behavior.
In addition, the two wrappers can return a different value than the In addition, the two wrappers can return a different value than the
wrapped function. This introduces two more customization points for wrapped function. This introduces two more customization points for