#include <assert.h>
#include <errno.h>
#include <inttypes.h>
-#include "filter-parser.h"
#include "filter-ast.h"
+#include "filter-parser.h"
#include "filter-ir.h"
static
return op;
}
+static
+struct ir_op *make_op_load_float(double v, enum ir_side side)
+{
+ struct ir_op *op;
+
+ op = calloc(sizeof(struct ir_op), 1);
+ if (!op)
+ return NULL;
+ op->op = IR_OP_LOAD;
+ op->data_type = IR_DATA_FLOAT;
+ op->signedness = IR_SIGN_UNKNOWN;
+ op->side = side;
+ op->u.load.u.flt = v;
+ return op;
+}
+
static
struct ir_op *make_op_load_field_ref(char *string, enum ir_side side)
{
}
if ((left->data_type == IR_DATA_STRING
- && right->data_type == IR_DATA_NUMERIC)
- || (left->data_type == IR_DATA_NUMERIC &&
+ && (right->data_type == IR_DATA_NUMERIC || right->data_type == IR_DATA_FLOAT))
+ || ((left->data_type == IR_DATA_NUMERIC || left->data_type == IR_DATA_FLOAT) &&
right->data_type == IR_DATA_STRING)) {
fprintf(stderr, "[error] binary operation '%s' operand type mismatch\n", op_str);
goto error;
case AST_EXP_CONSTANT:
return make_op_load_numeric(node->u.expression.u.constant,
side);
+ case AST_EXP_FLOAT_CONSTANT:
+ return make_op_load_float(node->u.expression.u.float_constant,
+ side);
case AST_EXP_IDENTIFIER:
if (node->u.expression.pre_op != AST_LINK_UNKNOWN) {
fprintf(stderr, "[error] %s: dotted and dereferenced identifiers not supported\n", __func__);