forked from ground/ground
Compare commits
2 Commits
abe4e9d6f0
...
6a7ea3dab9
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a7ea3dab9 | |||
| 830963c890 |
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef enum GroundInstType {
|
typedef enum GroundInstType {
|
||||||
IF, JUMP, END, INPUT, PRINT, PRINTLN, SET, GETTYPE, EXISTS, SETLIST, SETLISTAT, GETLISTAT, GETLISTSIZE, LISTAPPEND, GETSTRSIZE, GETSTRCHARAT, ADD, SUBTRACT, MULTIPLY, DIVIDE, EQUAL, INEQUAL, NOT, GREATER, LESSER, STOI, STOD, ITOC, CTOI, TOSTRING, FUN, RETURN, ENDFUN, PUSHARG, CALL, STRUCT, ENDSTRUCT, INIT, GETFIELD, SETFIELD, USE, EXTERN, CREATELABEL, PAUSE, DROP, ERRORCMD
|
IF, JUMP, END, INPUT, PRINT, PRINTLN, SET, GETTYPE, EXISTS, SETLIST, SETLISTAT, GETLISTAT, GETLISTSIZE, LISTAPPEND, GETSTRSIZE, GETSTRCHARAT, ADD, SUBTRACT, MULTIPLY, DIVIDE, EQUAL, INEQUAL, NOT, GREATER, LESSER, AND, OR, XOR, NEG, SHIFT, STOI, STOD, ITOC, CTOI, TOSTRING, FUN, RETURN, ENDFUN, PUSHARG, CALL, STRUCT, ENDSTRUCT, INIT, GETFIELD, SETFIELD, USE, EXTERN, CREATELABEL, PAUSE, DROP, LICENSE, ERRORCMD
|
||||||
} GroundInstType;
|
} GroundInstType;
|
||||||
|
|
||||||
typedef enum GroundValueType {
|
typedef enum GroundValueType {
|
||||||
|
|||||||
@@ -1332,9 +1332,9 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (right->type == INT) {
|
if (right->type == INT) {
|
||||||
result += right->data.intVal;
|
result -= right->data.intVal;
|
||||||
} else if (right->type == DOUBLE) {
|
} else if (right->type == DOUBLE) {
|
||||||
result += right->data.doubleVal;
|
result -= right->data.doubleVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
addVariable(scope->variables, in->args.args[2].value.refName, createDoubleGroundValue(result));
|
addVariable(scope->variables, in->args.args[2].value.refName, createDoubleGroundValue(result));
|
||||||
@@ -2106,7 +2106,7 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
|||||||
runtimeError(TOO_MANY_ARGS, "Expecting 3 args", in, currentInstruction);
|
runtimeError(TOO_MANY_ARGS, "Expecting 3 args", in, currentInstruction);
|
||||||
}
|
}
|
||||||
if (in->args.args[0].type != VALUE) {
|
if (in->args.args[0].type != VALUE) {
|
||||||
runtimeError(ARG_TYPE_MISMATCH, "Expecting an Object for arg 1", in, currentInstruction);
|
runtimeError(ARG_TYPE_MISMATCH, "Expecting a Value for arg 1", in, currentInstruction);
|
||||||
}
|
}
|
||||||
if (in->args.args[0].value.value.type != CUSTOM) {
|
if (in->args.args[0].value.value.type != CUSTOM) {
|
||||||
runtimeError(ARG_TYPE_MISMATCH, "Expecting an Object for arg 1", in, currentInstruction);
|
runtimeError(ARG_TYPE_MISMATCH, "Expecting an Object for arg 1", in, currentInstruction);
|
||||||
|
|||||||
@@ -540,6 +540,12 @@ void printGroundInstruction(GroundInstruction* gi) {
|
|||||||
case INIT:
|
case INIT:
|
||||||
printf("init");
|
printf("init");
|
||||||
break;
|
break;
|
||||||
|
case SETFIELD:
|
||||||
|
printf("setfield");
|
||||||
|
break;
|
||||||
|
case GETFIELD:
|
||||||
|
printf("getfield");
|
||||||
|
break;
|
||||||
case USE:
|
case USE:
|
||||||
printf("use");
|
printf("use");
|
||||||
break;
|
break;
|
||||||
|
|||||||
6
tests/log.txt
Normal file
6
tests/log.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Lists are deprecated, please migrate to using the "collections" library soon.
|
||||||
|
Ground runtime error:
|
||||||
|
ErrorType: Hello
|
||||||
|
ErrorContext: [1, 2, 3, Hi!]
|
||||||
|
ErrorInstruction: error "Hello" [1, 2, 3, Hi!] 1
|
||||||
|
ErrorLine: 2
|
||||||
Reference in New Issue
Block a user