named-scopes-test-def.rkt (616B)
1 #lang racket 2 3 (require (for-syntax debug-scopes/named-scopes 4 syntax/stx)) 5 6 (begin-for-syntax 7 (define-syntax-rule (named-transformer (_ stx) . body) (λ (stx) . body)) 8 (define (make-named-scope _) (make-syntax-introducer))) 9 10 (provide foo-macro bar-macro baz-macro) 11 12 (define-syntax (foo-macro stx) 13 (syntax-case stx () 14 [(_ a) 15 (let ([foo-scope (make-named-scope 'my-foo-scope-wohoo)]) 16 (foo-scope #'a))])) 17 18 (define-syntax bar-macro 19 (named-transformer (bar-macro stx) 20 #`(let ([x 1]) . #,(stx-cdr stx)))) 21 22 (define-syntax (baz-macro stx) 23 #`(let ([x 5]) . #,(stx-cdr stx)))