svn: r7350

original commit: 001404dec0ddf49e774ecac33df6601c4e1b542c
This commit is contained in:
Matthew Flatt 2007-09-15 22:27:14 +00:00
parent 84d56bf80c
commit 37265a7250

View File

@ -0,0 +1,26 @@
(module reader mzscheme
(provide (rename *read read)
(rename *read-syntax read-syntax))
(define (*read in)
(wrap in read))
(define (*read-syntax src in)
(wrap in (lambda (in)
(read-syntax src in))))
(define (wrap port read)
(let ([body
(let loop ([a null])
(let ([v (read port)])
(if (eof-object? v)
(reverse a)
(loop (cons v a)))))])
(let* ([p-name (object-name port)]
[name (if (path? p-name)
(let-values ([(base name dir?) (split-path p-name)])
(string->symbol (path->string (path-replace-suffix name #""))))
'page)]
[id 'doc])
`(module ,name mzscheme
. ,body)))))