unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] add language/wisp to Guile?
Date: Thu, 16 Feb 2023 22:35:36 +0100	[thread overview]
Message-ID: <87k00hi95b.fsf@web.de> (raw)
In-Reply-To: <3beb00c7-e712-3d1b-b5f9-7a847924b9d9@telenet.be>


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


Maxime Devos <maximedevos@telenet.be> writes:
> On 16-02-2023 09:03, Dr. Arne Babenhauserheide wrote:
>> Do you mean using it similar to this test?
>>    (pass-if "R6RS/SRFI-30 block comment syntax overridden"
>>      ;; To be compatible with 1.8 and earlier, we should be able to override
>>      ;; this syntax.
>>      (with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedures)))
>>        (read-hash-extend #\| (lambda args 'not))
>>        (fold (lambda (x y result)
>>                (and result (eq? x y)))
>>              #t
>>              (read-string "(this is #| a comment)")
>>              `(this is not a comment))))
>
> That appears to me a valid (and slightly simpler and more robust) way
> of doing things, yes.

I finally got it working with passing tests — thank you!

The reason that it did not work was that in the wisp repo there are
tests that use wisp.scm directly without going through spec.scm.


[-- Attachment #1.2: 0001-Only-extend-the-reader-while-reading-wisp.-Thanks-to.patch --]
[-- Type: text/x-patch, Size: 2927 bytes --]

From 12aa7314ad85f442f8bfe85839127bf1929be2ba Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Thu, 16 Feb 2023 22:34:00 +0100
Subject: [PATCH] Only extend the reader while reading wisp. Thanks to Maxime
 Devos!

* module/language/wisp/spec.scm (read-one-wisp-sexp): extend hash only in fluid
* module/language/wisp.scm (wisp-scheme-read-chunk): extend hash in fluid
---
 module/language/wisp.scm      | 18 ++++++++++--------
 module/language/wisp/spec.scm |  8 ++------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/module/language/wisp.scm b/module/language/wisp.scm
index 65ef8e65a..7a12e126a 100644
--- a/module/language/wisp.scm
+++ b/module/language/wisp.scm
@@ -725,14 +725,16 @@ Match is awesome!"
                  a))))))
 
 (define (wisp-scheme-read-chunk port)
-         "Read and parse one chunk of wisp-code"
-         (let (( lines (wisp-scheme-read-chunk-lines port)))
-              (wisp-make-improper
-                (wisp-replace-empty-eof
-                  (wisp-unescape-underscore-and-colon
-                    (wisp-replace-paren-quotation-repr
-                      (wisp-propagate-source-properties
-                        (wisp-scheme-indentation-to-parens lines))))))))
+    "Read and parse one chunk of wisp-code"
+    (with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedures)))
+      (read-hash-extend #\# (lambda args #\#))
+      (let ((lines (wisp-scheme-read-chunk-lines port)))
+           (wisp-make-improper
+             (wisp-replace-empty-eof
+               (wisp-unescape-underscore-and-colon
+                 (wisp-replace-paren-quotation-repr
+                   (wisp-propagate-source-properties
+                     (wisp-scheme-indentation-to-parens lines)))))))))
 
 (define (wisp-scheme-read-all port)
          "Read all chunks from the given port"
diff --git a/module/language/wisp/spec.scm b/module/language/wisp/spec.scm
index 3ba248aa9..477036c71 100644
--- a/module/language/wisp/spec.scm
+++ b/module/language/wisp/spec.scm
@@ -45,12 +45,8 @@
   ;; Don't use the globally-acting read-hash-extend, because this
   ;; doesn't make much sense in parenthese-y (non-Wisp) Scheme.
   ;; Instead, use fluids to temporarily add the extension.
-  (read-hash-extend #\# (λ (chr port) #\#))
-  (define %read-hash-procedures/parameter
-    (fluid->parameter %read-hash-procedures))
-  (parameterize ((%read-hash-procedures/parameter
-                   `((#\# ,(λ (chr port) #\#))
-                     ,@(%read-hash-procedures/parameter))))
+  (with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedures)))
+    (read-hash-extend #\# (lambda args #\# ))
     ;; Read Wisp files as UTF-8, to support non-ASCII characters.
     ;; TODO: would be nice to support ';; coding: whatever' lines
     ;; like in parenthese-y Scheme.
-- 
2.39.1


[-- Attachment #1.3: Type: text/plain, Size: 101 bytes --]


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

  reply	other threads:[~2023-02-16 21:35 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 21:26 [PATCH] add language/wisp to Guile? Dr. Arne Babenhauserheide
2023-02-04 15:08 ` Maxime Devos
2023-02-04 15:46   ` Dr. Arne Babenhauserheide
2023-02-04 19:09     ` Maxime Devos
2023-02-04 21:35       ` Dr. Arne Babenhauserheide
2023-02-05 15:08         ` Maxime Devos
2023-02-14  8:32           ` Dr. Arne Babenhauserheide
2023-02-14 21:24             ` Dr. Arne Babenhauserheide
2023-02-14 23:01               ` Maxime Devos
2023-02-15  1:46                 ` Matt Wette
2023-02-16 21:38                   ` Dr. Arne Babenhauserheide
2023-02-17  1:26                     ` Matt Wette
2023-02-23 11:36                       ` Ludovic Courtès
2023-02-23 17:48                         ` Dr. Arne Babenhauserheide
2023-02-23 18:42                         ` Maxime Devos
2023-02-24 15:45                           ` Ludovic Courtès
2023-02-24 16:34                             ` Dr. Arne Babenhauserheide
2023-03-08 10:34                               ` Dr. Arne Babenhauserheide
2023-05-01  9:54                                 ` [PATCH] add SRFI-119 / language/wisp to Guile? (new patch, squashed) Dr. Arne Babenhauserheide
2023-06-10 16:40                                   ` Ludovic Courtès
2023-06-12 10:22                                     ` Maxime Devos
2023-08-10  6:28                                       ` Dr. Arne Babenhauserheide
2023-08-14 20:11                                         ` Dr. Arne Babenhauserheide
2023-08-14 20:30                                           ` Dr. Arne Babenhauserheide
2023-08-14 22:43                                           ` Dr. Arne Babenhauserheide
2023-08-18 10:29                                           ` Ludovic Courtès
2023-08-18 12:16                                             ` Dr. Arne Babenhauserheide
2023-08-18 17:50                                               ` Dr. Arne Babenhauserheide
2023-09-08 17:46                                               ` Dr. Arne Babenhauserheide
2023-10-05 14:10                                                 ` Dr. Arne Babenhauserheide
2023-10-10 23:04                                                   ` Dr. Arne Babenhauserheide
2023-10-27 22:05                                                     ` Dr. Arne Babenhauserheide
2024-01-09  7:05                                                       ` Dr. Arne Babenhauserheide
2024-01-19  8:21                                                         ` Dr. Arne Babenhauserheide
2024-03-11  1:16                                                           ` [PATCH] add SRFI-119 / language/wisp to Guile? (new patch with more tests, squashed) Dr. Arne Babenhauserheide
2024-06-01  9:57                                                             ` Ludovic Courtès
2024-06-01 15:06                                                               ` Dr. Arne Babenhauserheide
2024-06-07  5:44                                                                 ` Damien Mattei
2024-06-10  8:13                                                                   ` [PATCH] add SRFI-119 / language/wisp to Guile? (new patch withmore " Maxime Devos
2024-06-10 23:03                                                                     ` Damien Mattei
2024-06-13 20:29                                                                   ` [PATCH] add SRFI-119 / language/wisp to Guile? (new patch with more " Dr. Arne Babenhauserheide
2024-01-19 12:10                                                         ` [PATCH] add SRFI-119 / language/wisp to Guile? (new patch, squashed) Christina O'Donnell
2024-01-19 21:37                                                           ` Ricardo Wurmus
2024-01-19 21:47                                                             ` Christina O'Donnell
2024-01-20 11:01                                                               ` Damien Mattei
2024-01-20 19:18                                                                 ` Dr. Arne Babenhauserheide
2024-01-20 22:59                                                                   ` Damien Mattei
2024-01-20 23:22                                                                     ` Dr. Arne Babenhauserheide
2024-01-21 23:21                                                                       ` Damien Mattei
2024-01-19 23:56                                                           ` Dr. Arne Babenhauserheide
2023-02-24 23:48                             ` [PATCH] add language/wisp to Guile? Maxime Devos
2023-02-24 23:51                               ` Maxime Devos
2023-02-25  0:15                                 ` Matt Wette
2023-02-25 10:42                                   ` Maxime Devos
2023-02-17 23:06                     ` Maxime Devos
2023-02-18  3:50                       ` Philip McGrath
2023-02-18 15:58                         ` Maxime Devos
2023-02-18 19:56                           ` Matt Wette
2023-02-21 12:09                             ` Dr. Arne Babenhauserheide
2023-02-26  7:45                           ` Philip McGrath
2023-02-26 15:42                             ` Maxime Devos
2023-02-26 16:14                               ` Dr. Arne Babenhauserheide
2023-02-26 17:58                               ` Matt Wette
2023-02-26 18:03                                 ` Dr. Arne Babenhauserheide
2023-02-26 18:20                                   ` Matt Wette
2023-02-26 21:39                                     ` Dr. Arne Babenhauserheide
2023-10-02 14:59                             ` Christine Lemmer-Webber
2023-10-02 21:46                               ` guile support for multiple languages [was: [PATCH] add language/wisp to Guile?] Matt Wette
2023-02-23  7:59                         ` [PATCH] add language/wisp to Guile? Maxime Devos
2023-02-23  8:51                           ` Dr. Arne Babenhauserheide
2023-02-23 18:04                             ` Maxime Devos
2023-02-23 18:22                               ` Maxime Devos
2023-02-23 18:36                               ` Maxime Devos
2023-02-23 18:37                               ` Maxime Devos
2023-02-15  8:36                 ` Dr. Arne Babenhauserheide
2023-02-15 20:13                   ` Maxime Devos
2023-02-16  7:01                     ` Dr. Arne Babenhauserheide
2023-02-16  8:03   ` Dr. Arne Babenhauserheide
2023-02-16 11:30     ` Maxime Devos
2023-02-16 21:35       ` Dr. Arne Babenhauserheide [this message]
2023-09-30 13:17 ` Christine Lemmer-Webber
2023-09-30 20:09   ` Maxime Devos
2023-10-02 14:48     ` Christine Lemmer-Webber
     [not found] <mailman.886.1677397547.13386.guile-devel@gnu.org>
2023-02-26 11:02 ` Marc Nieper-Wißkirchen
2023-02-26 23:22   ` Philip McGrath
2023-02-27  5:00     ` Dr. Arne Babenhauserheide
2023-02-27  7:26     ` Marc Nieper-Wißkirchen
2023-02-28  4:27       ` Philip McGrath
2023-02-28  6:57         ` Marc Nieper-Wißkirchen

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=87k00hi95b.fsf@web.de \
    --to=arne_bab@web.de \
    --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).