From 5b7cb73538bb7dac6d69b1f51b22f0f394d382b8 Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Tue, 22 Oct 2019 00:04:36 +0800 Subject: [PATCH] Improvement --- version1.1/nasal_parser.h | 301 ++++++-------------------------------- 1 file changed, 46 insertions(+), 255 deletions(-) diff --git a/version1.1/nasal_parser.h b/version1.1/nasal_parser.h index 2a9aacd..ae12577 100644 --- a/version1.1/nasal_parser.h +++ b/version1.1/nasal_parser.h @@ -99,6 +99,7 @@ class nasal_parser void calculation_expr(); void identifier_call_expr(); void call_list_expr(); + void parameter_function_expr(); void call_function_expr(); void call_hash_expr(); void list_generate_expr(); @@ -113,7 +114,6 @@ class nasal_parser void check_semi_at_end(); void statements_block(); void function_generate_expr(); - void parameter_func_expr(); void return_expr(); }; void nasal_parser::check_semi_at_end() @@ -159,34 +159,16 @@ void nasal_parser::statements_block() get_token(); while(this_token.type!=__right_brace) { - //token t; switch(this_token.type) { case __var:definition_expr();check_semi_at_end();break; + case __left_curve: case __sub_operator: case __nor_operator: case __id: case __number: case __string:parse.push(this_token);calculation_expr();check_semi_at_end();break; case __if:parse.push(this_token);if_else_expr();break; - case __left_curve: -// t=this_token; -// get_token(); -// if(this_token.type==__var) -// { -// parse.push(t); -// definition_expr(); -// } -// else -// { -// parse.push(this_token); -// parse.push(t); -// calculation_expr(); -// } - parse.push(this_token); - calculation_expr(); - check_semi_at_end(); - break; case __while: case __for: case __foreach: @@ -403,35 +385,12 @@ void nasal_parser::hash_generate_expr() void nasal_parser::definition_expr() { get_token(); - //if(this_token.type!=__id && this_token.type!=__left_curve) if(this_token.type!=__id) { ++error; std::cout<<">>[Error] line "<>[Error] line "<>[Error] line "<>[Warning] line "<>[Warning] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<>[Error] line "<