From d695b0e9ca956c5c745677d3e15b4d61eb9a645c Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:54:41 +0800 Subject: [PATCH] update --- balloon/abstract_syntax_tree.cpp | 14 ++++++++++++-- balloon/balloon_lexer.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/balloon/abstract_syntax_tree.cpp b/balloon/abstract_syntax_tree.cpp index c92f247..019a1e9 100644 --- a/balloon/abstract_syntax_tree.cpp +++ b/balloon/abstract_syntax_tree.cpp @@ -673,13 +673,23 @@ void abstract_syntax_tree::run_root() else if(i->type==__while) { scope.add_new_block_scope(); - i->run_loop(); + int ret_type=i->run_loop(); + if(ret_type==__return) + { + std::cout<<"[Runtime-error] line "<type==__ifelse) { scope.add_new_block_scope(); - i->run_ifelse(); + int ret_type=i->run_ifelse(); + if(ret_type==__continue || ret_type==__break || ret_type==__return) + { + std::cout<<"[Runtime-error] line "<& get_resource()