wisp
 
(Arne Babenhauserheide)
2014-11-14: comment out some stuff which fails when parsing wisp-scheme with

comment out some stuff which fails when parsing wisp-scheme with wisp-scheme.

diff --git a/wisp-scheme.w b/wisp-scheme.w
--- a/wisp-scheme.w
+++ b/wisp-scheme.w
@@ -1,4 +1,5 @@
-#!/home/arne/wisp/wisp-multiline.sh
+#!/bin/bash
+exec guile -L . --language=wisp -s "$0" "$@"
 ; !#
 
 ;; Scheme-only implementation of a wisp-preprocessor which output a
@@ -523,7 +524,7 @@ define : wisp-replace-empty-eof code
          . "replace ((#<eof>)) by ()"
          ; FIXME: Actually this is a hack which fixes a bug when the
          ; parser hits files with only hashbang and comments.
-         if : and (pair? (car code)) (eof-object? (car (car code))) (null? (cdr code)) (null? (cdr (car code)))
+         if : and (not (null? code)) (pair? (car code)) (eof-object? (car (car code))) (null? (cdr code)) (null? (cdr (car code)))
               list
               . code
 
@@ -578,25 +579,27 @@ Match is awesome!"
                     map wisp-make-improper a
                   a
                     . a
-           define : syntax-error li
-                   throw 'wisp-syntax-error (format #f "incorrect dot-syntax #{.}# in code: not a proper pair: ~A" li)
-           let check
+           define : syntax-error li msg
+                   throw 'wisp-syntax-error (format #f "incorrect dot-syntax #{.}# in code: ~A: ~A" msg li)
+           if #t
+            . improper
+            let check
              : tocheck improper
              match tocheck
                ; lists with only one member
                : 'REPR-DOT-e749c73d-c826-47e2-a798-c16c13cb89dd
-                 syntax-error tocheck
+                 syntax-error tocheck "list with the period as only member"
                ; list with remaining dot.
                : a ...
-                 if : member repr-dot a
-                      syntax-error tocheck
+                 if : and (member repr-dot a) : not : equal? (quote quote) (car a)
+                      syntax-error tocheck "leftover period in list"
                       map check a
-               ; simple pair
-               : 'REPR-DOT-e749c73d-c826-47e2-a798-c16c13cb89dd . c
-                 syntax-error tocheck
-               ; simple pair, other way round
-               : a . 'REPR-DOT-e749c73d-c826-47e2-a798-c16c13cb89dd
-                 syntax-error tocheck
+               ; ; simple pair - this and the next do not work when parsed from wisp-scheme itself. Why?
+               ; : 'REPR-DOT-e749c73d-c826-47e2-a798-c16c13cb89dd . c
+               ;   syntax-error tocheck "dot as first element in already improper pair"
+               ; ; simple pair, other way round
+               ; : a . 'REPR-DOT-e749c73d-c826-47e2-a798-c16c13cb89dd
+               ;   syntax-error tocheck "dot as last element in already improper pair"
                ; more complex pairs
                : ? pair? a
                  let 
@@ -604,11 +607,11 @@ Match is awesome!"
                      tail : last-pair a
                    cond
                     : equal? repr-dot : car tail
-                      syntax-error tocheck
+                      syntax-error tocheck "equal? repr-dot : car tail"
                     : equal? repr-dot : cdr tail
-                      syntax-error tocheck
+                      syntax-error tocheck "equal? repr-dot : cdr tail"
                     : member repr-dot head
-                      syntax-error tocheck
+                      syntax-error tocheck "member repr-dot head"
                     else
                       . a
                a