From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- 42sh/src/exec/ast_eval.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 42sh/src/exec/ast_eval.c (limited to '42sh/src/exec/ast_eval.c') diff --git a/42sh/src/exec/ast_eval.c b/42sh/src/exec/ast_eval.c new file mode 100644 index 0000000..db152f8 --- /dev/null +++ b/42sh/src/exec/ast_eval.c @@ -0,0 +1,20 @@ +#include "exec/ast_eval.h" + +#include "exec/ast_exec_functions.h" + +static const exec_f exec_node_ltable[] = { + [AST_LIST] = exec_ast_list, [AST_IF] = exec_ast_if, + [AST_COMMAND] = exec_ast_command, [AST_LOGICAL] = exec_ast_logical, + [AST_PIPELINE] = exec_ast_pipe, [AST_REDIRECTION] = exec_ast_redirection, + [AST_WHILE] = exec_ast_while, [AST_ASSIGN] = exec_ast_assign, + [AST_FOR] = exec_ast_for, [AST_SUBSHELL] = exec_ast_subshell +}; + +int eval_ast(struct ast *ast) +{ + if (!ast) + { + return SHELL_TRUE; + } + return exec_node_ltable[ast->type](ast); +} -- cgit v1.2.3