diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y
index 58363df01dbebe37b861394f09632d47397b850a..9cf98eef406c2b5ecb54096706fd4abba8849050 100644 (file)
--- a/src/frontend/grammar.y
+++ b/src/frontend/grammar.y
%nonassoc IS
%left '+' '-'
%left '*' '/' '%'
+%left '[' ']'
%left '(' ')'
%left '.'
$$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
conn_fetch_t, conn_fetch_destroy));
+ CONN_FETCH($$)->type = SDB_HOST;
CONN_FETCH($$)->name = $3;
CONN_FETCH($$)->filter = CONN_MATCHER($4);
$$->cmd = CONNECTION_FETCH;
list_statement:
LIST IDENTIFIER filter_clause
{
- /* TODO: support other types as well */
- if (strcasecmp($2, "hosts")) {
+ int type = sdb_store_parse_object_type_plural($2);
+ if (type < 0) {
char errmsg[strlen($2) + 32];
snprintf(errmsg, sizeof(errmsg),
YY_("unknown data-source %s"), $2);
$$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
conn_list_t, conn_list_destroy));
+ CONN_LIST($$)->type = type;
CONN_LIST($$)->filter = CONN_MATCHER($3);
$$->cmd = CONNECTION_LIST;
free($2); $2 = NULL;
$$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
conn_lookup_t, conn_lookup_destroy));
+ CONN_LOOKUP($$)->type = SDB_HOST;
CONN_LOOKUP($$)->matcher = CONN_MATCHER($3);
CONN_LOOKUP($$)->filter = CONN_MATCHER($4);
$$->cmd = CONNECTION_LOOKUP;
* Parse matchers comparing object attributes with a value.
*/
compare_matcher:
- ':' IDENTIFIER op expression
+ '.' IDENTIFIER op expression
{
$$ = sdb_store_matcher_parse_field_cmp($2, $3, $4);
free($2); $2 = NULL;
sdb_object_deref(SDB_OBJ($3));
}
|
- IDENTIFIER '.' IDENTIFIER op expression
+ IDENTIFIER '[' IDENTIFIER ']' op expression
{
- $$ = sdb_store_matcher_parse_cmp($1, $3, $4, $5);
+ $$ = sdb_store_matcher_parse_cmp($1, $3, $5, $6);
free($1); $1 = NULL;
free($3); $3 = NULL;
- sdb_object_deref(SDB_OBJ($5));
+ sdb_object_deref(SDB_OBJ($6));
}
|
- IDENTIFIER '.' IDENTIFIER IS NULL_T
+ IDENTIFIER '[' IDENTIFIER ']' IS NULL_T
{
$$ = sdb_store_matcher_parse_cmp($1, $3, "IS", NULL);
free($1); $1 = NULL;
free($3); $3 = NULL;
}
|
- IDENTIFIER '.' IDENTIFIER IS NOT NULL_T
+ IDENTIFIER '[' IDENTIFIER ']' IS NOT NULL_T
{
sdb_store_matcher_t *m;
m = sdb_store_matcher_parse_cmp($1, $3, "IS", NULL);
sdb_object_deref(SDB_OBJ($3)); $3 = NULL;
}
|
- ':' IDENTIFIER
+ '.' IDENTIFIER
{
int field = sdb_store_parse_field_name($2);
free($2); $2 = NULL;