extend syntax/module-reader to avoid ugly hack in scribble/doc/reader

svn: r11517

original commit: eaa5a69fa500c18b658199dfac0fa96bc19084cd
This commit is contained in:
Eli Barzilay 2008-09-02 04:06:08 +00:00
parent 42d983a3cf
commit 970dcd1ab0

View File

@ -2,22 +2,9 @@
scribble/doclang
;; `read-inside' reads the whole body, so make wrapper1 return null so
;; we get the right syntax, and then make wrapper2 do the actual
;; reading. This might seem extreme, but I think that it's still
;; better to use module-reader for the subtleties it deals with.
#:wrapper1 (lambda (t) '())
#:wrapper2
(lambda (in read stx?)
(let* ([skeleton (read in)]
[skeleton (if stx? (syntax->list skeleton) skeleton)]
[body (if stx?
(scribble:read-syntax-inside (object-name in) in)
(scribble:read-inside in))]
[mod `(,(car skeleton) ,(cadr skeleton) ,(caddr skeleton)
(#%module-begin doc () . ,body))])
(if stx? (datum->syntax #f mod) mod)))
#:read scribble:read-inside
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 (lambda (t) (list* 'doc '() (t)))
(require (prefix-in scribble: "../reader.ss"))