index a unit past its first bad form
Record plain declarations, with location and docstring, and keep going when one toplevel form is wrong. sexc --check and --symbols print that. Specs, realizations, and closure helpers stay out of the index for future rework (@alex-eg).
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
apply-macro
|
||||
defmacro
|
||||
macro-definition
|
||||
restore-macro!)
|
||||
restore-macro!
|
||||
reset-macros!)
|
||||
|
||||
(define (cat-syms s-1 s-2)
|
||||
(fmt #f s-1 s-2))
|
||||
@@ -30,7 +31,15 @@
|
||||
(define (comment . _)
|
||||
(void))
|
||||
|
||||
;;; Every name given a macro, so a later unit can take them all off.
|
||||
(define +macro-names+ (list))
|
||||
|
||||
(define (note-macro-name! name)
|
||||
(unless (memq name +macro-names+)
|
||||
(set! +macro-names+ (cons name +macro-names+))))
|
||||
|
||||
(define (register-macro name arglist body)
|
||||
(note-macro-name! name)
|
||||
(put! name 'sex-macro
|
||||
`(lambda ,arglist
|
||||
;; A macro body is ordinary Scheme, evaluated at compile
|
||||
@@ -96,9 +105,14 @@
|
||||
|
||||
(define (restore-macro! name definition)
|
||||
(if definition
|
||||
(put! name 'sex-macro definition)
|
||||
(begin (note-macro-name! name)
|
||||
(put! name 'sex-macro definition))
|
||||
(remprop! name 'sex-macro)))
|
||||
|
||||
(define (reset-macros!)
|
||||
(for-each (lambda (name) (remprop! name 'sex-macro)) +macro-names+)
|
||||
(set! +macro-names+ (list)))
|
||||
|
||||
(define (defmacro form)
|
||||
(let ((arglist (car form))
|
||||
(body (cdr form)))
|
||||
|
||||
Reference in New Issue
Block a user