mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +02:00
fix reading numbers beginning with "." in srfi-38
This commit is contained in:
parent
b22b0bc7a4
commit
ab5398bba0
1 changed files with 4 additions and 2 deletions
|
@ -159,7 +159,8 @@
|
||||||
(let lp ((res 0.0) (k 0.1))
|
(let lp ((res 0.0) (k 0.1))
|
||||||
(let ((c (peek-char in)))
|
(let ((c (peek-char in)))
|
||||||
(cond
|
(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)
|
((or (eof-object? c) (memv c delimiters)) res)
|
||||||
(else (error "invalid char in float syntax" c))))))
|
(else (error "invalid char in float syntax" c))))))
|
||||||
(define (read-name c in)
|
(define (read-name c in)
|
||||||
|
@ -292,7 +293,8 @@
|
||||||
(if (eqv? #\) (peek-char in))
|
(if (eqv? #\) (peek-char in))
|
||||||
(begin (read-char in) (append (reverse res) tail))
|
(begin (read-char in) (append (reverse res) tail))
|
||||||
(error "expected end of list after dot"))))
|
(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 (string->symbol (read-name #\. in)))))
|
||||||
(else
|
(else
|
||||||
(if (eof-object? c)
|
(if (eof-object? c)
|
||||||
|
|
Loading…
Add table
Reference in a new issue