mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-14 08:27:34 +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)))
|
||||
(cond
|
||||
((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))))))
|
||||
(define (read-name c in)
|
||||
(let lp ((ls (if (char? c) (list c) '())))
|
||||
(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)))))))
|
||||
(define (read-named-char c in)
|
||||
(let ((name (read-name c in)))
|
||||
|
|
Loading…
Add table
Reference in a new issue