wisp
 
(Arne Babenhauserheide)
2014-01-07: make files containing only a hashbang work v0.5.2

make files containing only a hashbang work

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -8,7 +8,7 @@ implement wisp in wisp                  
 linebreaks in parens still break                             | owner:, open:True, 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
-failing test tests/shebang.w                                 | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:74a851f83af8996465a7b24d8453161beb0f0fd5, time:1379106761.57
+failing test tests/shebang.w                                 | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:74a851f83af8996465a7b24d8453161beb0f0fd5, time:1379106761.57
 the repl does not require 3 returns when you use a single char as function, or rather only does so every second time | owner:, open:True, id:9cedd0bdbf4a3b17add4bfe86ad5a23e500cfc6c, time:1379064870.78
 wisp-guile.w breaks on ";" and complex brackets with bracket char literals. See wisp-guile.w::91 | owner:, open:False, id:9d8b6f87fa5365733fc8655614dbf2a9ba5bd054, time:1377533321.27
 wisp-mode: handle lines starting with underscores: currently sees the underscores as function call. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:b2c3755e1deb8355655a334d569679e2e62d2836, time:1376612093.55
diff --git a/wisp-guile.w b/wisp-guile.w
--- a/wisp-guile.w
+++ b/wisp-guile.w
@@ -542,7 +542,7 @@ define : line-drop-continuation-dot line
 define : wisp2lisp-parse lisp prev lines
     . "Parse the body of the wisp-code."
     set! prev : wisp2lisp-add-inline-colon-brackets prev ; prev already is a code-line.
-    if : not : line-continues? prev
+    if : not : or (line-continues? prev) (line-empty-code? prev)
         set! prev : line-add-starting-bracket prev
     set! lines : map-in-order wisp2lisp-add-inline-colon-brackets lines
     let bracketizer : (levels '(0)) (pre prev) (unprocessed lines) (processed lisp) (whitespace '())
@@ -564,7 +564,7 @@ define : wisp2lisp-parse lisp prev lines
                           pre-continues : line-continues? pre
                           next-continues : line-continues? next
                           final-line : equal? #f : line-content next
-                          bracketstocloseprev : line-indent-brackets-to-close next-indent levels next-continues pre-continues
+                          bracketstocloseprev : if (line-empty-code? pre) 0 : line-indent-brackets-to-close next-indent levels next-continues pre-continues
                           bracketstoopennext : line-indent-brackets-to-open next-indent levels next-continues pre-continues
                           newnext : if final-line next : if (> bracketstoopennext 0) (line-add-starting-bracket next) next
                           newpre : line-drop-continuation-dot : line-add-closing-brackets pre bracketstocloseprev
@@ -579,7 +579,7 @@ define : wisp2lisp-initial-comments lisp
      . "Keep all starting comments: do not start them with a bracket."
      let skip-initial-comments : (lisp lisp) (prev prev) (lines lines)
          if : = 0 : length lines ; file only contained comments, maybe including the hashbang
-             . lisp
+             list lisp prev lines
              if : line-empty-code? prev
                  skip-initial-comments : append lisp : list prev
                      . (list-ref lines 0) (list-tail lines 1)