From d7d561f45e7a7c2a021d1c3f649117e5e4189a06 Mon Sep 17 00:00:00 2001 From: Mattia Giambirtone Date: Mon, 5 Dec 2022 19:56:00 +0100 Subject: [PATCH] Updated REPL to be more forgiving once errors occur --- src/main.nim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main.nim b/src/main.nim index f35409f..9aed225 100644 --- a/src/main.nim +++ b/src/main.nim @@ -87,11 +87,7 @@ proc repl = continue elif input == "": continue - else: - current &= input & "\n" - if current.len() == 0: - continue - tokens = tokenizer.lex(current, "stdin") + tokens = tokenizer.lex(current & input & "\n", "stdin") if tokens.len() == 0: continue when debugLexer: @@ -142,6 +138,7 @@ proc repl = else: styledEcho fgRed, "Corrupted" vm.run(serialized.chunk) + current &= input & "\n" except LexingError: print(LexingError(getCurrentException())) except ParseError: