If there are whitespaces before EOF and the command-line is

incomplete, make a TO-COMPLETE record
This commit is contained in:
eknauel 2005-08-18 09:23:19 +00:00
parent 10821ee8dd
commit dcfe19b989
1 changed files with 16 additions and 5 deletions

View File

@ -132,12 +132,23 @@
(let ((token (lex-operator cursor-index port))) (let ((token (lex-operator cursor-index port)))
(lp (peek-char port) (cons token tokens)))) (lp (peek-char port) (cons token tokens))))
((char-set-contains? char-set:whitespace c) ((char-set-contains? char-set:whitespace c)
(let ((pos (current-column port))) (let ((start-pos (current-column port)))
(read-char port) (read-char port)
(lp (peek-char port) (let read-whitspaces ((c (peek-char port))
(if (and cursor-index (= cursor-index pos)) (cursor? (= start-pos cursor-index)))
(cons (make-empty-to-complete pos) tokens) (cond
tokens)))) ((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 (else
(let ((token (lex-token cursor-index port))) (let ((token (lex-token cursor-index port)))
(lp (peek-char port) (cons token tokens))))))) (lp (peek-char port) (cons token tokens)))))))