Updated REPL to be more forgiving once errors occur

This commit is contained in:
Mattia Giambirtone 2022-12-05 19:56:00 +01:00
parent 01355fdaba
commit d7d561f45e
1 changed files with 2 additions and 5 deletions

View File

@ -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: