From: Sebastian Harl Date: Mon, 1 Dec 2014 16:36:29 +0000 (+0100) Subject: frontend/grammar: Added support for . . X-Git-Tag: sysdb-0.7.0~120 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d688b764f6ebf7609c79c4726d68c2e72da5ebf7;p=sysdb.git frontend/grammar: Added support for . . … where may be an arbitrary expression accessing an object's fields or attributes. --- diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y index 2872bcf..187f359 100644 --- a/src/frontend/grammar.y +++ b/src/frontend/grammar.y @@ -161,7 +161,7 @@ sdb_fe_yyerrorf(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *fmt, ...); %type matcher compare_matcher -%type expression +%type expression object_expression %type object_type object_type_plural %type iterable @@ -516,6 +516,25 @@ expression: sdb_object_deref(SDB_OBJ($3)); $3 = NULL; } | + object_expression + { + $$ = $1; + } + | + data + { + $$ = sdb_store_expr_constvalue(&$1); + sdb_data_free_datum(&$1); + } + ; + +object_expression: + object_type '.' object_expression + { + $$ = sdb_store_expr_typed($1, $3); + sdb_object_deref(SDB_OBJ($3)); + } + | field { $$ = sdb_store_expr_fieldvalue($1); @@ -526,12 +545,6 @@ expression: $$ = sdb_store_expr_attrvalue($3); free($3); $3 = NULL; } - | - data - { - $$ = sdb_store_expr_constvalue(&$1); - sdb_data_free_datum(&$1); - } ; object_type: