summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/c/pgf/expr.c')
-rw-r--r--src/runtime/c/pgf/expr.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/expr.c b/src/runtime/c/pgf/expr.c
index 551d2fb09..0192ba816 100644
--- a/src/runtime/c/pgf/expr.c
+++ b/src/runtime/c/pgf/expr.c
@@ -73,6 +73,29 @@ pgf_expr_unapply(PgfExpr expr, GuPool* pool)
return appl;
}
+PgfExpr
+pgf_expr_apply(PgfApplication* app, GuPool* pool)
+{
+ PgfExpr expr;
+
+ size_t len = strlen(app->fun);
+ PgfExprFun *efun =
+ gu_new_flex_variant(PGF_EXPR_FUN,
+ PgfExprFun,
+ fun, len+1,
+ &expr, pool);
+ strcpy(efun->fun, app->fun);
+
+ for (int i = 0; i < app->n_args; i++) {
+ expr = gu_new_variant_i(pool,
+ PGF_EXPR_APP, PgfExprApp,
+ .fun = expr,
+ .arg = app->args[i]);
+ }
+
+ return expr;
+}
+
typedef struct PgfExprParser PgfExprParser;
typedef enum {