Define reader #+common-lisp and #+lispstrack to compile conditionally
authorDavid Vazquez <davazp@gmail.com>
Sun, 16 Dec 2012 22:58:34 +0000 (22:58 +0000)
committerDavid Vazquez <davazp@gmail.com>
Sun, 16 Dec 2012 22:58:34 +0000 (22:58 +0000)
lispstrack.lisp

index 234750a..ab8118b 100644 (file)
@@ -67,7 +67,7 @@
       (setq ch (%peek-char stream)))))
 
 (defun terminalp (ch)
-  (or (null ch) (whitespacep ch) (char= #\) ch)))
+  (or (null ch) (whitespacep ch) (char= #\) ch) (char= #\( ch)))
 
 (defun read-until (stream func)
   (let ((string "")
        (%read-char stream)
        (ecase (%read-char stream)
          (#\'
-          (list 'function (ls-read stream)))))
+          (list 'function (ls-read stream)))
+         (#\+
+          (let ((feature (read-until stream #'terminalp)))
+            (cond
+              ((string= feature "common-lisp")
+               (ls-read stream);ignore
+               (ls-read stream))
+              ((string= feature "lispstrack")
+               (ls-read stream))
+              (t
+               (error "Unknown reader form.")))))))
       (t
        (let ((string (read-until stream #'terminalp)))
          (if (every #'digit-char-p string)