1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

look up scheme translators by value, not by name

* module/language/scheme/translate.scm (custom-transformer-table): Rename
  from `primitive-syntax-table', because now it will handle procedural
  values as well.
  (lookup-transformer): Update for renaming. Look up custom transformers
  by value, not name.
  (make-pmatch-transformers): Key the transformer table by value, not
  name.
This commit is contained in:
Andy Wingo 2008-09-14 14:26:29 +02:00
parent f03c31dbad
commit 7e97ad2dd6

View file

@ -58,10 +58,7 @@
;; definition forward-declared them ;; definition forward-declared them
(and (variable-bound? var) (variable-ref var))))))) (and (variable-bound? var) (variable-ref var)))))))
(cond (cond
((or (primitive-macro? val) ((assq-ref custom-transformer-table val))
(eq? val eval-case))
(or (assq-ref primitive-syntax-table head)
(syntax-error #f "unhandled primitive macro" head)))
((defmacro? val) ((defmacro? val)
(lambda (env loc exp) (lambda (env loc exp)
@ -77,6 +74,9 @@
(with-fluids ((eec (module-eval-closure mod))) (with-fluids ((eec (module-eval-closure mod)))
(sc-expand3 exp 'c '(compile load eval))))))) (sc-expand3 exp 'c '(compile load eval)))))))
((primitive-macro? val)
(syntax-error #f "unhandled primitive macro" head))
((macro? val) ((macro? val)
(syntax-error #f "unknown kind of macro" head)) (syntax-error #f "unknown kind of macro" head))
@ -121,7 +121,7 @@
(define (make1 clause) (define (make1 clause)
(let ((sym (car clause)) (let ((sym (car clause))
(clauses (cdr clause))) (clauses (cdr clause)))
`(cons ',sym `(cons ,sym
(lambda (,env ,loc ,exp) (lambda (,env ,loc ,exp)
(define (,retranslate x) (trans ,env (location x) x)) (define (,retranslate x) (trans ,env (location x) x))
(pmatch (cdr ,exp) (pmatch (cdr ,exp)
@ -131,7 +131,7 @@
(define *the-compile-toplevel-symbol* 'compile-toplevel) (define *the-compile-toplevel-symbol* 'compile-toplevel)
(define primitive-syntax-table (define custom-transformer-table
(make-pmatch-transformers (make-pmatch-transformers
e l retrans e l retrans
(quote (quote