fix reading numbers beginning with "." in srfi-38

This commit is contained in:
Alex Shinn 2011-11-29 21:47:54 +09:00
parent b22b0bc7a4
commit ab5398bba0

View file

@ -159,7 +159,8 @@
(let lp ((res 0.0) (k 0.1))
(let ((c (peek-char in)))
(cond
((char-numeric? c) (lp (+ res (* (read-char in) k)) (* k 0.1)))
((char-numeric? c)
(lp (+ res (* (digit-value (read-char in)) k)) (* k 0.1)))
((or (eof-object? c) (memv c delimiters)) res)
(else (error "invalid char in float syntax" c))))))
(define (read-name c in)
@ -292,7 +293,8 @@
(if (eqv? #\) (peek-char in))
(begin (read-char in) (append (reverse res) tail))
(error "expected end of list after dot"))))
((char-numeric? (peek-char in)) (read-float-tail in))
((char-numeric? (peek-char in))
(lp (cons (read-float-tail in) res)))
(else (string->symbol (read-name #\. in)))))
(else
(if (eof-object? c)