Updated REPL to be more forgiving once errors occur
This commit is contained in:
parent
01355fdaba
commit
d7d561f45e
|
@ -87,11 +87,7 @@ proc repl =
|
||||||
continue
|
continue
|
||||||
elif input == "":
|
elif input == "":
|
||||||
continue
|
continue
|
||||||
else:
|
tokens = tokenizer.lex(current & input & "\n", "stdin")
|
||||||
current &= input & "\n"
|
|
||||||
if current.len() == 0:
|
|
||||||
continue
|
|
||||||
tokens = tokenizer.lex(current, "stdin")
|
|
||||||
if tokens.len() == 0:
|
if tokens.len() == 0:
|
||||||
continue
|
continue
|
||||||
when debugLexer:
|
when debugLexer:
|
||||||
|
@ -142,6 +138,7 @@ proc repl =
|
||||||
else:
|
else:
|
||||||
styledEcho fgRed, "Corrupted"
|
styledEcho fgRed, "Corrupted"
|
||||||
vm.run(serialized.chunk)
|
vm.run(serialized.chunk)
|
||||||
|
current &= input & "\n"
|
||||||
except LexingError:
|
except LexingError:
|
||||||
print(LexingError(getCurrentException()))
|
print(LexingError(getCurrentException()))
|
||||||
except ParseError:
|
except ParseError:
|
||||||
|
|
Loading…
Reference in New Issue