From ffc7a2d0fc6b9139ca3ee77bf3afdb05eb28afff Mon Sep 17 00:00:00 2001 From: Maix0 Date: Thu, 30 May 2024 12:36:59 +0200 Subject: [PATCH] update --- ast/src/from_node.c | 22 +++++++++++++++++++++- sources/main.c | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ast/src/from_node.c b/ast/src/from_node.c index daa02df8..f9a846cf 100644 --- a/ast/src/from_node.c +++ b/ast/src/from_node.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/28 13:18:44 by maiboyer #+# #+# */ -/* Updated: 2024/05/29 13:41:57 by maiboyer ### ########.fr */ +/* Updated: 2024/05/29 22:48:00 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -184,6 +184,26 @@ t_not *build_not(t_node *node, t_usize size) return (ptr); } +t_command *build_command(t_node *node, t_usize size) +{ + t_command *ptr; + + (void)(size); + if (node == NULL || size == 0 || + (node->kind != sym_redirected_statement && node->kind != sym_command && + node->kind != sym_test_command && + node->kind != sym_declaration_command && + node->kind != sym_unset_command)) + me_abort("Invalid arguments to build ast!"); + ptr = (void *)alloc_node(TY_COMMAND); + if (node->kind == sym_redirected_statement) + ptr->inner.simple_command = NULL; + + return (ptr); +} +/* + */ + t_ast_node *from_node(t_node *node) { if (node == NULL) diff --git a/sources/main.c b/sources/main.c index 798977e6..88435d21 100644 --- a/sources/main.c +++ b/sources/main.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */ -/* Updated: 2024/05/29 16:40:26 by maiboyer ### ########.fr */ +/* Updated: 2024/05/29 22:30:42 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -220,5 +220,5 @@ t_i32 main(t_i32 argc, t_str argv[], t_str envp[]) "\001\x1B[0m\002" "$ "; ft_take_args(&utils); - // (void)from_node(NULL); + (void)from_node(NULL); }