From f8600d444f74cf00305a389ff446456553177956 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 23 Mar 2025 05:21:28 +0900 Subject: [PATCH] Don't consume the delimiter in read-float-tail. Closes #1019. --- lib/chibi/scribble-test.sld | 1 + lib/chibi/scribble.scm | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/chibi/scribble-test.sld b/lib/chibi/scribble-test.sld index 6eec73d0..ff0dc4e2 100644 --- a/lib/chibi/scribble-test.sld +++ b/lib/chibi/scribble-test.sld @@ -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 '(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 "blah blah" "\n" " yada yada")) "\\foo{blah blah diff --git a/lib/chibi/scribble.scm b/lib/chibi/scribble.scm index 316d497d..ed227ba0 100644 --- a/lib/chibi/scribble.scm +++ b/lib/chibi/scribble.scm @@ -53,9 +53,11 @@ (define (read-float-tail in acc) (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) - ((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")))))) (define (read-number in acc base)