wisp 1.0.10: extend reader via fluids
5 files changed, 14 insertions(+), 12 deletions(-)

M AUTHORS.in
M NEWS
M configure.ac
M wisp-reader.w
M wisp-scheme.w
M AUTHORS.in +1 -0
@@ 2,6 2,7 @@ Main Author: Arne Babenhauserheide
 
 Specific Contributions:
 
+- Maxime Devos: cleaner encoding and reader handling and unlimited underscores
 - Mark Weaver and Arne Babenhauserheide: Efficient string-replace-substring
 - Mark Weaver and NalaGinrut and Arne Babenhauserheide: wisp-reader.w
 - Christine Lemmer Webber added functions to interact with geiser, now

          
M NEWS +3 -0
@@ 1,3 1,6 @@ 
+wisp 1.0.10
+- only extend the reader for ## while reading wisp. Thanks to Maxime Devos for help to use fluids!
+
 wisp 1.0.9
 - remove limitation of the number of prefix underscores (_). Thanks to Maxime Devos for a much cleaner algorithm!
 - only set *port* encoding to UTF-8, do not change encoding for the application. Thanks to Maxime Devos!

          
M configure.ac +1 -1
@@ 1,7 1,7 @@ 
 dnl run `autoreconf -i` to generate a configure script. 
 dnl Then run ./configure to generate a Makefile.
 dnl Finally run make to generate the project.
-AC_INIT([wisp], [1.0.9],
+AC_INIT([wisp], [1.0.10],
         [arne_bab@web.de])
 # Add macros in m4/ to ensure that wisp builds without having Guile in the aclocal path
 AC_CONFIG_MACRO_DIR([m4])

          
M wisp-reader.w +6 -10
@@ 42,25 42,21 @@ define-module : language wisp spec
 ;;; Language definition
 ;;;
 
-define (read-one-wisp-sexp port env)
+define : read-one-wisp-sexp port env
   ;; Allow using "# foo" as #(foo).
   ;; 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 #\# : lambda (chr port) #\#
-  define %read-hash-procedures/parameter
-    fluid->parameter %read-hash-procedures
-  parameterize ((%read-hash-procedures/parameter
-                 `((#\# ,(lambda (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.
     set-port-encoding! port "UTF-8"
-    if (eof-object? (peek-char port))
+    if : eof-object? : peek-char port
         read-char port ; return eof: we’re done
-        let ((chunk (wisp-scheme-read-chunk port)))
-          and (not (null? chunk)) ; <---- XXX: maybe (pair? chunk)
+        let : : chunk : wisp-scheme-read-chunk port
+          and : not : null? chunk ; <---- XXX: maybe (pair? chunk)
                car chunk
 
 define-language wisp

          
M wisp-scheme.w +3 -1
@@ 752,7 752,9 @@ Match is awesome!"
 
 define : wisp-scheme-read-chunk port
          . "Read and parse one chunk of wisp-code"
-         let : :  lines : wisp-scheme-read-chunk-lines port
+         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