Permalink
Browse files

Add a workaround for a read-suppress bug in PJB's reader.

  • Loading branch information...
1 parent 6f2d0db commit 2c3f41c53807cbae1fc75c3701ab029e2b6ab371 @orivej committed Feb 22, 2013
Showing with 21 additions and 1 deletion.
  1. +2 −1 quickdist.asd
  2. +19 −0 reader-patches.lisp
View
@@ -10,4 +10,5 @@
:serial t
:components ((:file "package")
(:file "quickdist-reader")
- (:file "quickdist")))
+ (:file "quickdist")
+ (:file "reader-patches")))
View
@@ -0,0 +1,19 @@
+;;; The code in this file is a modified copy of PJB's reader,
+;;; which is licensed under AGPL3; whatever this means.
+
+(in-package #:com.informatimago.common-lisp.lisp-reader.reader)
+
+;;; Work around rational in base inside a disabled feature,
+;;; such as #+xxx #o0
+(defun read-rational-in-base (stream arg sub-char *read-base*)
+ "
+DO: Read a rational number in the base specified.
+RETURN: The rational read.
+"
+ (when arg (serror 'simple-reader-error stream "no number allowed between # and ~A" sub-char))
+ (let ((value (let ((*read-suppress* nil)) (read stream t nil t))))
+ (if (rationalp value)
+ value
+ (serror 'simple-reader-error stream
+ "token \"~A\" after #~A is not a rational number in base ~D"
+ value sub-char *read-base*))))

0 comments on commit 2c3f41c

Please sign in to comment.