Code

frontend/grammar: Make IS NULL operators available to any expression.
[sysdb.git] / src / frontend / grammar.y
index 192671823ac67cc1bc541dd22509cbfa50bccaf4..cc0d5b94d475d6ccce027aab7e3601e957ecdc1a 100644 (file)
@@ -450,7 +450,7 @@ compare_matcher:
                        sdb_object_deref(SDB_OBJ($3));
                }
        |
-       IDENTIFIER '[' IDENTIFIER ']' cmp expression
+       IDENTIFIER '[' STRING ']' cmp expression
                {
                        $$ = sdb_store_matcher_parse_cmp($1, $3, $5, $6);
                        free($1); $1 = NULL;
@@ -458,23 +458,16 @@ compare_matcher:
                        sdb_object_deref(SDB_OBJ($6));
                }
        |
-       IDENTIFIER '[' IDENTIFIER ']' IS NULL_T
+       expression IS NULL_T
                {
-                       $$ = sdb_store_matcher_parse_cmp($1, $3, "IS", NULL);
-                       free($1); $1 = NULL;
-                       free($3); $3 = NULL;
+                       $$ = sdb_store_isnull_matcher($1);
+                       sdb_object_deref(SDB_OBJ($1));
                }
        |
-       IDENTIFIER '[' IDENTIFIER ']' IS NOT NULL_T
+       expression IS NOT NULL_T
                {
-                       sdb_store_matcher_t *m;
-                       m = sdb_store_matcher_parse_cmp($1, $3, "IS", NULL);
-                       free($1); $1 = NULL;
-                       free($3); $3 = NULL;
-
-                       /* sdb_store_inv_matcher return NULL if m==NULL */
-                       $$ = sdb_store_inv_matcher(m);
-                       sdb_object_deref(SDB_OBJ(m));
+                       $$ = sdb_store_isnnull_matcher($1);
+                       sdb_object_deref(SDB_OBJ($1));
                }
        ;
 
@@ -533,7 +526,7 @@ expression:
                        $$ = sdb_store_expr_fieldvalue(field);
                }
        |
-       IDENTIFIER '[' IDENTIFIER ']'
+       IDENTIFIER '[' STRING ']'
                {
                        $$ = sdb_store_expr_attrvalue($3);
                        free($1); $1 = NULL;