aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexample.tsl8
-rw-r--r--include/bytecode.h2
-rw-r--r--src/bytecode.c2
-rw-r--r--src/parser.c2
-rw-r--r--src/program.c4
5 files changed, 9 insertions, 9 deletions
diff --git a/example.tsl b/example.tsl
index 879c0ce..eb92e0e 100755
--- a/example.tsl
+++ b/example.tsl
@@ -22,7 +22,7 @@ value4 = "hello world"
# loadv "value4"
# loadn 0.000000
-# mindex
+# index
# setv "c"
#c = value4[0]
@@ -35,7 +35,7 @@ value5 = ["hello", "world", 5]
# loadv "value5"
# loadn 0
-# mindex
+# index
# setv "list_index_value"
list_index_value = value5[0]
@@ -88,13 +88,13 @@ value9 = {
# loadv "value9"
# loads "hello"
-# mindex
+# index
# setv "str"
str = value9["hello"]
# loadv "value9"
# loads "sayHello"
-# mindex
+# index
# callf 0
value9["sayHello"]()
diff --git a/include/bytecode.h b/include/bytecode.h
index c0930ad..602d8a6 100644
--- a/include/bytecode.h
+++ b/include/bytecode.h
@@ -18,7 +18,7 @@ typedef enum {
TSL_OPCODE_SETV, /* set variable to the value at the top of the stack */
TSL_OPCODE_LIST, /* create a list using values from the stack */
TSL_OPCODE_MAP, /* create a map using values from the stack */
- TSL_OPCODE_MINDEX, /* map index. pop two values from stack, where the first value will be a map and the second a key */
+ TSL_OPCODE_INDEX, /* list/map/string index. pop two values from stack, where the first value will be a list/map/string and the second a key/index */
TSL_OPCODE_CALLF, /* call the function at the top of the stack using the next N values at the top of the stack as arguments */
TSL_OPCODE_ADD,
TSL_OPCODE_SUB,
diff --git a/src/bytecode.c b/src/bytecode.c
index 6f6e6aa..b7c0364 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -13,7 +13,7 @@ const char* tsl_opcode_to_string(TslOpcode opcode) {
case TSL_OPCODE_SETV: return "setv";
case TSL_OPCODE_LIST: return "list";
case TSL_OPCODE_MAP: return "map";
- case TSL_OPCODE_MINDEX: return "mindex";
+ case TSL_OPCODE_INDEX: return "index";
case TSL_OPCODE_CALLF: return "callf";
case TSL_OPCODE_ADD: return "add";
case TSL_OPCODE_SUB: return "sub";
diff --git a/src/parser.c b/src/parser.c
index 347e0de..e7fa99c 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -188,7 +188,7 @@ static TslParseResult tsl_parser_parse_var_indexing(TslParser *self) {
return_if_error(tsl_tokenizer_accept(&self->tokenizer, TSL_TOKEN_LBRACKET));
return_if_error(tsl_parser_parse_rhs(self));
return_if_error(tsl_tokenizer_accept(&self->tokenizer, TSL_TOKEN_RBRACKET));
- return tsl_bytecode_add_ins5(get_function_bytecode(self), TSL_OPCODE_MINDEX);
+ return tsl_bytecode_add_ins5(get_function_bytecode(self), TSL_OPCODE_INDEX);
}
/* FUNC_CALL = '(' (RHS ',')* ')' */
diff --git a/src/program.c b/src/program.c
index 030d5aa..7005c71 100644
--- a/src/program.c
+++ b/src/program.c
@@ -363,11 +363,11 @@ static TslProgramResult tsl_program_run_function(TslProgram *self, int function_
instruction += sizeof(TslInstructionType1);
break;
}
- case TSL_OPCODE_MINDEX: {
+ case TSL_OPCODE_INDEX: {
TslStackValue stack_value;
stack_value.type = TSL_STACK_VALUE_TYPE_INDEX;
cleanup_if_error(tsl_buffer_append(&self->stack_values, &stack_value, sizeof(stack_value)));
- /*printf("mindex\n");*/
+ /*printf("index\n");*/
instruction += sizeof(TslInstructionType5);
break;
}