unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Fwd: [PATCH] Parse #{{}}# properly.
       [not found] <b77ce323ee2e7dcad8b9493a6e10c7f0836471a7.camel@telenet.be>
@ 2021-07-18 18:18 ` Maxime Devos
  2021-07-18 19:47   ` Maxime Devos
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Devos @ 2021-07-18 18:18 UTC (permalink / raw)
  To: guile-devel


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

I sent this to the wrong address.

[-- Attachment #1.2: Doorgestuurd bericht — [PATCH] Parse #{{}}# properly. --]
[-- Type: message/rfc822, Size: 4099 bytes --]

[-- Attachment #1.2.1.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.1.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 #1.2.1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: [PATCH] Parse #{{}}# properly.
  2021-07-18 18:18 ` Fwd: [PATCH] Parse #{{}}# properly Maxime Devos
@ 2021-07-18 19:47   ` Maxime Devos
  2021-07-20 10:54     ` [PATCH v2] " Maxime Devos
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Devos @ 2021-07-18 19:47 UTC (permalink / raw)
  To: guile-devel; +Cc: 49623

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

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] Parse #{{}}# properly.
  2021-07-18 19:47   ` Maxime Devos
@ 2021-07-20 10:54     ` Maxime Devos
  2021-08-02 16:37       ` bug#49623: " lloda
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Devos @ 2021-07-20 10:54 UTC (permalink / raw)
  To: guile-devel; +Cc: 49623


[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#49623: [PATCH v2] Parse #{{}}# properly.
  2021-07-20 10:54     ` [PATCH v2] " Maxime Devos
@ 2021-08-02 16:37       ` lloda
  0 siblings, 0 replies; 4+ messages in thread
From: lloda @ 2021-08-02 16:37 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 49623-done, guile-devel

[-- 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 --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-02 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <b77ce323ee2e7dcad8b9493a6e10c7f0836471a7.camel@telenet.be>
2021-07-18 18:18 ` Fwd: [PATCH] Parse #{{}}# properly Maxime Devos
2021-07-18 19:47   ` Maxime Devos
2021-07-20 10:54     ` [PATCH v2] " Maxime Devos
2021-08-02 16:37       ` bug#49623: " lloda

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 NNTP newsgroup(s).