From 4d74e5a064b9db8ebf0fa04f9046ad46ad32e2a2 Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Fri, 13 Mar 2020 20:58:52 +0800 Subject: [PATCH] update --- version2.0/nasal_runtime.h | 52 +++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/version2.0/nasal_runtime.h b/version2.0/nasal_runtime.h index 7131a2f..bb61114 100644 --- a/version2.0/nasal_runtime.h +++ b/version2.0/nasal_runtime.h @@ -31,6 +31,7 @@ class nasal_runtime int hash_generation (std::list >&,abstract_syntax_tree&); int function_generation(std::list >&,abstract_syntax_tree&); int calculation (std::list >&,abstract_syntax_tree&); + int* get_identifier_addr(std::list >&,abstract_syntax_tree&); int call_identifier (std::list >&,abstract_syntax_tree&); void definition (std::list >&,abstract_syntax_tree&); void loop_expr (std::list >&,abstract_syntax_tree&); @@ -500,7 +501,10 @@ int nasal_runtime::calculation(std::list >& local_scop } else if(node_type==__equal) { - ; + int child_node_type_1=node.get_children().front().get_node_type(); + int child_node_type_2=node.get_children().back().get_node_type(); + if(child_node_type_1==__multi_scalar) + ; } else if(node_type==__add_equal || node_type==__sub_equal || node_type==__mul_equal || node_type==__div_equal) { @@ -837,8 +841,17 @@ int nasal_runtime::calculation(std::list >& local_scop nasal_gc.reference_delete(addr); return ret_addr; } + else if(node_type==__ques_mark) + { + ; + } return -1; } +int* nasal_runtime::get_identifier_addr(std::list >& local_scope,abstract_syntax_tree& node) +{ + int* ret_addr=NULL; + return ret_addr; +} int nasal_runtime::call_identifier(std::list >& local_scope,abstract_syntax_tree& node) { int addr=-1; @@ -871,20 +884,53 @@ void nasal_runtime::definition(std::list >& local_scop { if(local_scope.empty()) ; + if(node.get_children().front().get_node_type()==__multi_id) + { + ; + } + else + { + ; + } return; } void nasal_runtime::loop_expr(std::list >& local_scope,abstract_syntax_tree& node) { std::map new_scope; local_scope.push_back(new_scope); - + int loop_type=node.get_node_type(); + if(loop_type==__while) + { + ; + } + else if(loop_type==__foreach) + { + ; + } + else if(loop_type==__forindex) + { + ; + } + else if(loop_type==__for) + { + ; + } return; } void nasal_runtime::conditional(std::list >& local_scope,abstract_syntax_tree& node) { std::map new_scope; local_scope.push_back(new_scope); - + for(std::list::iterator i=node.get_children().begin();i!=node.get_children().end();++i) + { + int condition_node_type=i->get_node_type(); + if(condition_node_type==__if) + ; + else if(condition_node_type==__elsif) + ; + else + ; + } return; }