forked from alex-eg/sex
splice a $ nested in a macro's $
Only the outermost was taken apart, so ($ a ($ b c)) left the inner one an unknown toplevel form, and in a body a call of $ in the C.
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
;; the macro was used
|
||||
(cond
|
||||
((splice-form? res)
|
||||
(append (map (lambda (f) (stamp-form-source! f src)) (cdr res))
|
||||
(append (map (lambda (f) (stamp-form-source! f src)) (spliced res))
|
||||
rest-forms))
|
||||
((null? res) rest-forms)
|
||||
(else
|
||||
@@ -80,6 +80,11 @@
|
||||
(define (splice-form? form)
|
||||
(and (pair? form) (list? form) (eq? '$ (car form))))
|
||||
|
||||
;;; ($ a ($ b c)) is a, b and c, so a macro may build its splice out of
|
||||
;;; others'
|
||||
(define (spliced form)
|
||||
(append-map (lambda (f) (if (splice-form? f) (spliced f) (list f))) (cdr form)))
|
||||
|
||||
(define (match-sex-form sex-form acc)
|
||||
(match sex-form
|
||||
((or ('fn . _)
|
||||
|
||||
Reference in New Issue
Block a user