mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
WIP, universal macro exception handler
This commit is contained in:
parent
c37e8dfad9
commit
1670670968
2 changed files with 19 additions and 17 deletions
|
@ -239,9 +239,8 @@
|
|||
(let* ((found (assoc expr *source-loc-lis*))
|
||||
(loc-vec (if found
|
||||
(cdr found) ;; Get value
|
||||
#f)))
|
||||
(if loc-vec
|
||||
(error
|
||||
#f))
|
||||
(msg (if loc-vec
|
||||
(string-append
|
||||
"("
|
||||
(vector-ref loc-vec 0)
|
||||
|
@ -251,10 +250,10 @@
|
|||
(number->string (vector-ref loc-vec 2))
|
||||
") "
|
||||
reason)
|
||||
(if (pair? args) args expr))
|
||||
(error
|
||||
reason
|
||||
(if (pair? args) args expr))))
|
||||
reason)))
|
||||
(if (pair? args)
|
||||
(apply error (cons msg args))
|
||||
(error msg expr))))
|
||||
|
||||
;; Features implemented by this Scheme
|
||||
(define (features)
|
||||
|
|
|
@ -829,6 +829,9 @@
|
|||
|
||||
;; Invoke ER macro
|
||||
(set! result
|
||||
(with-handler
|
||||
(lambda (err)
|
||||
(apply error/loc (append (list (car err) exp) (cdr err))) )
|
||||
(cond
|
||||
((not macro)
|
||||
(error "macro not found" exp))
|
||||
|
@ -844,7 +847,7 @@
|
|||
(list 'quote exp)
|
||||
(Cyc-er-rename use-env mac-env local-renamed)
|
||||
(Cyc-er-compare? use-env rename-env))
|
||||
mac-env))))
|
||||
mac-env)))))
|
||||
;(newline)
|
||||
;(display "/* ")
|
||||
;(write (list 'macro:expand exp macro compiled-macro?))
|
||||
|
|
Loading…
Add table
Reference in a new issue