mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-14 16:37:33 +02:00
adding additional checks for EOF
This commit is contained in:
parent
0ecb8ea665
commit
5371a7bad3
1 changed files with 3 additions and 2 deletions
|
@ -135,12 +135,13 @@
|
||||||
(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 (* (read-char in) k)) (* k 0.1)))
|
||||||
((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)
|
||||||
(let lp ((ls (if (char? c) (list c) '())))
|
(let lp ((ls (if (char? c) (list c) '())))
|
||||||
(let ((c (peek-char in)))
|
(let ((c (peek-char in)))
|
||||||
(cond ((memv c delimiters) (list->string (reverse ls)))
|
(cond ((or (eof-object? c) (memv c delimiters))
|
||||||
|
(list->string (reverse ls)))
|
||||||
(else (lp (cons (read-char in) ls)))))))
|
(else (lp (cons (read-char in) ls)))))))
|
||||||
(define (read-named-char c in)
|
(define (read-named-char c in)
|
||||||
(let ((name (read-name c in)))
|
(let ((name (read-name c in)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue