Skip to content

Commit 86859d7

Browse files
authored
Add log-resyntax-rule-condition (#490)
1 parent d93a51f commit 86859d7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

private/logger.rkt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@
66
log-resyntax-warning
77
log-resyntax-info
88
log-resyntax-debug
9+
log-resyntax-rule-condition
910
resyntax-logger)
1011

1112

13+
(require (for-syntax racket/base)
14+
syntax/parse/define)
15+
16+
17+
;@----------------------------------------------------------------------------------------------------
18+
19+
1220
(define-logger resyntax)
21+
22+
23+
(define (log-resyntax-rule-condition-impl v #:line line-num #:datum datum)
24+
(unless v
25+
(log-resyntax-debug "rule condition ~a on line ~a failed" datum line-num))
26+
v)
27+
28+
29+
(define-syntax-parse-rule (log-resyntax-rule-condition expr:expr)
30+
#:with line (syntax-line (attribute expr))
31+
(log-resyntax-rule-condition-impl expr #:line 'line #:datum 'expr))

0 commit comments

Comments
 (0)