(Arne Babenhauserheide)
2015-06-23: FIX: broke with more than 2 consecutive empty lines. FIX: broke with more than 2 consecutive empty lines.
diff --git a/examples/ensemble-estimation.w b/examples/ensemble-estimation.w --- a/examples/ensemble-estimation.w +++ b/examples/ensemble-estimation.w @@ -1,4 +1,5 @@ #!/usr/bin/env sh +# -*- wisp -*- exec guile -L $(dirname $(dirname $(realpath "$0"))) --language=wisp -e '(@@ (examples ensemble-estimation) main)' -s "$0" "$@" ; !# diff --git a/wisp-reader.w b/wisp-reader.w --- a/wisp-reader.w +++ b/wisp-reader.w @@ -32,7 +32,12 @@ define : read-one-wisp-sexp port env : eof-object? : peek-char port read-char port ; return eof: we’re done else - car : wisp-scheme-read-chunk port + let : : chunk : wisp-scheme-read-chunk port + cond + : not : null? chunk + car chunk + else + . #f define-language wisp . #:title "Wisp Scheme Syntax. See SRFI-119 for details. THIS IS EXPERIMENTAL, USE AT YOUR OWN RISK" diff --git a/wisp-scheme.w b/wisp-scheme.w --- a/wisp-scheme.w +++ b/wisp-scheme.w @@ -211,19 +211,19 @@ define : wisp-scheme-read-chunk-lines po currentsymbols '() emptylines 0 cond - : <= 2 emptylines ; the chunk end has to be checked + : >= emptylines 2 ; the chunk end has to be checked ; before we look for new chars in the ; port to make execution in the REPL ; after two empty lines work ; (otherwise it shows one more line). . indent-and-symbols - : and inindent (zero? currentindent) (not (null? indent-and-symbols)) (not inunderscoreindent) (not (or (equal? #\space (peek-char port)) (equal? #\newline (peek-char port)))) - . indent-and-symbols ; top-level form ends chunk else let : : next-char : peek-char port cond : eof-object? next-char append indent-and-symbols : list : append (list currentindent) currentsymbols + : and inindent (zero? currentindent) (not incomment) (not (null? indent-and-symbols)) (not inunderscoreindent) (not (or (equal? #\space next-char) (equal? #\newline next-char) (equal? (string-ref ";" 0) next-char))) + append indent-and-symbols ; top-level form ends chunk : and inindent : equal? #\space next-char read-char port ; remove char loop