From fb6108a3bdcad01670b87f240f919bf9b2be5499 Mon Sep 17 00:00:00 2001 From: bigyihsuan Date: Tue, 16 Jun 2020 01:48:14 -0400 Subject: [PATCH] =?UTF-8?q?fix=20a=20bug=20with=20`=CA=8C=20SKIP`=20involv?= =?UTF-8?q?ing=20truthiness?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/evaluator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/evaluator.py b/src/evaluator.py index 7c0a066..711f64b 100644 --- a/src/evaluator.py +++ b/src/evaluator.py @@ -54,8 +54,14 @@ def evaluate(lex, lab, debugmode, unvoiced, voiced, executionStack, currentStack if lex[ep].lexeme == "ʟ": # Unconditional jump ep = lab[lex[ep+1].lexeme] elif lex[ep].lexeme == "ʌ": # Conditional skip - ele = currentStack.pop() - truthy = ele != 0 or ele != "" or ele != [] + truthy = False + con = currentStack.pop() + if type(con) in [int, float]: + truthy = con != 0 + elif type(con) in [str]: + truthy = con != "" + elif type(con) in [list]: + truthy = con != [] ep += 1 if truthy else 0 # loop index getters and setters elif lex[ep].lexeme == "e":