-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workaround for a read-suppress bug in PJB's reader.
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*)))) |