module-reader constructs proper source information, fix s-exp reader to use it

svn: r11769
This commit is contained in:
Eli Barzilay 2008-09-15 23:01:06 +00:00
parent d165c586af
commit 0b2f559e29
2 changed files with 8 additions and 2 deletions

View File

@ -5,4 +5,4 @@
(let* ([mod* (rd in)]
[mod (if stx? (syntax->list mod*) mod*)]
[mod `(,(car mod) ,(cadr mod) ,@(cdddr mod))])
(if stx? (datum->syntax mod* mod) mod))))
(if stx? (datum->syntax mod* mod mod*) mod))))

View File

@ -74,6 +74,12 @@
[body (cond [(not wrapper) (body)]
[(procedure-arity-includes? wrapper 2) (wrapper body stx?)]
[else (wrapper body)])]
[all-loc (vector src line col pos
(let-values ([(l c p) (port-next-location port)])
(and p (- p pos))))]
[body (if (and stx? (not (syntax? body)))
(datum->syntax #f body all-loc)
body)]
[p-name (object-name port)]
[name (if (path? p-name)
(let-values ([(base name dir?) (split-path p-name)])
@ -89,7 +95,7 @@
v))]
[lib (if stx? (datum->syntax #f lib modpath modpath) lib)]
[r `(,(tag-src 'module) ,(tag-src name) ,lib . ,body)])
(if stx? (datum->syntax #f r) r)))
(if stx? (datum->syntax #f r all-loc) r)))
(define (wrap lib port read modpath src line col pos)
(wrap-internal lib port read #f #f #f modpath src line col pos))