guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch main updated: ice-9/read: Parse #{}}# properly.


From: Daniel Llorens
Subject: [Guile-commits] branch main updated: ice-9/read: Parse #{}}# properly.
Date: Mon, 02 Aug 2021 06:48:44 -0400

This is an automated email from the git hooks/post-receive script.

lloda pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new c78c130  ice-9/read: Parse #{}}# properly.
c78c130 is described below

commit c78c130b1ddef6d6c290533f74ce1fbd51a4b19d
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Jul 18 19:59:32 2021 +0200

    ice-9/read: Parse #{}}# properly.
    
    This is a regression since Guile 3.0.2 and breaks compilation
    of a Guile library.
    
    * module/ice-9/read.scm
      (%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't
      #\#, don't eat CH.
    * test-suite/tests/reader.test
      ("#{}#): Add four test cases.
---
 module/ice-9/read.scm        | 7 +++++--
 test-suite/tests/reader.test | 5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index ac40773..2839330 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -556,12 +556,15 @@
     (string->symbol
      (list->string
       (let lp ((saw-brace? #f))
-        (let ((ch (next-not-eof)))
+        (let lp/inner ((ch (next-not-eof))
+                       (saw-brace? saw-brace?))
           (cond
            (saw-brace?
             (if (eqv? ch #\#)
                 '()
-                (cons #\} (lp #f))))
+                ;; Don't eat CH, see
+                ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>.
+                (cons #\} (lp/inner ch #f))))
            ((eqv? ch #\})
             (lp #t))
            ((eqv? ch #\\)
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 1481a0a..ad7c6d5 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -536,6 +536,11 @@
 
 (with-test-prefix "#{}#"
   (pass-if (equal? (read-string "#{}#") '#{}#))
+  ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>
+  (pass-if (equal? (read-string "#{}}#") (string->symbol "}")))
+  (pass-if (equal? (read-string "#{}}}#") (string->symbol "}}")))
+  (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}")))
+  (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b")))
   (pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
   (pass-if (equal? (read-string "#{a}#") 'a))
   (pass-if (equal? (read-string "#{a b}#") '#{a b}#))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]