+added a clear_parser parameter to the mb_run function. +added an extra end of running checking after stepped.

This commit is contained in:
Wang Renxin 2017-05-14 17:04:47 +08:00
parent f3b8fa1905
commit aa083f26fc
4 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,7 @@
May. 14 2017
Added a clear_parser parameter to the mb_run function
Added an extra end of running checking after stepped
May. 13 2017
Added an MB_ENABLE_FULL_ERROR macro

Binary file not shown.

View File

@ -10180,6 +10180,7 @@ static int _execute_statement(mb_interpreter_t* s, _ls_node_t** l, bool_t force_
_running_context_t* running = 0;
_ls_node_t* sub_stack = 0;
bool_t skip_to_eoi = true;
bool_t end_of_ast = false;
mb_assert(s && l);
@ -10359,10 +10360,18 @@ _exit:
*l = ast;
if(!ast) {
ast = _ls_back(s->ast);
end_of_ast = true;
}
do {
int ret = _stepped(s, ast);
if(result == MB_FUNC_OK)
result = ret;
if(end_of_ast && ast && ast->next) /* May be changed when stepping */
*l = ast->next;
} while(0);
return result;
@ -13221,7 +13230,7 @@ _exit:
}
/* Run the current AST */
int mb_run(struct mb_interpreter_t* s) {
int mb_run(struct mb_interpreter_t* s, bool_t clear_parser) {
int result = MB_FUNC_OK;
_ls_node_t* ast = 0;
@ -13248,7 +13257,8 @@ int mb_run(struct mb_interpreter_t* s) {
#endif /* MB_ENABLE_CLASS */
}
_destroy_parsing_context(&s->parsing_context);
if(clear_parser)
_destroy_parsing_context(&s->parsing_context);
s->handled_error = false;

View File

@ -648,7 +648,7 @@ MBAPI int mb_eval_routine(struct mb_interpreter_t* s, void** l, mb_value_t val,
MBAPI int mb_load_string(struct mb_interpreter_t* s, const char* l, bool_t reset/* = true*/);
MBAPI int mb_load_file(struct mb_interpreter_t* s, const char* f);
MBAPI int mb_run(struct mb_interpreter_t* s);
MBAPI int mb_run(struct mb_interpreter_t* s, bool_t clear_parser/* = true*/);
MBAPI int mb_suspend(struct mb_interpreter_t* s, void** l);
MBAPI int mb_schedule_suspend(struct mb_interpreter_t* s, int t);