]> Nishi Git Mirror - dataworks.git/commitdiff
show cmd
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 23 May 2024 23:51:27 +0000 (23:51 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 23 May 2024 23:51:27 +0000 (23:51 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@98 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Library/database_exec.c
Library/dw_parser.h
Library/parser.c

index bb2038db5a72f661dc8c4a1859f7da26fd5a067d..ea6ab00ec4035c1720cdb27f054ea4d475404fad 100644 (file)
@@ -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;
index 04ccf4fd9d4e55be5a2cf457da3dc03c3fa579ff..a588b8b6a82cc03ba89994cc329cb91faa1dda5e 100644 (file)
@@ -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);
 
index 922eef1f1a38e4a00c555469979fac01eb23b514..c36634898cb8c8d6bc024913268a3ca7f664f6c4 100644 (file)
@@ -36,7 +36,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-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);