add `report-datum`

pull/2/head
Matthew Butterick 9 years ago
parent fad5a4fce8
commit 9b47039c0a

@ -10,6 +10,15 @@
(eprintf "~a = ~v\n" 'name expr-result) (eprintf "~a = ~v\n" 'name expr-result)
expr-result)])) expr-result)]))
(define-syntax (report-datum stx)
(syntax-case stx ()
[(_ stx-expr) (with-syntax ([datum (syntax->datum #'stx-expr)])
#'(report-datum stx-expr datum))]
[(_ stx-expr name)
#'(let ()
(eprintf "~a = ~v\n" 'name (syntax->datum stx-expr))
stx-expr)]))
(define-syntax-rule (define-multi-version multi-name name) (define-syntax-rule (define-multi-version multi-name name)
(define-syntax-rule (multi-name x (... ...)) (define-syntax-rule (multi-name x (... ...))
(begin (name x) (... ...)))) (begin (name x) (... ...))))

@ -1,4 +1,5 @@
#lang br #lang br
(require (for-syntax br/syntax))
(provide (all-defined-out)) (provide (all-defined-out))
(define #'(introduce-scope _color . _parents) (define #'(introduce-scope _color . _parents)
@ -16,7 +17,7 @@
(replace-context #'_color (replace-context #'_color
#'(begin #'(begin
(module module-name br (module module-name br
(require (for-syntax br/datum br/scope)) (require (for-syntax br/datum br/scope br/syntax))
(provide (for-syntax (all-defined-out)) (all-defined-out)) (provide (for-syntax (all-defined-out)) (all-defined-out))
(begin-for-syntax (begin-for-syntax

Loading…
Cancel
Save