1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix read-syntax on vectors and arrays

* module/ice-9/read.scm (%read): Strip annotations from reading
the array elements.
This commit is contained in:
Andy Wingo 2021-02-25 10:27:22 +01:00
parent 0cc7991855
commit a758ba075a

View file

@ -403,7 +403,7 @@
(error "unknown character name ~a" tok)))))))) (error "unknown character name ~a" tok))))))))
(define (read-vector) (define (read-vector)
(list->vector (read-parenthesized #\)))) (list->vector (map strip-annotation (read-parenthesized #\)))))
(define (read-srfi-4-vector ch) (define (read-srfi-4-vector ch)
(read-array ch)) (read-array ch))
@ -438,7 +438,7 @@
(expect #\u) (expect #\u)
(expect #\8) (expect #\8)
(expect #\() (expect #\()
(u8-list->bytevector (read-parenthesized #\)))) (u8-list->bytevector (map strip-annotation (read-parenthesized #\)))))
;; FIXME: We should require a terminating delimiter. ;; FIXME: We should require a terminating delimiter.
(define (read-bitvector) (define (read-bitvector)
@ -532,7 +532,7 @@
(define (read-elements ch rank) (define (read-elements ch rank)
(unless (eqv? ch #\() (unless (eqv? ch #\()
(error "missing '(' in vector or array literal")) (error "missing '(' in vector or array literal"))
(let ((elts (read-parenthesized #\)))) (let ((elts (map strip-annotation (read-parenthesized #\)))))
(if (zero? rank) (if (zero? rank)
(begin (begin
;; Handle special print syntax of rank zero arrays; see ;; Handle special print syntax of rank zero arrays; see