Plumbing for index and dot notations is working

This commit is contained in:
2022-09-05 17:43:42 +01:00
parent 82c03ecb33
commit 304e1a5fb0
14 changed files with 708 additions and 29 deletions

View File

@@ -2,6 +2,52 @@
#include "memory.h"
int _index(Interpreter* interpreter, LiteralArray* arguments) {
//_index(compound, first, second, third, assignValue, op)
Literal op = popLiteralArray(arguments);
Literal assign = popLiteralArray(arguments);
Literal third = popLiteralArray(arguments);
Literal second = popLiteralArray(arguments);
Literal first = popLiteralArray(arguments);
Literal compound = popLiteralArray(arguments);
printLiteralCustom(compound, interpreter->printOutput);
printLiteralCustom(first, interpreter->printOutput);
printLiteralCustom(second, interpreter->printOutput);
printLiteralCustom(third, interpreter->printOutput);
printLiteralCustom(op, interpreter->printOutput);
printLiteralCustom(assign, interpreter->printOutput);
freeLiteral(compound);
freeLiteral(first);
freeLiteral(second);
freeLiteral(third);
freeLiteral(op);
freeLiteral(assign);
return 0;
}
int _dot(Interpreter* interpreter, LiteralArray* arguments) {
//_dot(compound, first, assignValue, opcode)
Literal op = popLiteralArray(arguments);
Literal assign = popLiteralArray(arguments);
Literal first = popLiteralArray(arguments);
Literal compound = popLiteralArray(arguments);
printLiteralCustom(compound, interpreter->printOutput);
printLiteralCustom(first, interpreter->printOutput);
printLiteralCustom(op, interpreter->printOutput);
printLiteralCustom(assign, interpreter->printOutput);
freeLiteral(compound);
freeLiteral(first);
freeLiteral(op);
freeLiteral(assign);
return 0;
}
int _set(Interpreter* interpreter, LiteralArray* arguments) {
//if wrong number of arguments, fail
if (arguments->count != 3) {
@@ -413,4 +459,4 @@ int _clear(Interpreter* interpreter, LiteralArray* arguments) {
freeLiteral(obj);
return 1;
}
}