src/readtable.lisp @ d0338a96e265

Update URLs
author Steve Losh <steve@stevelosh.com>
date Mon, 23 Dec 2019 16:18:36 -0500
parents d6aa232e6306
children (none)
(in-package :chancery)

(defun vector-reader (stream char)
  (declare (ignore char))
  (coerce (read-delimited-list #\] stream t) 'vector))


(defun eval-reader (stream char)
  (declare (ignore char))
  `(eval ,(read stream t t t)))

(defun gen-reader (stream char)
  (declare (ignore char))
  `(generate ,(read stream t t t)))

(defun gen-string-reader (stream char)
  (declare (ignore char))
  `(generate-string ,(read stream t t t)))


(named-readtables:defreadtable :chancery
  (:merge :standard)
  (:macro-char #\$ #'gen-string-reader nil)
  (:macro-char #\@ #'gen-reader nil)
  (:macro-char #\! #'eval-reader nil)
  (:macro-char #\[ #'vector-reader t)
  (:macro-char #\] (get-macro-character #\) nil)))