From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Dr. Arne Babenhauserheide" Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] add language/wisp to Guile? Date: Thu, 16 Feb 2023 22:35:36 +0100 Message-ID: <87k00hi95b.fsf@web.de> References: <87h6w2fkz8.fsf@web.de> <87wn4ihw7v.fsf@web.de> <3beb00c7-e712-3d1b-b5f9-7a847924b9d9@telenet.be> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9508"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 28.1 Cc: guile-devel@gnu.org To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Feb 16 22:38:29 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSlxV-0002Go-9H for guile-devel@m.gmane-mx.org; Thu, 16 Feb 2023 22:38:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSlx8-0003mf-Nv; Thu, 16 Feb 2023 16:38:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSlx2-0003mQ-Op for guile-devel@gnu.org; Thu, 16 Feb 2023 16:38:00 -0500 Original-Received: from mout.web.de ([212.227.15.4]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSlx1-0004Mi-0A for guile-devel@gnu.org; Thu, 16 Feb 2023 16:38:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1676583474; i=arne_bab@web.de; bh=xh4fUG+FulOuHgVwhN5emcT9t+e+zioNUqsR17LDDns=; h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to; b=rs5wkILA9EthGFFCDlOShRTpIRKTMxxiLBzHmeceUEJ8yDnpzuGwMQFnobkY0/8MJ befmywxdZzUCK5ooJGpuZrdpukYg02EcT5dRjkARwFlgFXV0XXT3MgMJW05u5MMMm0 yEL1lRDIZdL8QGnzMypgiXPoy6iWCWROcY0OhVRtm2BN0Vhhk9dQ+D8RSJa0yeSDMT uqXZQSNMqm2WoZTKnfyToX0cOYkB7Nd0T4TIcfZRibrSzMd/GWQR5B6ewkrtvRpAZk aeBjvIzVBnYf5OMLXkktXjgU9qHAmcJZQLUryH/S2qA+ZdDPBpSfl6HXWiPVLHx1MZ jA5DjwQfkjXCA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from fluss ([84.149.95.143]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1Mx0Ix-1odrDd1GyR-00y8PH; Thu, 16 Feb 2023 22:37:54 +0100 In-reply-to: <3beb00c7-e712-3d1b-b5f9-7a847924b9d9@telenet.be> X-Provags-ID: V03:K1:2Ilw3EwEpLOmgTPN8KX3I1xh6zNQ1HKt/sGLFxolqRQtpoDeYo5 bru462ELV+rjAMncfPK0TE/Hal48vGafISbouQerH5x2wvr7T4G7Z8QhtFPXMBPSL5uHP6P wewFh+V1zmPBguDSvYx2ftd2Oy8KVBsCmrzn/n4Oh1RnBZprNNgD3v6coBOAdlaN9asME0B 7/zDGkKOHgtHku+55bl/Q== UI-OutboundReport: notjunk:1;M01:P0:a6eqH0E3BXU=;sVhXhlWiuL/dvKoZsKAv54LP/P6 IwIhclwwEHDyL7EibXzI8/bWkgNI3IbJYi5JXES0bSLMywrndrrRDC+CkIn7Uh7qTCymrgsko GJmR/3IIJTsBkGU3bRipr70xqTHvAJQgwg/S4xrT/G28DAcYgwyqn9C89O1oE1hMuVcniCM9a 7Ty/1XsigWEW1n38duVisq35GEvFH0phLqZNIR/EQqC6l8kQ6YgppeXee0Ld9ygJJagZB6LI2 Iac+RLXWr9YJ/k3DwV464K5C1QElJDswLqr27cfQgacLD8v3KxiF8fQjxfDon5ccXDHDf5kMb qq1pr0EIIHpexFAbraGiNYC3xR1Hz0znOv8XaKPakcON9DIMHA1yNvN5xC3KaHjpj3/pJPUuY LWyN0BxrxROSko0/mUbiLUEc9sEToqLtb333akVbzp8UVvsKBiH/me0vZ7R7nlzTEjHuzs9lP ICWOD4MWlYKHXeTnyumaCzBWu5JybE/16rMnKvl57ZScGEoiIbnQpjB6aRaJPeU9bOcqi9hpD MGi+M/xLDn9/b4LAojPi7eMw30MLQM72rqdoU7dOhuMmW3OGX0NVG0G9rG/7KHTgda8JLyCg8 tq0gGVdHvcue5KjlVHgcUWS8Ys//H8UW02QGOZ0ZGNjmJ1hpPHqt1WA0sVCUDVuZwOQWlz7yZ VFSCyTIWF2Ih08Go8UYj2hBn6k5QvwbvQDgyVa3QsaUz/4uWCfTJUaBCL7nHr9LwzfjLINlaT U1nEvo14zfsd7etzoxd5O2gk/9/cEwfsxwy4pD0+hOy/fvm+JEjn3aQjwrMzSamWgjpNlaS4 Received-SPF: pass client-ip=212.227.15.4; envelope-from=arne_bab@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21709 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Maxime Devos 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 over= ride >> ;; this syntax. >> (with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedur= es))) >> (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 =E2=80=94 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. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Only-extend-the-reader-while-reading-wisp.-Thanks-to.patch Content-Transfer-Encoding: quoted-printable From=2012aa7314ad85f442f8bfe85839127bf1929be2ba Mon Sep 17 00:00:00 2001 From: Arne Babenhauserheide 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 f= luid * module/language/wisp.scm (wisp-scheme-read-chunk): extend hash in fluid =2D-- 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 =2D-- a/module/language/wisp.scm +++ b/module/language/wisp.scm @@ -725,14 +725,16 @@ Match is awesome!" a)))))) =20 (define (wisp-scheme-read-chunk port) =2D "Read and parse one chunk of wisp-code" =2D (let (( lines (wisp-scheme-read-chunk-lines port))) =2D (wisp-make-improper =2D (wisp-replace-empty-eof =2D (wisp-unescape-underscore-and-colon =2D (wisp-replace-paren-quotation-repr =2D (wisp-propagate-source-properties =2D (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))))))))) =20 (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 =2D-- 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. =2D (read-hash-extend #\# (=CE=BB (chr port) #\#)) =2D (define %read-hash-procedures/parameter =2D (fluid->parameter %read-hash-procedures)) =2D (parameterize ((%read-hash-procedures/parameter =2D `((#\# ,(=CE=BB (chr port) #\#)) =2D ,@(%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. =2D-=20 2.39.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Best wishes, Arne =2D-=20 Unpolitisch sein hei=C3=9Ft politisch sein, ohne es zu merken. draketo.de --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJEBAEBCAAuFiEE801qEjXQSQPNItXAE++NRSQDw+sFAmPuojEQHGFybmVfYmFi QHdlYi5kZQAKCRAT741FJAPD6wEJEADCzzotTlssG2c24bDOFlZRav9+wFxGbL3I E3N5shdRoyU71hBQu4s9Sv6F3Hg67x9xWi88293VP0KA0VWQJGO6fcoikKSCzHqx Z/hcFi6PSBE5kISNCAYVItpIEW3QUPI0tu1M8DoLZCALi2mvS8uQ9WF/ULQwKE7b eSU2e4r7g2f61sUNKpIHDeCS0AEjMh87efR/V76QA18p0bUxUTI8Bi2BHzR7eGDY SqebGOiMU1VTBR86QymM+2J+HiqOdXo8mco5jLvwpFB2QIhyIdYjXQdd2IwM1bOC yPVPOwQ0mLValsZRXh6A5Hmqvy4lsRCBBxPLstJNKWs/MK9BPfIr3xgHZwnsQogF bY85Pnb3PW637jJNBsBCRCwvL0sgLG2Lx4/GhGnueTJqmflvLEkNvOjIv6ZUI1Nq S7//3QBi+V3kQ3PplVr78xjTf64G/TU4X09OemiVME4W5FHhIQ+G4B+VVNpKncRQ BxWHUFsgszLBgMcZymZpMn8AbJOM1qSS+TTfTKqoq0pZ2E3nwEohWEfxSUWiEX9W 6AiXT2RkJfp8EVCEsP7g2MckNA/ykhGFqEfSgF9w8ccBKk1rlsCoYY/nEP/4QOYn PmNGTSa0gYznAM5Bv0KeDIFuDQyvzYAcv61zvZXrHVfKQMEmKTXh9B7NAr0G8BgM x26OrnD0VIjEBAEBCAAuFiEE3Si95tmHXKvOSosd3M8NswvBBUgFAmPuojEQHGFy bmVfYmFiQHdlYi5kZQAKCRDczw2zC8EFSFStA/9+qRs/HYMLCGG0g2AEhpkXj6Fp 641PfkEvSud1qQsZOs0fR8iNvRW7X4qJ+KDcrBgJtagZydfAHqGREZDdCc1hOHao 2E7RwouDgA8D9hEUPv/qNDzgH3z1LjyE/0MsXEtxe56qwrh12agIB9bpouQib+c4 KINTM5zeQr0AHpcbxw== =cS1A -----END PGP SIGNATURE----- --==-=-=--