Don't consume the delimiter in read-float-tail.

Closes #1019.
This commit is contained in:
Alex Shinn 2025-03-23 05:21:28 +09:00
parent ed37af2dfd
commit f8600d444f
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@
(test-scribble '((foo 1 2 "3 4")) "\\foo[1 2]{3 4}") (test-scribble '((foo 1 2 "3 4")) "\\foo[1 2]{3 4}")
(test-scribble '((foo 1 2 3 4)) "\\foo[1 2 3 4]") (test-scribble '((foo 1 2 3 4)) "\\foo[1 2 3 4]")
(test-scribble '(123.456) "\\123.456") (test-scribble '(123.456) "\\123.456")
(test-scribble '((123.456)) "\\(123.456)")
(test-scribble '((123.456)) "\\(123.456 )") (test-scribble '((123.456)) "\\(123.456 )")
(test-scribble '((foo width: 2 "blah blah")) "\\foo[width: 2]{blah blah}") (test-scribble '((foo width: 2 "blah blah")) "\\foo[width: 2]{blah blah}")
(test-scribble '((foo "blah blah" "\n" " yada yada")) "\\foo{blah blah (test-scribble '((foo "blah blah" "\n" " yada yada")) "\\foo{blah blah

View file

@ -53,9 +53,11 @@
(define (read-float-tail in acc) (define (read-float-tail in acc)
(let lp ((res acc) (k 0.1)) (let lp ((res acc) (k 0.1))
(let ((ch (read-char in))) (let ((ch (peek-char in)))
(cond ((or (eof-object? ch) (char-delimiter? ch)) res) (cond ((or (eof-object? ch) (char-delimiter? ch)) res)
((char-numeric? ch) (lp (+ res (* k (char-digit ch))) (* k 0.1))) ((char-numeric? ch)
(read-char in)
(lp (+ res (* k (char-digit ch))) (* k 0.1)))
(else (error "invalid numeric syntax")))))) (else (error "invalid numeric syntax"))))))
(define (read-number in acc base) (define (read-number in acc base)