mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
flush all input on a read error
* 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.
This commit is contained in:
parent
4e33a13246
commit
dcb7c7ddf5
1 changed files with 8 additions and 0 deletions
|
@ -54,6 +54,13 @@
|
|||
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.
|
||||
|
@ -72,6 +79,7 @@
|
|||
(else
|
||||
(format (current-output-port) "While reading expression:\n")
|
||||
(print-exception (current-output-port) #f key args)
|
||||
(flush-all-input)
|
||||
*unspecified*)))))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue