Extended report-datum to be friendly to eof.

read-syntax returns either a syntax or eof. This allows report-datum
to be used to debug read-syntax issues.
pull/23/head
Ryan Davis 6 years ago committed by Matthew Butterick
parent d0f5fa76a9
commit 83206c4521

@ -12,9 +12,11 @@
(define-macro-cases report-datum
[(_ STX-EXPR) #`(report-datum STX-EXPR #,(syntax->datum #'STX-EXPR))]
[(_ STX-EXPR NAME)
#'(let ()
(eprintf "~a = ~v\n" 'NAME (syntax->datum STX-EXPR))
STX-EXPR)])
#'(let ([stx STX-EXPR])
(eprintf "~a = ~v\n" 'NAME (if (eof-object? stx)
stx
(syntax->datum stx)))
stx)])
(define-macro (define-multi-version MULTI-NAME NAME)
#'(define-macro (MULTI-NAME X (... ...))

Loading…
Cancel
Save