s-exp module reader
svn: r7787
This commit is contained in:
parent
65496a2b8e
commit
34a5cdf8ed
3
collects/s-exp/info.ss
Normal file
3
collects/s-exp/info.ss
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
(module info setup/infotab
|
||||
(define name "S-expression Module"))
|
3
collects/s-exp/lang/info.ss
Normal file
3
collects/s-exp/lang/info.ss
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
(module info setup/infotab
|
||||
(define name "S-expression Module reader"))
|
26
collects/s-exp/lang/reader.ss
Normal file
26
collects/s-exp/lang/reader.ss
Normal file
|
@ -0,0 +1,26 @@
|
|||
(module reader scheme/base
|
||||
|
||||
(provide (rename-out [*read read]
|
||||
[*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 . ,body)))))
|
Loading…
Reference in New Issue
Block a user