refactor code in a better way, especially for changes that will follow
svn: r15176
This commit is contained in:
parent
e95f60380e
commit
54fc941f1f
|
@ -48,31 +48,27 @@
|
||||||
#,@body
|
#,@body
|
||||||
(#%provide (rename lang:read read) (rename lang:read-syntax read-syntax)
|
(#%provide (rename lang:read read) (rename lang:read-syntax read-syntax)
|
||||||
read-properties get-info-getter get-info)
|
read-properties get-info-getter get-info)
|
||||||
(define lang #,~lang)
|
|
||||||
(define rd #,~read)
|
|
||||||
(define rds #,~read-syntax)
|
|
||||||
(define w1 #,~wrapper1)
|
|
||||||
(define w2 #,~wrapper2)
|
|
||||||
(define w2* (cond [(not w2) (lambda (in r _) (r in))]
|
|
||||||
[(procedure-arity-includes? w2 3) w2]
|
|
||||||
[else (lambda (in r _) (w2 in r))]))
|
|
||||||
(define whole? #,~whole-body-readers?)
|
|
||||||
(define (lang:read in modpath line col pos)
|
(define (lang:read in modpath line col pos)
|
||||||
;; just read and discard them in this case
|
(wrap-internal/wrapper #f #f in modpath line col pos))
|
||||||
(read-properties in modpath line col pos)
|
|
||||||
(w2* in (lambda (in)
|
|
||||||
(wrap-internal lang in rd whole?
|
|
||||||
w1 #f modpath #f line col pos))
|
|
||||||
#f))
|
|
||||||
(define (lang:read-syntax src in modpath line col pos)
|
(define (lang:read-syntax src in modpath line col pos)
|
||||||
(define props (read-properties in modpath line col pos))
|
(wrap-internal/wrapper #t src in modpath line col pos))
|
||||||
(syntax-property
|
(define (wrap-internal/wrapper stx? src in modpath line col pos)
|
||||||
(w2* in (lambda (in)
|
(let* ([props (read-properties in modpath line col pos)]
|
||||||
(wrap-internal lang in (lambda (in) (rds src in)) whole?
|
[lang #,~lang]
|
||||||
w1 #t modpath src line col pos))
|
[read (if stx? (lambda (in) (#,~read-syntax src in)) #,~read)]
|
||||||
#t)
|
[w1 #,~wrapper1]
|
||||||
'module-language
|
[w2 #,~wrapper2]
|
||||||
(vector (syntax->datum modpath) 'get-info-getter props)))
|
[whole? #,~whole-body-readers?]
|
||||||
|
[rd (lambda (in) (wrap-internal lang in read whole? w1 stx?
|
||||||
|
modpath src line col pos))]
|
||||||
|
[r (cond [(not w2) (rd in)]
|
||||||
|
[(procedure-arity-includes? w2 3) (w2 in rd stx?)]
|
||||||
|
[else (w2 in rd)])])
|
||||||
|
(if stx?
|
||||||
|
(syntax-property r 'module-language
|
||||||
|
(vector (syntax->datum modpath) 'get-info-getter
|
||||||
|
props))
|
||||||
|
r)))
|
||||||
(define (read-properties in modpath line col pos)
|
(define (read-properties in modpath line col pos)
|
||||||
;; !!! TODO
|
;; !!! TODO
|
||||||
#f)
|
#f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user