From: Maxime Devos <maximedevos@telenet.be>
To: guile-patches@gnu.org
Cc: 49623@debbugs.gnu.org
Subject: bug#49623: [PATCH] Parse #{{}}# properly.
Date: Sun, 18 Jul 2021 20:16:35 +0200 [thread overview]
Message-ID: <b77ce323ee2e7dcad8b9493a6e10c7f0836471a7.camel@telenet.be> (raw)
In-Reply-To: <bd06cea0fac610f7e32c21c081874edda41fd383.camel@telenet.be>
[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]
Hi guilers,
This fixes bug #49623. I also added two additional test cases.
I'm rebuilding Guile right now and will re-run the entire test suite,
and I'll build the affected guile library with the fixed guile.
Greetings,
Maxime.
[-- Attachment #1.2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch, Size: 1858 bytes --]
From 9fb7cff1a2544aae3827db1a781be6e5c367d8c0 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, do not
reset 'saw-brace?' to #f if the current character is #\}.
* test-suite/tests/reader.test
("#{}#): Add two test cases.
---
module/ice-9/read.scm | 5 ++++-
test-suite/tests/reader.test | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index 72811fdb8..3fcc6ae50 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -570,7 +570,10 @@
(saw-brace?
(if (eqv? ch #\#)
'()
- (cons #\} (lp #f))))
+ ;; (eqv? ch #\}) is required instead of #f to allow for
+ ;; the trailing # to be preceded by two }, e.g.
+ ;; #{}}# or #{{a}}#. See <https://bug.gnu.org/XXX>.
+ (cons #\} (lp (eqv? ch #\})))))
((eqv? ch #\})
(lp #t))
((eqv? ch #\\)
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index ef11a4abd..134cb5ec3 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -508,6 +508,9 @@
(with-test-prefix "#{}#"
(pass-if (equal? (read-string "#{}#") '#{}#))
+ ;; ??? bugs.gnu.org
+ (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 --]
next prev parent reply other threads:[~2021-07-18 18:16 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 ` Maxime Devos [this message]
[not found] ` <188d4583d3c9a921e7bdc8556befc4c320b99dd6.camel@telenet.be>
2021-07-18 19:47 ` bug#49623: Fwd: [PATCH] Parse #{{}}# properly 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
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=b77ce323ee2e7dcad8b9493a6e10c7f0836471a7.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=49623@debbugs.gnu.org \
--cc=guile-patches@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).