void concat_expr_add(struct expr *concat, struct expr *item);
extern struct expr *list_expr_alloc(const struct location *loc);
+void list_expr_add(struct expr *expr, struct expr *item);
struct expr *list_expr_to_binop(struct expr *expr);
extern struct expr *set_expr_alloc(const struct location *loc,
return compound_expr_alloc(loc, EXPR_LIST);
}
+void list_expr_add(struct expr *expr, struct expr *item)
+{
+ struct expr_list *expr_list = expr_list(expr);
+
+ list_add_tail(&item->list, &expr_list->expressions);
+ expr_list->size++;
+}
+
/* list is assumed to have two items at least, otherwise extend this! */
struct expr *list_expr_to_binop(struct expr *expr)
{
flowtable_list_expr : flowtable_expr_member
{
$$ = compound_expr_alloc(&@$, EXPR_LIST);
- compound_expr_add($$, $1);
+ list_expr_add($$, $1);
}
| flowtable_list_expr COMMA flowtable_expr_member
{
- compound_expr_add($1, $3);
+ list_expr_add($1, $3);
$$ = $1;
}
| flowtable_list_expr COMMA opt_newline
YYERROR;
$$ = compound_expr_alloc(&@$, EXPR_LIST);
- compound_expr_add($$, expr);
+ list_expr_add($$, expr);
}
| DEVICE variable_expr
{
datatype_set($2->sym->expr, &ifname_type);
$$ = compound_expr_alloc(&@$, EXPR_LIST);
- compound_expr_add($$, $2);
+ list_expr_add($$, $2);
}
| DEVICES '=' flowtable_expr
{
list_rhs_expr : basic_rhs_expr COMMA basic_rhs_expr
{
$$ = list_expr_alloc(&@$);
- compound_expr_add($$, $1);
- compound_expr_add($$, $3);
+ list_expr_add($$, $1);
+ list_expr_add($$, $3);
}
| list_rhs_expr COMMA basic_rhs_expr
{
$1->location = @$;
- compound_expr_add($1, $3);
+ list_expr_add($1, $3);
$$ = $1;
}
;
list_stmt_expr : symbol_stmt_expr COMMA symbol_stmt_expr
{
$$ = list_expr_alloc(&@$);
- compound_expr_add($$, $1);
- compound_expr_add($$, $3);
+ list_expr_add($$, $1);
+ list_expr_add($$, $3);
}
| list_stmt_expr COMMA symbol_stmt_expr
{
$1->location = @$;
- compound_expr_add($1, $3);
+ list_expr_add($1, $3);
$$ = $1;
}
;
expr_free(list);
return NULL;
}
- compound_expr_add(list, expr);
+ list_expr_add(list, expr);
}
return list;
case JSON_TRUE:
return NULL;
}
- compound_expr_add(expr, tmp);
+ list_expr_add(expr, tmp);
return expr;
}
if (!json_is_array(root)) {
expr_free(expr);
return NULL;
}
- compound_expr_add(expr, tmp);
+ list_expr_add(expr, tmp);
}
return expr;
}
if (bitv == 0)
continue;
- compound_expr_add(list_expr,
- constant_expr_alloc(&netlink_location,
- dtype, byteorder,
- len * BITS_PER_BYTE,
- &bitv));
+ list_expr_add(list_expr,
+ constant_expr_alloc(&netlink_location,
+ dtype, byteorder,
+ len * BITS_PER_BYTE,
+ &bitv));
}
mpz_clear(value);