unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: guile-devel@gnu.org
Cc: 49623@debbugs.gnu.org
Subject: bug#49623: [PATCH v2] Parse #{{}}# properly.
Date: Tue, 20 Jul 2021 12:54:46 +0200	[thread overview]
Message-ID: <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel__47430.543512904$1626778577$gmane$org@telenet.be> (raw)
In-Reply-To: <2fed32729a645814cc8912a5d767b209c8075ed6.camel@telenet.be>


[-- Attachment #1.1: Type: text/plain, Size: 298 bytes --]

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.

[-- Attachment #1.2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch, Size: 2127 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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2021-07-20 10:54 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       ` Maxime Devos [this message]
     [not found]       ` <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>
2021-08-02 16:37         ` bug#49623: [PATCH v2] " lloda

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='71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel__47430.543512904$1626778577$gmane$org@telenet.be' \
    --to=maximedevos@telenet.be \
    --cc=49623@debbugs.gnu.org \
    --cc=guile-devel@gnu.org \
    /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).