Didier Verna <didier@lrde.epita.fr> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) wrote:
| > So, modifying your template:
| > ;; top of the file
| > ;; ...
| > (in-package :my-package)
| >
| > (eval-when (:compile-toplevel :load-toplevel :execute)
| > (setf cl:*readtable*
| > (let ((my-rt ((copy-readtable rt))))
| > (flet ((my-func (stream sub-char infix-count)
| > ;; Only if you really do ignore them
| > (declare (ignore sub-char infix-count))
| > ...{your new syntax implemented here}...))
| > ;; Using "#$" as an example
| > (set-dispatch-macro-character #\# #\$ my-func my-rt))
| > my-rt)))
| > ;; New syntax now enabled for the rest of the file.
| > ;; ...
| > ;; bottom of file: package and readtable are restored for us!
|
| Cool :-)
+---------------
Oops! *Not* so cool after all [cut & paste sloppiness]. This line:
(let ((my-rt ((copy-readtable rt)))) ; BUG! Unbound free var RT
should be this instead:
(let ((my-rt ((copy-readtable nil)))) ; Start with standard one
Sorry 'bout that...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607