Check for minus before converting to int.

BigInts converts "-" to 0.  This happens in the parser before you get to
the evaluator.
This commit is contained in:
Simon Forman 2022-09-14 21:09:20 -07:00
parent 9d7a2a8fcb
commit 77b1638d64
1 changed files with 2 additions and 0 deletions

View File

@ -270,6 +270,8 @@ proc text_to_expression(text: string): JoyListType =
thing = j_true
elif tok == "false":
thing = j_false
elif tok == "-": # see https://github.com/nim-lang/bigints/issues/116
thing = JoyType(kind: joySymbol, symVal: tok)
else:
try:
thing = JoyType(kind: joyInt, intVal: tok.initBigInt)