mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 22:17:34 +02:00
Wrap identifier-syntax output in make-transformer
This commit is contained in:
parent
eb8582f5b1
commit
d769a7970c
1 changed files with 13 additions and 7 deletions
|
@ -381,22 +381,28 @@
|
|||
(define-current-ellipsis ellipsis)
|
||||
. body))))))
|
||||
|
||||
;; identifier-syntax definition from R6RS Libraries section 12.9
|
||||
;; identifier-syntax adapted from R6RS Libraries section 12.9
|
||||
;; (changes: use only round brackets; can't use fenders in Chibi
|
||||
;; syntax-rules; wrap the transformer procedures in make-transformer
|
||||
;; so they can be used in Chibi anywhere a syntax transformer is
|
||||
;; used, not just in {define,let,letrec}-syntax)
|
||||
(define-syntax identifier-syntax
|
||||
(syntax-rules (set!)
|
||||
((_ e)
|
||||
(make-transformer
|
||||
(lambda (x)
|
||||
(syntax-case x ()
|
||||
(id (identifier? #'id) #'e)
|
||||
((_ x (... ...)) #'(e x (... ...))))))
|
||||
((_ x (... ...)) #'(e x (... ...)))))))
|
||||
((_ (id exp1) ((set! var val) exp2))
|
||||
#;(and (identifier? #'id) (identifier? #'var))
|
||||
(make-transformer
|
||||
(make-variable-transformer
|
||||
(lambda (x)
|
||||
(syntax-case x (set!)
|
||||
((set! var val) #'exp2)
|
||||
((id x (... ...)) #'(exp1 x (... ...)))
|
||||
(id (identifier? #'id) #'exp1)))))))
|
||||
(id (identifier? #'id) #'exp1))))))))
|
||||
|
||||
;; Local variables:
|
||||
;; eval: (put '%define-syntax 'scheme-indent-function 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue