2014-10-09 04:26:38 +02:00
|
|
|
|
|
|
|
#include "Expr.h"
|
2014-10-09 04:46:25 +02:00
|
|
|
#include <stdio.h>
|
2014-10-09 04:26:38 +02:00
|
|
|
|
|
|
|
Expr* makeColumnRef(char* name) {
|
|
|
|
ALLOC_EXPR(e, eExprColumnRef);
|
|
|
|
e->name = name;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
Expr* makeFunctionRef(char* func_name, Expr* expr) {
|
|
|
|
ALLOC_EXPR(e, eExprFunctionRef);
|
|
|
|
e->name = func_name;
|
2014-10-09 04:46:25 +02:00
|
|
|
e->expr = expr;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2014-10-22 16:01:25 +02:00
|
|
|
Expr* makePredicate(Expr* expr1, uint op, Expr* expr2) {
|
2014-10-09 04:46:25 +02:00
|
|
|
ALLOC_EXPR(e, eExprPredicate);
|
2014-10-22 16:01:25 +02:00
|
|
|
// printf("Pred: %u\n", op);
|
|
|
|
e->pred_type = op;
|
2014-10-09 04:46:25 +02:00
|
|
|
e->expr = expr1;
|
|
|
|
e->expr2 = expr2;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
Expr* makeFloatLiteral(float value) {
|
|
|
|
ALLOC_EXPR(e, eExprLiteralFloat);
|
|
|
|
e->float_literal = value;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
Expr* makeStringLiteral(char* string) {
|
|
|
|
ALLOC_EXPR(e, eExprLiteralString);
|
|
|
|
e->name = string;
|
2014-10-09 04:26:38 +02:00
|
|
|
return e;
|
2014-10-20 23:19:27 +02:00
|
|
|
}
|