(delay
(spar-call-with-values
(lambda (ctx id item)
- (receive (id senv)
- (if (closed-identifier? id)
- (values (syntactic-closure-form id)
- (syntactic-closure-senv id))
- (values id (serror-ctx-senv ctx)))
+ (let ((senv (serror-ctx-senv ctx)))
(bind-keyword id senv item)
;; User-defined macros at top level are preserved in the output.
(if (and (keyword-item-has-expr? item)
(seq-item ctx '()))))
(spar-subform)
(spar-push spar-arg:ctx)
- (spar-push-subform-if identifier? spar-arg:form)
+ (spar-subform
+ (spar-match identifier? spar-arg:form)
+ (spar-funcall reserve-identifier spar-arg:form spar-arg:senv)
+ (spar-push spar-arg:form))
(spar-subform
spar-push-classified
(spar-or (spar-match keyword-item? spar-arg:value)
subform-select)
(export (runtime syntax low)
reclassify
+ rename-id
with-error-context)
(export (runtime syntax parser)
with-error-context))
hist)))
(define (make-er-rename closing-senv)
- (lambda (identifier)
- (close-syntax identifier closing-senv)))
+ (let ((renames '()))
+ (lambda (id)
+ (guarantee identifier? id)
+ (let ((p (assq id renames)))
+ (if p
+ (cdr p)
+ (let ((rename (rename-id id closing-senv)))
+ (set! renames (cons (cons id rename) renames))
+ rename))))))
(define (make-er-compare use-senv)
(lambda (x y)
(pair? form)
(identifier? form))))
+;; Renaming for er-macro-transformer.
+;; Required for uniqueness and proper lookup.
+(define (rename-id id senv)
+ (%make-syntactic-closure senv '() id))
+
(define-record-type <syntactic-closure>
(%make-syntactic-closure senv free form)
syntactic-closure?
(free syntactic-closure-free)
(form syntactic-closure-form))
+(define-print-method syntactic-closure?
+ (standard-print-method 'syntactic-closure
+ (lambda (closure)
+ (list (syntactic-closure-form closure)))))
+
(define (strip-syntactic-closures object)
(if (let loop ((object object))
(if (pair? object)
(if+ "the same elements as" "different elements from")
(marker)
"comparing elements with" (name-of comparator)
- "in any order")))
\ No newline at end of file
+ "in any order")))\f