1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 23:00:22 +02:00

* srfi-19.scm (priv:integer-reader-exact): minor cleanups.

This commit is contained in:
Rob Browning 2001-05-17 04:54:59 +00:00
parent c493c8c093
commit 5a1920ded2

View file

@ -1247,21 +1247,21 @@
(let ((padding-ok #t)) (let ((padding-ok #t))
(define (accum-int port accum nchars) (define (accum-int port accum nchars)
(let ((ch (peek-char port))) (let ((ch (peek-char port)))
(cond (cond
((>= nchars n) accum) ((>= nchars n) accum)
((eof-object? ch) ((eof-object? ch)
(priv:time-error 'string->date 'bad-date-template-string (priv:time-error 'string->date 'bad-date-template-string
"Premature ending to integer read.")) "Premature ending to integer read."))
((char-numeric? ch) ((char-numeric? ch)
(set! padding-ok #f) (set! padding-ok #f)
(accum-int port (+ (* accum 10) (priv:char->int (read-char (accum-int port
port))) (+ (* accum 10) (priv:char->int (read-char port)))
(+ nchars 1))) (+ nchars 1)))
(padding-ok (padding-ok
(read-ch port) ; consume padding (read-char port) ; consume padding
(accum-int prot accum (+ nchars 1))) (accum-int port accum (+ nchars 1)))
(else ; padding where it shouldn't be (else ; padding where it shouldn't be
(priv:time-error 'string->date 'bad-date-template-string (priv:time-error 'string->date 'bad-date-template-string
"Non-numeric characters in integer read."))))) "Non-numeric characters in integer read.")))))
(accum-int port 0 0))) (accum-int port 0 0)))