Added new redim instructions to runtime

This commit is contained in:
n00b87
2024-04-22 02:37:09 -05:00
parent 96c8366a4b
commit a84cceb938
5 changed files with 282 additions and 15 deletions

View File

@@ -1480,6 +1480,12 @@ bool pre_parse(int start_token = 0, int end_token = -1, int pp_flags, bool eval_
type_redim_dim[0] = args[0];
type_redim_dim[1] = args[1];
type_redim_dim[2] = args[2];
if(arg_count != id[tmp_id].num_args)
{
rc_setError("Expected " + rc_intToString(id[tmp_id].num_args) + " dimensions but found " + rc_intToString(arg_count));
return false;
}
}
else if(type_delete_flag && (!has_child))
{
@@ -3767,9 +3773,7 @@ bool check_rule()
//cout << "M_ARG[2] = " << multi_arg[2] << endl;
dimensions = multi_arg_count;
}
token_index = end_token+1;
type_redim_flag = false;
token_index = end_token+1;
//cout << "debug 3: " << id_index << endl;
}
@@ -3793,7 +3797,18 @@ bool check_rule()
//if the next token is not an id then the syntax is incorrect and false is returned
rc_setError("Expected Identifier name");
return false;
}
}
if(!type_redim_flag) //if type_redim_flag is set, then this error will get raised in the pre_parse step
{
if(dimensions != id[id_index].num_args) // no longer allowing the user to change dimensions since it can lead to unnecessary confusion
{
rc_setError("Expected " + rc_intToString(id[id_index].num_args) + " dimensions but found " + rc_intToString(dimensions));
return false;
}
}
type_redim_flag = false;
if(dimensions > 0)
{
@@ -3810,10 +3825,10 @@ bool check_rule()
//cout << "debug 6: " << id_index << endl;
if(id[id_index].num_args != dimensions)
{
id[id_index].num_args = dimensions;
}
//if(id[id_index].num_args != dimensions)
//{
// id[id_index].num_args = dimensions;
//}
//cout << "debug 7: " << id_index << " -- " << id[id_index].type << endl;
@@ -3873,6 +3888,8 @@ bool check_rule()
}
else if(id[id_index].type == ID_TYPE_USER)
{
vm_asm.push_back("redim_top"); //This will set the top level flag for redim_type
//cout << "debug 8" << endl;
switch(dimensions)
{