diff options
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); |