From: nishi Date: Thu, 23 May 2024 23:51:27 +0000 (+0000) Subject: show cmd X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=381b785b5cc402baa0a6776473b9406f09345376;p=dataworks.git show cmd git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@98 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/Library/database_exec.c b/Library/database_exec.c index bb2038d..ea6ab00 100644 --- a/Library/database_exec.c +++ b/Library/database_exec.c @@ -181,7 +181,7 @@ struct dataworks_db_result* dataworks_database_execute_code(struct dataworks_db* struct dataworks_db_result* r = malloc(sizeof(*r)); r->error = false; r->value = NULL; - struct __dw_token* token = __dw_parser_parse(code); + struct __dw_token* token = __dw_parser_parse(code, true); if(token != NULL) { if(token->error) { r->error = true; diff --git a/Library/dw_parser.h b/Library/dw_parser.h index 04ccf4f..a588b8b 100644 --- a/Library/dw_parser.h +++ b/Library/dw_parser.h @@ -52,7 +52,7 @@ struct __dw_token { struct __dw_token** token; }; -struct __dw_token* __dw_parser_parse(const char* str); +struct __dw_token* __dw_parser_parse(const char* str, bool top); void __dw_parser_free(struct __dw_token* token); void __dw_parser_print(struct __dw_token* token, int depth); diff --git a/Library/parser.c b/Library/parser.c index 922eef1..c366348 100644 --- a/Library/parser.c +++ b/Library/parser.c @@ -36,7 +36,7 @@ #include #include -struct __dw_token* __dw_parser_parse(const char* str) { +struct __dw_token* __dw_parser_parse(const char* str, bool top) { struct __dw_token* token = malloc(sizeof(*token)); token->error = false; token->errnum = DW_ERR_SUCCESS; @@ -53,6 +53,7 @@ struct __dw_token* __dw_parser_parse(const char* str) { char* br = malloc(1); bool has_brace = false; br[0] = 0; + int start = 0; for(i = 0; str[i] != 0; i++) { cbuf[0] = str[i]; if(brace > 0) { @@ -132,7 +133,7 @@ struct __dw_token* __dw_parser_parse(const char* str) { free(token->token); } token->token = newtokens; - token->token[j] = __dw_parser_parse(comma); + token->token[j] = __dw_parser_parse(comma, false); token->token[j + 1] = NULL; free(comma); comma = malloc(1); @@ -146,6 +147,7 @@ struct __dw_token* __dw_parser_parse(const char* str) { free(tmp); } } + if(top) printf("%s(%s)\n", buf, br); free(comma); free(br); br = malloc(1);