* module/system/repl/repl.scm (flush-all-input): New helper.
(prompting-meta-read): Flush all input on a read error, as we could be
within some expression or a string or something.
meta-command-token)
(else (read port env))))))))
+(define (flush-all-input)
+ (if (and (char-ready?)
+ (not (eof-object? (peek-char))))
+ (begin
+ (read-char)
+ (flush-all-input))))
+
;; repl-reader is a function defined in boot-9.scm, and is replaced by
;; something else if readline has been activated. much of this hoopla is
;; to be able to re-use the existing readline machinery.
(else
(format (current-output-port) "While reading expression:\n")
(print-exception (current-output-port) #f key args)
+ (flush-all-input)
*unspecified*)))))
\f