Increment and decrement operators work

This commit is contained in:
2022-08-21 00:23:01 +01:00
parent c64d451287
commit b385b461e0
8 changed files with 185 additions and 26 deletions

View File

@@ -176,6 +176,18 @@ static bool execPushLiteral(Interpreter* interpreter, bool lng) {
return true;
}
static bool rawLiteral(Interpreter* interpreter) {
Literal lit = popLiteralArray(&interpreter->stack);
if (!parseIdentifierToValue(interpreter, &lit)) {
return false;
}
pushLiteralArray(&interpreter->stack, lit);
return true;
}
static bool execNegate(Interpreter* interpreter) {
//negate the top literal on the stack (numbers only)
Literal lit = popLiteralArray(&interpreter->stack);
@@ -657,6 +669,12 @@ static void execInterpreter(Interpreter* interpreter) {
}
break;
case OP_LITERAL_RAW:
if (!rawLiteral(interpreter)) {
return;
}
break;
case OP_NEGATE:
if (!execNegate(interpreter)) {
return;