summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-08-23 22:18:16 +0200
committertomsmeding <tom.smeding@gmail.com>2016-08-23 22:18:16 +0200
commitba57b2de9e84af94c68a94a5d0be08d5e25ab921 (patch)
tree40b8d3278d08214f1eba3a74eb2eebe033fb906d /ast.c
parentcac651cd88f8da1e5957b0cc13fa25d79e1887fc (diff)
Add builtin_define
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index c2ea654..7456ee3 100644
--- a/ast.c
+++ b/ast.c
@@ -24,6 +24,9 @@ void ast_free(AST *ast){
if(ast->la.body)ast_free(ast->la.body);
break;
+ case AST_LAMBDAARG:
+ break;
+
case AST_WORD:
assert(ast->wo.word);
free(ast->wo.word);
@@ -64,6 +67,9 @@ AST* ast_copy(const AST *ast){
case AST_LAMBDA:
return ast_lambda(ast->la.cfunc,ast->la.body?ast_copy(ast->la.body):NULL);
+ case AST_LAMBDAARG:
+ return ast_lambdaarg(ast->ar.idx);
+
case AST_WORD:
assert(ast->wo.word);
return ast_word(copystring(ast->wo.word));
@@ -217,6 +223,14 @@ AST* ast_lambda(lambdafunc_t cfunc,AST *body){
return ast;
}
+AST* ast_lambdaarg(int idx){
+ assert(idx>=0);
+ AST *ast=malloc(1,AST);
+ ast->type=AST_LAMBDAARG;
+ ast->ar.idx=idx;
+ return ast;
+}
+
AST* ast_word(char *word){
assert(word);
AST *ast=malloc(1,AST);