]> Nishi Git Mirror - dataworks.git/commitdiff
parse
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 06:13:26 +0000 (06:13 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 06:13:26 +0000 (06:13 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@79 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/main.c
Library/dw_parser.h
Library/parser.c

index 6b6c47661ade1ccdc43ff6d9bae0174bd4c57647..c17e59380ab254960453c0c107a537fa45d7299e 100644 (file)
@@ -179,7 +179,7 @@ int main(int argc, char** argv) {
                                        printf("Unknown dot-command.\n");
                                }
                        } else if(strlen(buf) > 0) {
-                               struct __dw_token* token = __dw_parser_parse(buf);
+                               struct __dw_token* token = __dw_parser_parse(NULL, buf);
                                if(token != NULL) {
                                        if(token->error) {
                                                printf("%s\n", dataworks_database_strerror(token->errnum));
index 0ebfdca266d37ece71bb34a5fbc77dbff17f29c1..cab2316892306738ffe210d6442db24779f6b143 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* name, const char* str);
 
 #ifdef __cplusplus
 }
index 0a70a9bba6fb99f1981320dd1fd3f6be97ffb37d..6ef9929f2493b72a3cdea0d8812a6d1f26bcf2a0 100644 (file)
@@ -35,7 +35,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 
-struct __dw_token* __dw_parser_parse(const char* str) {
+struct __dw_token* __dw_parser_parse(const char* name, const char* str) {
        struct __dw_token* token = malloc(sizeof(*token));
        token->error = false;
        token->errnum = DW_ERR_SUCCESS;
@@ -59,18 +59,14 @@ struct __dw_token* __dw_parser_parse(const char* str) {
                                br = __dw_strcat(tmp, cbuf);
                                free(tmp);
                        } else {
-                               printf("%s\n", br);
-                               __dw_parser_parse(br);
+                               printf("%s:%s\n", buf, br);
+                               __dw_parser_parse(buf, br);
                        }
                } else if(dq) {
                        char* tmp = buf;
                        buf = __dw_strcat(tmp, cbuf);
                        free(tmp);
                } else if(str[i] == '(') {
-                       printf("%s\n", buf);
-                       free(buf);
-                       buf = malloc(1);
-                       buf[0] = 0;
                        brace++;
                } else if(str[i] == ')') {
                        brace--;