unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: lloda <lloda@sarc.name>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 49623-done@debbugs.gnu.org, guile-devel <guile-devel@gnu.org>
Subject: bug#49623: [PATCH v2] Parse #{{}}# properly.
Date: Mon, 2 Aug 2021 18:37:40 +0200	[thread overview]
Message-ID: <BBBEFC7E-FE98-4B2F-95DB-0DBE449CED1A@sarc.name> (raw)
In-Reply-To: <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]


Applied in c78c130b1ddef6d6c290533f74ce1fbd51a4b19d. Thank you!


> On 20 Jul 2021, at 12:54, Maxime Devos <maximedevos@telenet.be> wrote:
> 
> Maxime Devos schreef op zo 18-07-2021 om 21:47 [+0200]:
>> It turns out that the test fails when the patch
>> is applies to guile@3.0.7.  I'll rebase and try
>> to figure things out.
> 
> With the revised patch, tests succeed and the Guile
> library now compiles successfully.
> 
> Greetings,
> Maxime.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch; x-unix-mode=0644; name="0001-ice-9-read-Parse-properly.patch", Size: 2186 bytes --]

From 40b0b29c05d521cd8901988fa2bc71547f917f48 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Sun, 18 Jul 2021 19:59:32 +0200
Subject: [PATCH] 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 ac407739f..283933064 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 1481a0a5d..ad7c6d575 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}#))
-- 
2.32.0


[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



      parent reply	other threads:[~2021-08-02 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 16:41 bug#49623: Guile 3.0.7 can't read #{{}}# Maxime Devos
2021-07-18 18:16 ` bug#49623: [PATCH] Parse #{{}}# properly Maxime Devos
     [not found]   ` <188d4583d3c9a921e7bdc8556befc4c320b99dd6.camel@telenet.be>
2021-07-18 19:47     ` bug#49623: Fwd: " Maxime Devos
     [not found]     ` <2fed32729a645814cc8912a5d767b209c8075ed6.camel@telenet.be>
2021-07-20 10:54       ` bug#49623: [PATCH v2] " Maxime Devos
     [not found]       ` <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>
2021-08-02 16:37         ` lloda [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BBBEFC7E-FE98-4B2F-95DB-0DBE449CED1A@sarc.name \
    --to=lloda@sarc.name \
    --cc=49623-done@debbugs.gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).