wisp
 
(Arne Babenhauserheide)
2014-02-09: merge default into stable stable

merge default into stable

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -7,7 +7,7 @@ wisp: handle general paren prefixes like
 throw an exception when reducing indentation to an unknown indentation level. | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:424186bd85f186b7279c5c59e2bd42f847284719, time:1376003568.91
 wisp-in-wisp: only parses the first 272 lines, for some reason. | owner:, open:False, id:4cb6c556d7136609e2da9ab3fc045a39847f1ef3, time:1377014682.98
 implement wisp in wisp                                       | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:6299306916706410702029289bf32edab1e7f17c, time:1367113341.49
-support other types of brackets, like square brackets.       | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:6749f3abcb9455eac9271efd8265797bce114239, time:1389134151.98
+support other types of brackets, like square brackets.       | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:6749f3abcb9455eac9271efd8265797bce114239, time:1389134151.98
 linebreaks in parens still break                             | owner:, open:False, id:6797987c7834a53358fb4ebbd8b9b36c2c4a8f01, time:1379004764.14
 wisp-guile.w does not yet remove the leading . which signifies a continuation. | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:7075096a323933493f42a3751da5f75a45d5d699, time:1377381700.17
 inline ' : should be '(                                      | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:72d534a8b23b4cb168017f1bb7d8816f0ea170c4, time:1366497335.26
diff --git a/.hgsigs b/.hgsigs
--- a/.hgsigs
+++ b/.hgsigs
@@ -5,3 +5,4 @@ 9acba39093f5021dc63d6c30d597eff9a3d1fe85
 9595c226ac6dfacbba7143aeaadadc2b7b2e9648 0 iJwEAAEIAAYFAlLLYKsACgkQ3M8NswvBBUioxQP+LHym9gVvfUNdW9PqIO9GSaPW6IXo65Mmwi0SZccM2t8HQQMJuckYRC2BQZZrXiY3yM58Dq4FU/krDimBAg7Eq2jdY8SaS5E7vWNIuOMspEVU5WmQ2pfswBqKMVD24tajCCuUgWpjlsWFlBVEdA5cA7ab1xWdKtPvWbgJYcsMolU=
 ef1e317ebf5a6c1d0c77d402fc2d987417b38955 0 iJwEAAEIAAYFAlLMi1oACgkQ3M8NswvBBUhBRAP/Vq0DIQEz8QPufE6Qhrr3AMsBv9UZlBIQbHLWXOPy+pr2cbUETJ55CfZXxGAtfCMSIZ7BFVn7HT1mlgcbfUKZkMRcP8yBatDeBIzVXOafJOLgCaizsQCDSa6a5VwSMGBLqdD2Cz4w2UeRH97vE/5Q7+JtmqkAn6nrPzqwyVy4QPs=
 1d95b99da08b25917847702a382c691b5bd1de69 0 iJwEAAEIAAYFAlLfF2IACgkQ3M8NswvBBUhaPgP7BasnAMXUDcRJRSPdfH0vE2/+lYYpFR2w8s5k/RK134EG5+9nnehOohhB5mVLCxhXP7miGhVNfDZmfR3csOH2fjBmAhpjDcRmn1aqgOPQ+RoWqIV4ZVpaeMPE49OOefpxAvHaWlzajo/fd99Fwckg+VhqXBciWlnHyTpCYSlk8Ac=
+a41ca7bf033667a8dfeacd48be5caf315fabb020 0 iJwEAAEIAAYFAlL2Z+gACgkQ3M8NswvBBUisDgQAiHKSfcOdlWoin7wpHDVlyKhAxAIg5D9xwAGDj2CIVEu4cpw5HdZ8t8fjyrP6lMsAkHnCVNUlRjprdo7PR4al1uxNmz4H0mQMlDLxG4Sfj2x01w3DDgiNOfV/65lwNY9BNxULCjwBlHN5qzv9toLwZ29SLEZXvshuZBxe8qSfBy8=
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -13,3 +13,4 @@ 2ae2c7c154e0c80acd21bdb2dace1c98a0a8d7a7
 fb1b0fb41bc768485f582f3f5af16478aa6212a1 v0.5.7
 efd0ee6e65c3948e0c643526063029b691424de8 v0.5.8
 bb1c4165b8a6d12929625e6518a5b1c727c75942 v0.5.9
+0e1335f015a83c6c6616019189c665b3849269ce v0.5.10
diff --git a/README b/README
--- a/README
+++ b/README
@@ -20,29 +20,26 @@ Wisp: Whitespace to Lisp
         . j                          j))          
 
 
-Wisp turns indentation based syntax into Lisp. The conversion is homoiconic[^h], generic[^g], and backwards-compatible[^b]. It is inspired by project readable, but tries to keep itself simple (and stupid: just a preprocessor). More information on the [wisp-website][].
+Wisp turns indentation based syntax into Lisp. The conversion is homoiconic[^h], generic[^g], and backwards-compatible[^b]. It is inspired by project readable, but tries to keep itself simple (and stupid: just a preprocessor). More information on the [wisp-website][] and code in the [wisp-repository][].
 
 [wisp-website]: http://draketo.de/light/english/wisp-lisp-indentation-preprocessor
+[wisp-repository]: http://draketo.de/proj/wisp
 
-Usage: ./wisp.py infile.wisp > outfile.lisp
 
-More powerful usage (in case you use unix):
+Bootstrap: autoreconf -i && ./configure && make
 
-    cat infile.wisp | ./wisp.py - | guile -s /dev/stdin
+Usage: guile ./wisp.scm infile.wisp > outfile.lisp
 
-That converts the infile to scheme and executes it via guile.
+Usage on the REPL (guile shell):
 
-Or with bash, extend this to a multiline input:
-
-    while IFS= read in ; do echo "$in" ; done | ./wisp.py - | guile -s /dev/stdin
-
-(finish the input with CTRL-D)
-(Note: IFS= ensures that initial blanks are kept)
+    guile -L . --language=wisp # run this in the wisp-folder
 
 Also see `./wisp-multiline.sh --help`
 
+
 License: GPLv3 or later.
 
+
 [^h]: Wisp is homoiconic because everything you write gets turned into lisp which is homoiconic.
 
 [^g]: Wisp is generic, because it works for any language which uses brackets to start a function call - which is true for most lisps. You simply get rid of the speerwall of parentheses without losing their power.
diff --git a/docs/why-wisp.org b/docs/why-wisp.org
--- a/docs/why-wisp.org
+++ b/docs/why-wisp.org
@@ -71,7 +71,7 @@
 - /€ and ¥ escape your existing filters/
 
 
-* Summary
+* Summary: Current Lisp
 
 1. Lisp syntax uses the *most common* non-letter, non-math characters.
 2. The *first and last characters* are important for text-recognition.
@@ -154,6 +154,15 @@ myfunction
 
 /Also the problems of SRFI-49 are preserved/
 
+* Summary: Why wisp?
+
+** Wisp
+/minimal indentation-based syntax/
+** Wisp vs. SRFI-49: continue the argument list.
+** Wisp vs. SRFI-110:
+*** use common characters (elegance 1).
+*** KISS.
+
 * Wisp syntax 1/4: function calls
 
 ** Indentation
@@ -235,7 +244,7 @@ becomes
 #+END_SRC
  
 
-* Wisp syntax justification
+* Summary: Wisp syntax justification
 
 #+html: <small>
 http://draketo.de/light/english/wisp-lisp-indentation-preprocessor#sec-4
diff --git a/tests/syntax-strings-parens.scm b/tests/syntax-strings-parens.scm
--- a/tests/syntax-strings-parens.scm
+++ b/tests/syntax-strings-parens.scm
@@ -13,4 +13,11 @@ ka"
 
 (flu)
 
+(sum [foo
+bar] barz {1 + [* 2 2]})
 
+(mara {
+li
++
+lo (mabba)
+})
diff --git a/tests/syntax-strings-parens.w b/tests/syntax-strings-parens.w
--- a/tests/syntax-strings-parens.w
+++ b/tests/syntax-strings-parens.w
@@ -12,3 +12,12 @@ ka"
     gom
 
 flu
+
+sum [foo
+bar] barz {1 + [* 2 2]}
+
+mara {
+li
++
+lo (mabba)
+}
diff --git a/wisp-guile.w b/wisp-guile.w
--- a/wisp-guile.w
+++ b/wisp-guile.w
@@ -119,6 +119,11 @@ Ends with three consecutive linebreaks o
                               or
                                 char=? lastchar #\( 
                                 char=? lastchar #\)
+                                char=? lastchar #\[ 
+                                char=? lastchar #\]
+                                ; TODO: Only match for braces {} if curly infix is enabled
+                                char=? lastchar #\{ 
+                                char=? lastchar #\}
                 set! instring : not instring
             ; check if we switch to a comment
             when 
@@ -164,9 +169,11 @@ Ends with three consecutive linebreaks o
                         not : string-suffix? text "#"
                         not : char=? #\\ lastchar
                         not : endsinunevenbackslashes : string-drop-right text : min 1 : string-length text
-                    when : equal? "(" : string nextchar
+                    ; TODO: Only match for braces {} if curly infix is enabled
+                    ; FIXME: Catch wrong ordering of parens/brackets/braces like ({)}
+                    when : or (equal? "[" (string nextchar)) (equal? "(" (string nextchar)) (equal? "{" (string nextchar))
                         set! inbrackets : + inbrackets 1
-                    when : equal? ")" : string nextchar
+                    when : or (equal? "}" (string nextchar)) (equal? ")" (string nextchar)) (equal? "]" (string nextchar))
                         set! inbrackets : - inbrackets 1
             if : or instring : > inbrackets 0
                 if : char=? nextchar #\linefeed
@@ -414,10 +421,20 @@ Also unescape \\: to :.
                                     not : endsinunevenbackslashes : string-drop-right unprocessed 1
                             set! instring : not instring
                         when : not instring
-                            when : and (equal? ")" lastletter) : not : equal? "#\\)" lastupto3
+                            when
+                                or
+                                    ; TODO: Only match for braces {} if curly infix is enabled
+                                    ; FIXME: Catch wrong ordering of parens/brackets/braces like ({)}
+                                    and (equal? "{" lastletter) : not : equal? "#\\{" lastupto3
+                                    and (equal? "[" lastletter) : not : equal? "#\\[" lastupto3
+                                    and (equal? "(" lastletter) : not : equal? "#\\(" lastupto3
+                                set! inbrackets : - inbrackets 1
+                            when 
+                                or
+                                    and (equal? ")" lastletter) : not : equal? "#\\)" lastupto3
+                                    and (equal? "]" lastletter) : not : equal? "#\\]" lastupto3
+                                    and (equal? "}" lastletter) : not : equal? "#\\}" lastupto3
                                 set! inbrackets : + 1 inbrackets ; remember that we're going backwards!
-                            when : and (equal? "(" lastletter) : not : equal? "#\\(" lastupto3
-                                set! inbrackets : - inbrackets 1
                         ; error handling: inbrackets must never be smaller than 0 - due to the line splitting.
                         when : < inbrackets 0
                             throw 'more-inline-brackets-closed-than-opened inbrackets line