[honu] add phase{ ... }, which is like begin-for-syntax

This commit is contained in:
Jon Rafkind 2012-10-07 10:32:14 -06:00
parent f91d9ded25
commit d7ebe6599c
2 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,7 @@
[honu-new new] [honu-new new]
[honu-while while] [honu-while while]
[honu-macro macro] [honu-macro macro]
[honu-phase phase]
[honu-primitive-macro primitive_macro] [honu-primitive-macro primitive_macro]
[honu-pattern pattern] [honu-pattern pattern]
[racket:read-line readLine] [racket:read-line readLine]

View File

@ -449,3 +449,13 @@
(make name)))) (make name))))
#'rest #'rest
#f)]))) #f)])))
;; like begin-for-syntax
(provide honu-phase)
(define-honu-syntax honu-phase
(lambda (code)
(syntax-parse code #:literal-sets (cruft)
[(_ (#%braces body ...) . rest)
(define out
(phase1:racket-syntax (begin-for-syntax (parse-stuff body ...))))
(values out #'rest #t)])))