From: Sebastian Harl Date: Mon, 23 Jun 2014 18:40:24 +0000 (+0200) Subject: frontend: Added initial parser for "data" values. X-Git-Tag: sysdb-0.2.0~38 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e3cf0b974dff6df9da8dc4c77b603466ac7e825d;p=sysdb.git frontend: Added initial parser for "data" values. --- diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y index 402e170..c4c4775 100644 --- a/src/frontend/grammar.y +++ b/src/frontend/grammar.y @@ -69,6 +69,8 @@ sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *msg); const char *sstr; /* static string */ char *str; + sdb_data_t data; + sdb_llist_t *list; sdb_conn_node_t *node; @@ -107,6 +109,8 @@ sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *msg); %type op +%type data + %destructor { free($$); } %destructor { sdb_object_deref(SDB_OBJ($$)); } @@ -290,13 +294,12 @@ matcher: * Parse matchers comparing object attributes with a value. */ compare_matcher: - IDENTIFIER '.' IDENTIFIER op STRING + IDENTIFIER '.' IDENTIFIER op data { - sdb_data_t data = { SDB_TYPE_STRING, { .string = $5 } }; - $$ = sdb_store_matcher_parse_cmp($1, $3, $4, &data); + $$ = sdb_store_matcher_parse_cmp($1, $3, $4, &$5); free($1); $1 = NULL; free($3); $3 = NULL; - free($5); $5 = NULL; + sdb_data_free_datum(&$5); } ; @@ -310,6 +313,10 @@ op: CMP_NREGEX { $$ = "!~"; } ; +data: + STRING { $$.type = SDB_TYPE_STRING; $$.data.string = $1; } + ; + %% void