Allow use of strip-annotations and peel-annotations as identifiers

This commit is contained in:
Tony Garnock-Jones 2019-08-23 22:00:52 +01:00
parent 6f4e06f6b9
commit f09067d719
1 changed files with 9 additions and 2 deletions

View File

@ -36,6 +36,7 @@
(require "varint.rkt")
(require (only-in syntax/readerr raise-read-error raise-read-eof-error))
(require net/base64)
(require (for-syntax racket/base))
(struct stream-of (kind generator-thunk) #:transparent)
@ -81,11 +82,17 @@
(define-match-expander strip-annotations
(syntax-rules () [(_ pat extra ...) (app (lambda (v) (strip-annotations-proc v extra ...)) pat)])
(syntax-rules () [(_ args ...) (strip-annotations-proc args ...)]))
(lambda (stx)
(syntax-case stx ()
[(_ args ...) #'(strip-annotations-proc args ...)]
[_ #'strip-annotations-proc])))
(define-match-expander peel-annotations
(syntax-rules () [(_ pat extra ...) (app (lambda (v) (peel-annotations-proc v extra ...)) pat)])
(syntax-rules () [(_ args ...) (peel-annotations-proc args ...)]))
(lambda (stx)
(syntax-case stx ()
[(_ args ...) #'(peel-annotations-proc args ...)]
[_ #'peel-annotations-proc])))
(define current-value->placeholder (make-parameter (lambda (v) #f)))
(define current-placeholder->value (make-parameter (lambda (v) (void))))