#include <ecoli_test.h>
#include <ecoli_strvec.h>
#include <ecoli_node.h>
+#include <ecoli_parsed.h>
+#include <ecoli_completed.h>
#include <ecoli_node_seq.h>
#include <ecoli_node_many.h>
#include <ecoli_node_or.h>
unsigned int paren_len;
};
-static struct ec_parsed *ec_node_expr_parse(const struct ec_node *gen_node,
- const struct ec_strvec *strvec)
+static int ec_node_expr_parse(const struct ec_node *gen_node,
+ struct ec_parsed *state,
+ const struct ec_strvec *strvec)
{
struct ec_node_expr *node = (struct ec_node_expr *)gen_node;
- return ec_node_parse_strvec(node->child, strvec);
+ return ec_node_parse_child(node->child, state, strvec);
}
static struct ec_completed *ec_node_expr_complete(const struct ec_node *gen_node,
- const struct ec_strvec *strvec)
+ struct ec_parsed *state,
+ const struct ec_strvec *strvec)
{
struct ec_node_expr *node = (struct ec_node_expr *)gen_node;
- return ec_node_complete_strvec(node->child, strvec);
+ return ec_node_complete_child(node->child, state, strvec);
}
static void ec_node_expr_free_priv(struct ec_node *gen_node)
weak = NULL;
node->child = expr;
+ ec_node_dump(stdout, node->child); //XXX
return 0;
return 0;
}
- if (x->has_val && x->op == NULL && y->has_val && y->op != NULL) {
- ret = ops->eval_bin_op(&x->val, userctx, x->val, y->op, y->val);
- if (ret < 0)
- return ret;
+ if (x->has_val && y->has_val && y->op != NULL) {
+ if (y->op_type == BIN_OP) {
+ ret = ops->eval_bin_op(&x->val, userctx, x->val,
+ y->op, y->val);
+ if (ret < 0)
+ return ret;
- return 0;
+ return 0;
+ }
}
if (x->has_val == 0 && x->op != NULL && y->has_val && y->op == NULL) {
return 0;
}
- assert(true); /* we should not get here */
+ assert(false); /* we should not get here */
return -EINVAL;
}