fisl

fisl is scheme lox
git clone git://git.alexkarle.com.com/fisl
Log | Files | Refs | README | LICENSE

commit 7b56eb4c6951f157448ab5029203828b27126d92 (patch)
parent 1c2f9da130f0002ae2f240d3c0ee23f2e724a089
Author: Alex Karle <alex@alexkarle.com>
Date:   Mon, 31 Oct 2022 00:11:15 -0400

repl: Add ,q command and move exit outside run-prompt

I've been toying around with emacs and one of the really cool things
is being able to send updates to chicken REPL. Sometimes I want to
exit the run-prompt loop without ending the scheme process though!

So this patch allows exiting (run-prompt) with ,q (since C-d seems to
be finnicky).

Diffstat:
Mfisl.scm | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fisl.scm b/fisl.scm @@ -23,12 +23,11 @@ (define (run-prompt) (display "> ") (let ((l (read-line))) - (if (not (eof-object? l)) + (if (not (or (eof-object? l) (equal? l ",q"))) (begin (run l "repl") (clear-err!) - (run-prompt)) - (exit 0)))) + (run-prompt))))) (define (run-file fname) (call-with-input-file fname (lambda (p) @@ -38,6 +37,6 @@ (define (main args) (let ((argc (length args))) (cond - ((eq? argc 0) (run-prompt)) + ((eq? argc 0) (run-prompt) (exit 0)) ((eq? argc 1) (run-file (car args))) (else (die "Too many arguments. Usage: fisl [FILE]")))))