From dcfe19b989fdd5bf0633180ecb64d7ad833e9047 Mon Sep 17 00:00:00 2001 From: eknauel Date: Thu, 18 Aug 2005 09:23:19 +0000 Subject: [PATCH] If there are whitespaces before EOF and the command-line is incomplete, make a TO-COMPLETE record --- scheme/cmdline.scm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scheme/cmdline.scm b/scheme/cmdline.scm index a365b20..cd4eca6 100644 --- a/scheme/cmdline.scm +++ b/scheme/cmdline.scm @@ -132,12 +132,23 @@ (let ((token (lex-operator cursor-index port))) (lp (peek-char port) (cons token tokens)))) ((char-set-contains? char-set:whitespace c) - (let ((pos (current-column port))) + (let ((start-pos (current-column port))) (read-char port) - (lp (peek-char port) - (if (and cursor-index (= cursor-index pos)) - (cons (make-empty-to-complete pos) tokens) - tokens)))) + (let read-whitspaces ((c (peek-char port)) + (cursor? (= start-pos cursor-index))) + (cond + ((eof-object? c) + (lp c (if (or cursor? + (= (current-column port) cursor-index)) + (cons (make-empty-to-complete cursor-index) + tokens) + tokens))) + ((char-set-contains? char-set:whitespace c) + (read-char port) + (read-whitspaces (peek-char port) + (or cursor? + (= (current-column port) cursor-index)))) + (else (lp c tokens)))))) (else (let ((token (lex-token cursor-index port))) (lp (peek-char port) (cons token tokens)))))))