Skip to content

Commit 5b7ac57

Browse files
authored
Merge pull request #281 from Affonso-Gui/fix-read-bit-vector
Unread last char in read-bit-vector
2 parents 06842a3 + 38436f9 commit 5b7ac57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lisp/l/readmacro.l

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
;; #B and #* macro
4444

45-
(defun read-binary (f n ch)
45+
(defun read-binary (f ch n)
4646
(let ((val 0) )
4747
(setq ch (read-char f))
4848
(while (find ch "01")
@@ -51,12 +51,13 @@
5151
(if (integerp ch) (unread-char ch f))
5252
val))
5353

54-
(defun read-bit-vector (f n ch)
54+
(defun read-bit-vector (f ch n)
5555
(let ((ba (make-array '(8) :element-type :bit :fill-pointer 0)))
5656
(setq ch (read-char f))
5757
(while (find ch "01")
5858
(vector-push-extend (- ch #\0) ba)
5959
(setq ch (read-char f nil nil)))
60+
(if (integerp ch) (unread-char ch f))
6061
(subseq (array-entity ba) 0 (fill-pointer ba))))
6162

6263

@@ -67,7 +68,7 @@
6768
;; define a legal shell command.
6869
(set-dispatch-macro-character #\# #\! (get-macro-character #\;))
6970

70-
(defun read-pathname (f n ch)
71+
(defun read-pathname (f ch n)
7172
(pathname (read f)))
7273

7374
(set-dispatch-macro-character #\# #\P 'read-pathname)

0 commit comments

Comments
 (0)