]> Nishi Git Mirror - dataworks.git/commitdiff
Fix grammar and stuff
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 12 Jun 2024 00:23:23 +0000 (00:23 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 12 Jun 2024 00:23:23 +0000 (00:23 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@241 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Document/Doxyfile
Document/index.md
Grammar/dw.l
Grammar/dw.y
Library/exec.c
dataworks.vim

index 862e7f3e77cc269fd5839886d90f7e8ad74a4b4a..af3c8b6cfacf22e03803b34dc47e7a5701bfd613 100644 (file)
@@ -32,6 +32,6 @@ GENERATE_LATEX = NO
 HTML_EXTRA_STYLESHEET = doxygen-theme/doxygen-awesome.css
 HTML_COLORSTYLE = LIGHT
 
-EXAMPLE_PATH = ../Client
+EXAMPLE_PATH = ../Server ../Client
 EXAMPLE_RECURSIVE = YES
 EXAMPLE_PATTERNS = *.c
index a5e62d7d9adaf89b4ef667a05ef5232c83a4ab6c..e312d84c43a5ad3389662a88e69b77a1d94db1a8 100644 (file)
@@ -9,3 +9,4 @@
 Crabware is a software-development division of Hinode Gakuen PC-Club. Contact: Nishi &lt;nishi@nishi.boats&gt;
 
 @example client.c
+@example server.c
index f90079f332b774e04a684be83a43198883b24e5f..98055cc16e2c3c23ae5e7b26e7d90a579c53c345 100644 (file)
@@ -55,14 +55,22 @@ double __dw_atof(const char* str);
        return (STRING);
 }
 [ \t]*#.*                      { return (COMMENT); }
-[a-zA-Z_][a-zA-Z0-9_\-]*       {
+[a-zA-Z_][a-zA-Z0-9_\-]+       {
        yylval.node.ident = strdup(yytext);
        yylval.node.nodes = NULL;
        yylval.node.string = NULL;
        yylval.node.type = 'I';
        return (IDENTIFIER);
 }
--?[0-9]+(\.[0-9]+)?            {
+[YTNF]                         {
+       yylval.node.ident = NULL;
+       yylval.node.nodes = NULL;
+       yylval.node.string = NULL;
+       yylval.node.logical = (yytext[0] == 'Y' || yytext[0] == 'T') ? 0xff : 0;
+       yylval.node.type = 'L';
+       return (LOGICAL);
+}
+[\+-]?[0-9]+(\.[0-9]+)?                {
        yylval.node.ident = NULL;
        yylval.node.nodes = NULL;
        yylval.node.string = NULL;
index 35e453aa712997676195fe5756a2e577d02642fd..6a6e528de6337f634a88e51ee284c41b7e21aa66 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdio.h>
 %}
 
-%token IDENTIFIER STRING NUMBER SPACE COMMENT
+%token IDENTIFIER STRING NUMBER SPACE COMMENT LOGICAL
 %start command
 
 %union {
@@ -41,6 +41,7 @@
                        int errnum;
                char type;
                double number;
+               unsigned char logical;
                struct Node** nodes;
        } node;
 }
@@ -59,7 +60,9 @@ argument
                $<node>$.string = $<node>1.string;
                $<node>$.nodes = $<node>1.nodes;
                $<node>$.ident = $<node>1.ident;
+               $<node>$.number = $<node>1.number;
                $<node>$.type = $<node>1.type;
+               $<node>$.logical = $<node>1.logical;
        }
        | NUMBER {
                $<node>$.string = $<node>1.string;
@@ -67,6 +70,15 @@ argument
                $<node>$.ident = $<node>1.ident;
                $<node>$.number = $<node>1.number;
                $<node>$.type = $<node>1.type;
+               $<node>$.logical = $<node>1.logical;
+       }
+       | LOGICAL {
+               $<node>$.string = $<node>1.string;
+               $<node>$.nodes = $<node>1.nodes;
+               $<node>$.ident = $<node>1.ident;
+               $<node>$.number = $<node>1.number;
+               $<node>$.type = $<node>1.type;
+               $<node>$.logical = $<node>1.logical;
        }
        | command {
                $<node>$ = $<node>1;
@@ -80,6 +92,7 @@ single_argument
                $<node>$.ident = $<node>2.ident;
                $<node>$.number = $<node>2.number;
                $<node>$.type = $<node>2.type;
+               $<node>$.logical = $<node>2.logical;
        }
        | SPACE argument {
                $<node>$.string = $<node>2.string;
@@ -87,6 +100,7 @@ single_argument
                $<node>$.ident = $<node>2.ident;
                $<node>$.number = $<node>2.number;
                $<node>$.type = $<node>2.type;
+               $<node>$.logical = $<node>2.logical;
        }
        | argument SPACE {
                $<node>$.string = $<node>1.string;
@@ -94,6 +108,7 @@ single_argument
                $<node>$.ident = $<node>1.ident;
                $<node>$.number = $<node>1.number;
                $<node>$.type = $<node>1.type;
+               $<node>$.logical = $<node>1.logical;
        }
        | argument {
                $<node>$.string = $<node>1.string;
@@ -101,6 +116,7 @@ single_argument
                $<node>$.ident = $<node>1.ident;
                $<node>$.number = $<node>1.number;
                $<node>$.type = $<node>1.type;
+               $<node>$.logical = $<node>1.logical;
        }
        ;
 
@@ -111,6 +127,7 @@ arguments
                $<node>$.nodes[0]->nodes = NULL;
                $<node>$.nodes[0]->ident = NULL;
                $<node>$.nodes[0]->string = NULL;
+               $<node>$.nodes[0]->logical = $<node>1.logical;
                $<node>$.nodes[0]->number = $<node>1.number;
                $<node>$.nodes[0]->type = $<node>1.type;
                if($<node>1.ident != NULL) $<node>$.nodes[0]->ident = __dw_strdup($<node>1.ident);
@@ -128,6 +145,7 @@ arguments
                $<node>$.nodes[i]->nodes = NULL;
                $<node>$.nodes[i]->ident = NULL;
                $<node>$.nodes[i]->string = NULL;
+               $<node>$.nodes[i]->logical = $<node>3.logical;
                $<node>$.nodes[i]->number = $<node>3.number;
                $<node>$.nodes[i]->type = $<node>3.type;
                if($<node>3.ident != NULL) $<node>$.nodes[i]->ident = __dw_strdup($<node>3.ident);
index 6fbc395be09f7e423213c17879878216e79add3c..fa629e569e73d6f4c9b2bd944703c37198235ab7 100644 (file)
@@ -50,8 +50,10 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                char* fieldtypes = malloc(1);
                fieldtypes[0] = 0;
                char* name = NULL;
+               bool used = false;
                if(__dw_strcaseequ(node->ident, "version")) {
                        newnode->string = __dw_strdup(dataworks_get_version());
+                       used = true;
                }
                if(node->nodes != NULL) {
                        for(i = 0; node->nodes[i] != NULL; i++) {
@@ -73,6 +75,7 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                                                printf("%s", r->string);
                                        }
                                        fflush(stdout);
+                                       used = true;
                                } else if(__dw_strcaseequ(node->ident, "concat")) {
                                        if(r->string != NULL) {
                                                if(newnode->string == NULL) {
@@ -83,6 +86,7 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                                                newnode->string = __dw_strcat(tmp, r->string);
                                                free(tmp);
                                        }
+                                       used = true;
                                } else if(__dw_strcaseequ(node->ident, "use")) {
                                        if(name != NULL) {
                                                newnode->errnum = DW_ERR_EXEC_TOO_MANY_ARGUMENTS;
@@ -97,6 +101,7 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                                        if(name == NULL) {
                                                name = __dw_strdup(r->string);
                                        }
+                                       used = true;
                                } else if(__dw_strcaseequ(node->ident, "create_table")) {
                                        if(name == NULL) {
                                                name = __dw_strdup(r->string);
@@ -139,6 +144,7 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                                                }
                                                free(val);
                                        }
+                                       used = true;
                                } else {
                                        int j;
                                        for(i = 0; fields[i] != NULL; i++) free(fields[i]);
@@ -167,7 +173,7 @@ struct Node* parser_process(struct dataworks_db* db, struct Node* node, bool dol
                        } else {
                                newnode->errnum = DW_ERR_EXEC_INSUFFICIENT_ARGUMENTS;
                        }
-               } else {
+               } else if(!used) {
                        newnode->errnum = DW_ERR_EXEC_UNKNOWN_METHOD;
                }
                if(name != NULL) free(name);
index 4408c7202978978c837e64178fcf766ebe76c4cf..732340b56e2ee45bef51ce8f54c1fd5f798f91a1 100644 (file)
@@ -13,7 +13,7 @@ syn match dataworksString /\v'[^']+'/ display
 syn match dataworksNumber /\v[+-]?[0-9]+(\.[0-9]+)?/ display
 syn match dataworksComment /\v#.*$/ display
 syn region dataworksArgument start='(' end=')' fold transparent
-syn match dataworksIdent /\v\c(create_table|use|insert|print|version|select|index)/ display
+syn match dataworksIdent /\v\c(create_table|use|insert|print|version|select|index|concat)/ display
 
 hi def link dataworksString String
 hi def link dataworksNumber Number