diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.rs | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -281,10 +281,16 @@ impl<'ctx, 'file> AppState<'ctx, 'file> { | |||
281 | let mut parser = Parser::new(Lexer::new(lisp_expr, 0)); | 281 | let mut parser = Parser::new(Lexer::new(lisp_expr, 0)); |
282 | let res = parser.parse_single_expr(); | 282 | let res = parser.parse_single_expr(); |
283 | match res { | 283 | match res { |
284 | Ok(expr) => match eval::eval(&expr, self) { | 284 | Ok(expr) => { |
285 | Ok(val) => self.message.set_info(format!("{}", val)), | 285 | let mut evaluator = eval::Evaluator { |
286 | Err(eval_err) => self.message.set_error(format!("{}", eval_err)), | 286 | app: self, |
287 | }, | 287 | context: Vec::new(), |
288 | }; | ||
289 | match evaluator.eval(&expr) { | ||
290 | Ok(val) => self.message.set_info(format!("{}", val)), | ||
291 | Err(eval_err) => self.message.set_error(format!("{}", eval_err)), | ||
292 | } | ||
293 | } | ||
288 | Err(err) => self.message = handle_error(err, &lisp_expr, "repl"), | 294 | Err(err) => self.message = handle_error(err, &lisp_expr, "repl"), |
289 | } | 295 | } |
290 | self.command_box.hist_append(); | 296 | self.command_box.hist_append(); |