From 78683ffbd498b2a2e4cddb256e16118adccc212a Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Sun, 19 Jul 2020 20:03:25 -0700 Subject: [PATCH] bugs fixed --- version3.0/nasal_parse.h | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/version3.0/nasal_parse.h b/version3.0/nasal_parse.h index 54ffd47..59c9f7d 100644 --- a/version3.0/nasal_parse.h +++ b/version3.0/nasal_parse.h @@ -138,8 +138,12 @@ void nasal_parse::main_process() ++ptr; else if(root.get_children().empty() || need_semi_check(root.get_children().back())) { - ++error; - error_info(error_line,lack_semi); + // the last expression can be recognized without semi + if(ptr>=tok_list_size) + { + ++error; + error_info(error_line,lack_semi); + } } } std::cout<<">> [parse] complete generation. "<=tok_list_size || tok_list[ptr].type!=tok_right_brace) + { + ++error; + error_info(error_line,lack_semi); + break; + } } } if(ptr>=tok_list_size || tok_list[ptr].type!=tok_right_brace) @@ -580,7 +594,12 @@ nasal_ast nasal_parse::calculation() tmp.add_child(node); ++ptr; if(ptr=tok_list_size || tok_list[ptr].type!=tok_colon) {