some more reformatting etc, at all levels (and the schememodname went away, again -- will get it back soon with the lifting of requires)
svn: r13649 original commit: 8f0edfd6d592cc8bfb9d72aca8629224dfa3b0d3
This commit is contained in:
parent
8e9347bc09
commit
b4f877bd45
|
@ -11,19 +11,19 @@
|
|||
(define (mapping-get mapping id)
|
||||
(free-identifier-mapping-get mapping id (lambda () '())))
|
||||
;; maps a block identifier to its collected expressions
|
||||
(define code-blocks (make-free-identifier-mapping))
|
||||
(define chunks (make-free-identifier-mapping))
|
||||
;; maps a block identifier to all identifiers that are used to define it
|
||||
(define block-groups (make-free-identifier-mapping))
|
||||
(define (get-block id)
|
||||
(map syntax-local-introduce (mapping-get code-blocks id)))
|
||||
(map syntax-local-introduce (mapping-get chunks id)))
|
||||
(define (add-to-block! id exprs)
|
||||
(unless main-id (set! main-id id))
|
||||
(free-identifier-mapping-put!
|
||||
block-groups id
|
||||
(cons (syntax-local-introduce id) (mapping-get block-groups id)))
|
||||
(free-identifier-mapping-put!
|
||||
code-blocks id
|
||||
`(,@(mapping-get code-blocks id) ,@(map syntax-local-introduce exprs)))))
|
||||
chunks id
|
||||
`(,@(mapping-get chunks id) ,@(map syntax-local-introduce exprs)))))
|
||||
|
||||
(define-syntax (chunk stx)
|
||||
(syntax-case stx ()
|
||||
|
@ -35,7 +35,7 @@
|
|||
#f "chunk names must begin and end with angle brackets, <...>"
|
||||
stx #'name)]
|
||||
[else (add-to-block! #'name (syntax->list #'(expr ...)))
|
||||
#`(void)])]))
|
||||
#'(void)])]))
|
||||
|
||||
(define-syntax (tangle stx)
|
||||
(define block-mentions '())
|
||||
|
@ -67,7 +67,8 @@
|
|||
(define-syntax (module-begin stx)
|
||||
(syntax-case stx ()
|
||||
[(module-begin expr ...)
|
||||
(let ([body-code
|
||||
(with-syntax
|
||||
([(body-code ...)
|
||||
(let loop ([exprs (syntax->list #'(expr ...))])
|
||||
(cond
|
||||
[(null? exprs) null]
|
||||
|
@ -93,8 +94,6 @@
|
|||
#%provide)))
|
||||
(cons expanded (loop (cdr exprs)))]
|
||||
[else (loop (cdr exprs))]))]))])
|
||||
|
||||
(with-syntax ([(body-code ...) body-code])
|
||||
#'(#%module-begin
|
||||
body-code ...
|
||||
(tangle))))]))
|
||||
(tangle)))]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user