debug-scopes/test/named-scopes-test-def.rkt
Georges Dupéron 781c63d252 Cleanup
2016-12-14 18:11:25 +01:00

24 lines
616 B
Racket

#lang racket
(require (for-syntax debug-scopes/named-scopes
syntax/stx))
(begin-for-syntax
(define-syntax-rule (named-transformer (_ stx) . body) (λ (stx) . body))
(define (make-named-scope _) (make-syntax-introducer)))
(provide foo-macro bar-macro baz-macro)
(define-syntax (foo-macro stx)
(syntax-case stx ()
[(_ a)
(let ([foo-scope (make-named-scope 'my-foo-scope-wohoo)])
(foo-scope #'a))]))
(define-syntax bar-macro
(named-transformer (bar-macro stx)
#`(let ([x 1]) . #,(stx-cdr stx))))
(define-syntax (baz-macro stx)
#`(let ([x 5]) . #,(stx-cdr stx)))