summaryrefslogtreecommitdiffstats
path: root/src/expr.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-08-15 16:51:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-08-15 16:52:34 -0400
commit9749af08293d16f3d5faedea371fdd3699f2adf2 (patch)
tree3ea0cfdad551b976aca81a5ea2344a116c8f778e /src/expr.c
parent50dd5af226853d8d7201c7478d13f773cfd1479e (diff)
downloadbfs-9749af08293d16f3d5faedea371fdd3699f2adf2.tar.xz
expr: Tell expressions what kind of expression they are
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c
index 5784220..db60e34 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,9 @@
#include "xregex.h"
#include <string.h>
-struct bfs_expr *bfs_expr_new(struct bfs_ctx *ctx, bfs_eval_fn *eval_fn, size_t argc, char **argv) {
+struct bfs_expr *bfs_expr_new(struct bfs_ctx *ctx, bfs_eval_fn *eval_fn, size_t argc, char **argv, enum bfs_kind kind) {
+ bfs_assert(kind != BFS_PATH);
+
struct bfs_expr *expr = arena_alloc(&ctx->expr_arena);
if (!expr) {
return NULL;
@@ -22,6 +24,7 @@ struct bfs_expr *bfs_expr_new(struct bfs_ctx *ctx, bfs_eval_fn *eval_fn, size_t
expr->eval_fn = eval_fn;
expr->argc = argc;
expr->argv = argv;
+ expr->kind = kind;
expr->probability = 0.5;
SLIST_PREPEND(&ctx->expr_list, expr, freelist);