From d595d5f26f1d6b4cf2a84d28a5f32aa86b66df5b Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Tue, 22 Oct 2019 21:47:46 +0800 Subject: [PATCH] Fixed bug in calculation --- version1.2/nasal_parser.h | 184 +++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/version1.2/nasal_parser.h b/version1.2/nasal_parser.h index 1389f02..a3e0952 100644 --- a/version1.2/nasal_parser.h +++ b/version1.2/nasal_parser.h @@ -1204,45 +1204,91 @@ abstract_syntax_tree nasal_parser::mul_div_operator_expr() { abstract_syntax_tree node; abstract_syntax_tree temp; - node.set_node_type(this_token.type); + get_token(); + switch(this_token.type) + { + case __nor_operator: + case __sub_operator: + node=unary_operator_expr(); + break; + case __number: + node.set_node_type(__number); + node.set_var_number(this_token.content); + break; + case __string: + node.set_node_type(__string); + node.set_var_string(this_token.content); + break; + case __id: + node.set_node_type(__id); + node.set_var_name(this_token.content); + node.add_child(identifier_call_expr()); + break; + case __left_curve: + parse.push(this_token); + node=calculation_expr(); + break; + default: + ++error; + std::cout<<">>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<