1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
6 (in-package :iolib.base
)
10 (defgeneric enable-reader-macro
* (name))
12 (defgeneric disable-reader-macro
* (name))
14 (defmacro enable-reader-macro
(name)
15 `(eval-when (:compile-toplevel
)
16 (enable-reader-macro* ,name
)))
18 (defmacro disable-reader-macro
(name)
19 `(eval-when (:compile-toplevel
)
20 (disable-reader-macro* ,name
)))
22 (defun save-old-readtable (symbol readtable
)
23 (setf (getf (symbol-plist symbol
) 'old-readtable
) readtable
))
25 (defun get-old-readtable (symbol)
26 (getf (symbol-plist symbol
) 'old-readtable
))
28 (defmethod enable-reader-macro* :before
((name symbol
))
29 (save-old-readtable name
*readtable
*)
30 (setf *readtable
* (copy-readtable)))
32 (defmethod disable-reader-macro* ((name symbol
))
33 (assert (readtablep (get-old-readtable name
)))
34 (setf *readtable
* (get-old-readtable name
))
35 (save-old-readtable name nil
))
37 (defmacro define-syntax
(name &body body
)
38 `(defmethod enable-reader-macro* ((name (eql ',name
)))