mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-13 07:10:20 +02:00
more cleanups to boot-9/psyntax
* module/ice-9/boot-9.scm: Comment some more things. * module/ice-9/psyntax.scm: Remove error-hook -- callers should just use syntax-violation. Change all callers. * module/ice-9/psyntax-pp.scm: Regenerated.
This commit is contained in:
parent
4d24854111
commit
6a952e0ee9
3 changed files with 39 additions and 45 deletions
|
@ -186,6 +186,9 @@
|
||||||
(define (resolve-module . args)
|
(define (resolve-module . args)
|
||||||
#f)
|
#f)
|
||||||
|
|
||||||
|
;; Output hook for syncase. It's here because we want to be able to
|
||||||
|
;; replace its definition, for compiling; but that isn't implemented
|
||||||
|
;; yet.
|
||||||
(define (make-module-ref mod var kind)
|
(define (make-module-ref mod var kind)
|
||||||
(case kind
|
(case kind
|
||||||
((public) (if mod `(@ ,mod ,var) var))
|
((public) (if mod `(@ ,mod ,var) var))
|
||||||
|
@ -200,7 +203,12 @@
|
||||||
var))
|
var))
|
||||||
(else (error "foo" mod var kind))))
|
(else (error "foo" mod var kind))))
|
||||||
|
|
||||||
;;; API provided by psyntax
|
;; Input hook to syncase -- so that we might be able to pass annotated
|
||||||
|
;; expressions in. Currently disabled. Maybe we should just use
|
||||||
|
;; source-properties directly.
|
||||||
|
(define (annotation? x) #f)
|
||||||
|
|
||||||
|
;; API provided by psyntax
|
||||||
(define syntax-violation #f)
|
(define syntax-violation #f)
|
||||||
(define datum->syntax #f)
|
(define datum->syntax #f)
|
||||||
(define syntax->datum #f)
|
(define syntax->datum #f)
|
||||||
|
@ -211,24 +219,21 @@
|
||||||
(define sc-expand #f)
|
(define sc-expand #f)
|
||||||
(define sc-expand3 #f)
|
(define sc-expand3 #f)
|
||||||
|
|
||||||
;;; Implementation detail of psyntax -- the thing that does expand-time
|
;; $sc-expand is an implementation detail of psyntax. It is used by
|
||||||
;;; dispatch for syntax-case macros
|
;; expanded macros, to dispatch an input against a set of patterns.
|
||||||
(define $sc-dispatch #f)
|
(define $sc-dispatch #f)
|
||||||
|
|
||||||
;;; Useless crap I'd like to get rid of
|
;; Load it up!
|
||||||
(define (annotation? x) #f)
|
|
||||||
|
|
||||||
(primitive-load-path "ice-9/psyntax-pp")
|
(primitive-load-path "ice-9/psyntax-pp")
|
||||||
|
|
||||||
;; Until the module system is booted, this will be the current expander.
|
;; %pre-modules-transformer is the Scheme expander from now until the
|
||||||
|
;; module system has booted up.
|
||||||
(define %pre-modules-transformer sc-expand)
|
(define %pre-modules-transformer sc-expand)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; {Defmacros}
|
;;; {Defmacros}
|
||||||
;;;
|
;;;
|
||||||
;;; Depends on: features, eval-case
|
|
||||||
;;;
|
|
||||||
|
|
||||||
(define-syntax define-macro
|
(define-syntax define-macro
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -109,13 +109,6 @@
|
||||||
;;; by eval, and eval accepts one argument, nothing special must be done
|
;;; by eval, and eval accepts one argument, nothing special must be done
|
||||||
;;; to support the "noexpand" flag, since it is handled by sc-expand.
|
;;; to support the "noexpand" flag, since it is handled by sc-expand.
|
||||||
;;;
|
;;;
|
||||||
;;; (error who format-string why what)
|
|
||||||
;;; where who is either a symbol or #f, format-string is always "~a ~s",
|
|
||||||
;;; why is always a string, and what may be any object. error should
|
|
||||||
;;; signal an error with a message something like
|
|
||||||
;;;
|
|
||||||
;;; "error in <who>: <why> <what>"
|
|
||||||
;;;
|
|
||||||
;;; (gensym)
|
;;; (gensym)
|
||||||
;;; returns a unique symbol each time it's called
|
;;; returns a unique symbol each time it's called
|
||||||
;;;
|
;;;
|
||||||
|
@ -325,10 +318,6 @@
|
||||||
(lambda (x mod)
|
(lambda (x mod)
|
||||||
(primitive-eval `(,noexpand ,x))))
|
(primitive-eval `(,noexpand ,x))))
|
||||||
|
|
||||||
(define error-hook
|
|
||||||
(lambda (who why what)
|
|
||||||
(error who "~a ~s" why what)))
|
|
||||||
|
|
||||||
(define-syntax gensym-hook
|
(define-syntax gensym-hook
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((_) (gensym))))
|
((_) (gensym))))
|
||||||
|
@ -488,7 +477,7 @@
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((_ pred? e who)
|
((_ pred? e who)
|
||||||
(let ((x e))
|
(let ((x e))
|
||||||
(if (not (pred? x)) (error-hook who "invalid argument" x))))))
|
(if (not (pred? x)) (syntax-violation who "invalid argument" x))))))
|
||||||
|
|
||||||
;;; compile-time environments
|
;;; compile-time environments
|
||||||
|
|
||||||
|
@ -808,7 +797,7 @@
|
||||||
((annotation? id)
|
((annotation? id)
|
||||||
(let ((id (unannotate id)))
|
(let ((id (unannotate id)))
|
||||||
(or (first (search id (wrap-subst w) (wrap-marks w))) id)))
|
(or (first (search id (wrap-subst w) (wrap-marks w))) id)))
|
||||||
(else (error-hook 'id-var-name "invalid id" id)))))
|
(else (syntax-violation 'id-var-name "invalid id" id)))))
|
||||||
|
|
||||||
;;; free-id=? must be passed fully wrapped ids since (free-id=? x y)
|
;;; free-id=? must be passed fully wrapped ids since (free-id=? x y)
|
||||||
;;; may be true even if (free-id=? (wrap x w) (wrap y w)) is not.
|
;;; may be true even if (free-id=? (wrap x w) (wrap y w)) is not.
|
||||||
|
@ -2318,17 +2307,17 @@
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(syntax-case x ()
|
(syntax-case x ()
|
||||||
((_ e)
|
((_ e)
|
||||||
(error 'unquote
|
(syntax-violation 'unquote
|
||||||
"expression ,~s not valid outside of quasiquote"
|
"expression not valid outside of quasiquote"
|
||||||
(syntax->datum (syntax e)))))))
|
x)))))
|
||||||
|
|
||||||
(define-syntax unquote-splicing
|
(define-syntax unquote-splicing
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(syntax-case x ()
|
(syntax-case x ()
|
||||||
((_ e)
|
((_ e)
|
||||||
(error 'unquote-splicing
|
(syntax-violation 'unquote-splicing
|
||||||
"expression ,@~s not valid outside of quasiquote"
|
"expression not valid outside of quasiquote"
|
||||||
(syntax->datum (syntax e)))))))
|
x)))))
|
||||||
|
|
||||||
(define-syntax case
|
(define-syntax case
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue