pull/2/head
Matthew Butterick 8 years ago
parent f5078fb50b
commit adda7adb88

@ -9,7 +9,7 @@
syntax/define
racket/string))
(provide (all-defined-out)
(for-syntax with-shared-id with-calling-site-id))
(for-syntax with-shared-id))
(module+ test
(require rackunit))
@ -116,9 +116,10 @@
(begin-for-syntax
(define-syntax-rule (with-shared-id (id ...) . body)
(with-syntax ([id (shared-syntax 'id)] ...)
. body))
(define-syntax with-calling-site-id (make-rename-transformer #'with-shared-id)))
(with-syntax ([id (datum->syntax caller-stx (if (syntax? id)
(syntax-e id)
id))] ...)
. body)))
;; `syntax-parse` classes shared by `define-macro` and `define-macro-cases`
@ -172,8 +173,8 @@
(define result
(syntax-parameterize ([caller-stx (make-rename-transformer #'stx)])
(syntax-case stx LITERALS
[pat . result-exprs] ...
else-clause)))
[pat . result-exprs] ...
else-clause)))
(if (syntax? result)
result
(datum->syntax #'id result)))))]

@ -6,17 +6,10 @@
(all-from-out racket/list racket/string racket/format racket/match racket/port
br/syntax br/datum br/debug br/cond racket/function br/define)
(for-syntax (all-from-out racket/base racket/syntax br/syntax br/debug))
(for-syntax caller-stx with-shared-id with-calling-site-id)) ; from br/define
(for-syntax caller-stx with-shared-id)) ; from br/define
;; todo: activate at-exp reader by default
(define (remove-blank-lines strs)
(filter (λ(str) (regexp-match #px"\\S" str)) strs))
(provide remove-blank-lines)
(module reader syntax/module-reader
#:language 'br
#:info br-get-info

@ -6,7 +6,7 @@
#'(begin OP-OR-LOOP ...))
(provide bf-program)
(define-macro op
(define-macro-cases op
[(op ">") #'(move-pointer 1)]
[(op "<") #'(move-pointer -1)]
[(op "+") #'(set-current-byte! (add1 (get-current-byte)))]

Loading…
Cancel
Save