Code

frontend: Require strings instead of identifiers.
[sysdb.git] / src / frontend / grammar.y
index 004a5effa1537a29473066103757cd169867c37a..ce313310b918f9c6011410d2e9e9c60e430ab67d 100644 (file)
@@ -75,7 +75,7 @@ sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *msg);
 
 %token SCANNER_ERROR
 
-%token <str> IDENTIFIER
+%token <str> IDENTIFIER STRING
 %token <node> FETCH LIST
 
 %type <list> statements
@@ -148,12 +148,14 @@ statement:
        ;
 
 fetch_statement:
-       FETCH IDENTIFIER
+       FETCH STRING
                {
                        $$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
                                                conn_fetch_t, conn_fetch_destroy));
                        CONN_FETCH($$)->name = strdup($2);
                        $$->cmd = CONNECTION_FETCH;
+                       free($2);
+                       $2 = NULL;
                }
        ;
 
@@ -167,7 +169,7 @@ list_statement:
        ;
 
 expression:
-       IDENTIFIER
+       STRING
                {
                        $$ = SDB_CONN_NODE(sdb_object_create_T(/* name = */ NULL,
                                                conn_node_matcher_t));