repl: Use exception handling.
* module/mes/repl.mes (repl): Use catch to prevent exit upon error.
This commit is contained in:
parent
cb1fa49767
commit
1f9476aeca
|
@ -159,6 +159,8 @@ along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|||
(force-output)
|
||||
(let ((sexp (read-env a)))
|
||||
(when (not (eq? sexp '()))
|
||||
(catch #t
|
||||
(lambda ()
|
||||
(when print-sexp?
|
||||
(display "[sexp=")
|
||||
(display sexp)
|
||||
|
@ -170,7 +172,8 @@ along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|||
(loop a))))
|
||||
((and (pair? sexp) (eq? (car sexp) 'mes-use-module))
|
||||
(loop (mes-load-module-env (cadr sexp) a)))
|
||||
(else (let ((e (eval sexp a)))
|
||||
(else
|
||||
(let ((e (eval sexp a)))
|
||||
(if (eq? e *unspecified*) (loop a)
|
||||
(let ((id (string->symbol (string-append "$" (number->string count)))))
|
||||
(set! count (+ count 1))
|
||||
|
@ -178,4 +181,7 @@ along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|||
(display " = ")
|
||||
(display e)
|
||||
(newline)
|
||||
(loop (acons id e a))))))))))))
|
||||
(loop (acons id e a))))))))
|
||||
(lambda (key . args)
|
||||
(format (current-error-port) "exception: ~a ~a\n" key args)
|
||||
(loop a))))))))
|
||||
|
|
Loading…
Reference in a new issue