mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 21:59:17 +02:00
Ditch the syntax-case version of identifier-syntax now it’s in core
This commit is contained in:
parent
d6b13db503
commit
51b0203dc5
2 changed files with 1 additions and 25 deletions
|
@ -381,29 +381,6 @@
|
||||||
(define-current-ellipsis ellipsis)
|
(define-current-ellipsis ellipsis)
|
||||||
. body))))))
|
. body))))))
|
||||||
|
|
||||||
;; 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 (... ...)))))))
|
|
||||||
((_ (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))))))))
|
|
||||||
|
|
||||||
;; Local variables:
|
;; Local variables:
|
||||||
;; eval: (put '%define-syntax 'scheme-indent-function 1)
|
;; eval: (put '%define-syntax 'scheme-indent-function 1)
|
||||||
;; End:
|
;; End:
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
datum->syntax syntax->datum
|
datum->syntax syntax->datum
|
||||||
generate-temporaries with-syntax syntax-violation
|
generate-temporaries with-syntax syntax-violation
|
||||||
with-ellipsis ellipsis-identifier?
|
with-ellipsis ellipsis-identifier?
|
||||||
define-syntax let-syntax letrec-syntax
|
define-syntax let-syntax letrec-syntax)
|
||||||
make-variable-transformer identifier-syntax)
|
|
||||||
(import (rename (chibi)
|
(import (rename (chibi)
|
||||||
(define-syntax %define-syntax)
|
(define-syntax %define-syntax)
|
||||||
(let-syntax %let-syntax)
|
(let-syntax %let-syntax)
|
||||||
|
|
Loading…
Add table
Reference in a new issue