diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 22:18:16 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-08-23 22:18:16 +0200 |
commit | ba57b2de9e84af94c68a94a5d0be08d5e25ab921 (patch) | |
tree | 40b8d3278d08214f1eba3a74eb2eebe033fb906d /ast.c | |
parent | cac651cd88f8da1e5957b0cc13fa25d79e1887fc (diff) |
Add builtin_define
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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); |