wisp
 
(Arne Babenhauserheide)
2017-11-11: use ## for literal arrays in wisp to avoid stumbling over newline

use ## for literal arrays in wisp to avoid stumbling over newline issues

diff --git a/tests/literalarray.scm b/tests/literalarray.scm
--- a/tests/literalarray.scm
+++ b/tests/literalarray.scm
@@ -1,1 +1,4 @@
 #(a b)
+
+#(
+  (a b))
diff --git a/tests/literalarray.w b/tests/literalarray.w
--- a/tests/literalarray.w
+++ b/tests/literalarray.w
@@ -1,1 +1,4 @@
-# a b
+## a b
+
+##
+  a b
diff --git a/wisp-guile.w b/wisp-guile.w
--- a/wisp-guile.w
+++ b/wisp-guile.w
@@ -494,12 +494,6 @@ Also unescape \\: to :.
                                         linebracketizer instring inbrackets bracketstoadd 
                                             . (string-append (string-drop-right unprocessed 2) "`")
                                             . processed
-                          ;; literal array #(...)
-                          : and (string-prefix? "(" processed) : equal? " # " lastupto3
-                                        ; leave out the second space
-                                        linebracketizer instring inbrackets bracketstoadd 
-                                            . (string-append (string-drop-right unprocessed 2) "#")
-                                            . processed
                           : and (string-prefix? "(" processed) : equal? " #` " lastupto4
                                         ; leave out the second space
                                         linebracketizer instring inbrackets bracketstoadd 
@@ -515,6 +509,12 @@ Also unescape \\: to :.
                                         linebracketizer instring inbrackets bracketstoadd 
                                             . (string-append (string-drop-right unprocessed 3) "#,")
                                             . processed
+                          ;; literal array #(...)
+                          : and (string-prefix? "(" processed) : equal? " ## " lastupto4
+                                        ; leave out the second space
+                                        linebracketizer instring inbrackets bracketstoadd 
+                                            . (string-append (string-drop-right unprocessed 3) "#")
+                                            . processed
                           : and (string-prefix? "(" processed) : equal? " #,@, " lastupto6
                                         ; leave out the second space
                                         linebracketizer instring inbrackets bracketstoadd 
@@ -544,7 +544,7 @@ The line *must* have a whitespace after 
              line-indent line
              string-append "(" : string-drop (line-content line) 1 ; keep whitespace
              line-comment line
-         let loop : : paren-prefixes : list "' " ", " "` " "#` " "#' " "#, " "#,@, " "# "
+         let loop : : paren-prefixes : list "' " ", " "` " "#` " "#' " "#, " "#,@, " "## "
              ; first check whether we are done checking
              if : null-list? paren-prefixes
                  ; construct the line structure: '(indentation-depth content comment)
@@ -563,14 +563,18 @@ The line *must* have a whitespace after 
                            list 
                                line-indent line
                                string-append 
-                                   . prefix-no-space "("
+                                   ;; special case for literal arrays, clean in wisp-scheme.w
+                                   if (equal? prefix-no-space "##") "#" prefix-no-space
+                                   . "("
                                    string-drop (line-content line) : string-length prefix
                                line-comment line
                          : line-only-prefix? line prefix-no-space
                            list 
                                line-indent line
                                string-append 
-                                   . (string-drop-right prefix 1) "("
+                                   ;; special case for literal arrays, clean in wisp-scheme.w
+                                   if (equal? prefix-no-space "##") "#" (string-drop-right prefix 1)
+                                   . "("
                                    string-drop (line-content line) : string-length prefix-no-space
                                line-comment line
                          else
diff --git a/wisp-reader.w b/wisp-reader.w
--- a/wisp-reader.w
+++ b/wisp-reader.w
@@ -37,7 +37,7 @@ define wisp-pending-sexps : list
 
 define : read-one-wisp-sexp port env
          ;; allow using "# foo" as #(foo).
-         read-hash-extend #\space : λ (chr port) #\#
+         read-hash-extend #\# : λ (chr port) #\#
          cond
             : eof-object? : peek-char port
               read-char port ; return eof: we’re done