From ce61431bff702afcbd6a2ef52babd859203cccf8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 11 Sep 2015 20:06:19 -0700 Subject: Quit if input form is :quit not its value. * parser.c (repl): Subtle difference. Test form's syntax for equality to :quit, not its value. The REPL should not terminate if a form happens to calculate :quit as a value. * txr.1: Updated. --- parser.c | 4 ++-- txr.1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 82cdaa21..5d24fcb0 100644 --- a/parser.c +++ b/parser.c @@ -569,10 +569,10 @@ val repl(val bindings, val in_stream, val out_stream) val line = string_utf8(line_u8); val form = lisp_parse(line, out_stream, colon_k, lit("line"), prev_counter); - val value = eval_intrinsic(form, repl_env); - if (value == quit_k) { + if (form == quit_k) { done = t; } else { + val value = eval_intrinsic(form, repl_env); reg_varl(var_sym, value); sethash(result_hash, var_counter, value); prinl(value, out_stream); diff --git a/txr.1 b/txr.1 index 47d509e3..023a01df 100644 --- a/txr.1 +++ b/txr.1 @@ -33267,7 +33267,7 @@ the prompt is repeated without incrementing the number. Pressing Ctrl-D in a completely empty command line terminates the listener. Another way to quit is to enter the .code :quit -keyword symbol. When a command line evaluates to this symbol, +keyword symbol. When the form input into the listener consists of this symbol, the listener will terminate: .cblk -- cgit v1.2.3