src/readtable.lisp @ 2153d3a110dd

Add LICENSE
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Mar 2017 13:34:50 +0000
parents ddcf7ddf78f6
children d6aa232e6306
(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))
  `(gen ,(read stream t t t)))

(defun gen-string-reader (stream char)
  (declare (ignore char))
  `(gen-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)))