Skip to content

Commit

Permalink
Add a workaround for a read-suppress bug in PJB's reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
orivej committed Feb 23, 2013
1 parent 6f2d0db commit 2c3f41c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion quickdist.asd
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
:serial t
:components ((:file "package")
(:file "quickdist-reader")
(:file "quickdist")))
(:file "quickdist")
(:file "reader-patches")))
19 changes: 19 additions & 0 deletions reader-patches.lisp
Original file line number Diff line number Diff line change
@@ -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.