Norming the redirection shit
This commit is contained in:
parent
61cd8f3c0b
commit
51b0ecda20
1 changed files with 18 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
|
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/08/04 11:23:56 by rparodi ### ########.fr */
|
/* Updated: 2024/08/04 11:54:08 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -103,6 +103,20 @@ void ast_set_term(t_ast_node *node, t_ast_terminator_kind term)
|
||||||
(void)(void_storage);
|
(void)(void_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t_ast_vec _append_scripting(\
|
||||||
|
t_ast_node node, t_ast_node redirection)
|
||||||
|
{
|
||||||
|
if (node->kind == AST_WHILE)
|
||||||
|
return (&node->data.while_.suffixes_redirections);
|
||||||
|
if (node->kind == AST_FOR)
|
||||||
|
return (&node->data.for_.suffixes_redirections);
|
||||||
|
if (node->kind == AST_IF)
|
||||||
|
return (&node->data.if_.suffixes_redirections);
|
||||||
|
if (node->kind == AST_UNTIL)
|
||||||
|
return (&node->data.until.suffixes_redirections);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void _append_redirection(t_ast_node node, t_ast_node redirection)
|
void _append_redirection(t_ast_node node, t_ast_node redirection)
|
||||||
{
|
{
|
||||||
t_vec_ast *vec;
|
t_vec_ast *vec;
|
||||||
|
|
@ -117,20 +131,14 @@ void _append_redirection(t_ast_node node, t_ast_node redirection)
|
||||||
vec = &node->data.command.suffixes_redirections;
|
vec = &node->data.command.suffixes_redirections;
|
||||||
if (node->kind == AST_COMPOUND_STATEMENT)
|
if (node->kind == AST_COMPOUND_STATEMENT)
|
||||||
vec = &node->data.compound_statement.suffixes_redirections;
|
vec = &node->data.compound_statement.suffixes_redirections;
|
||||||
if (node->kind == AST_FOR)
|
|
||||||
vec = &node->data.for_.suffixes_redirections;
|
|
||||||
if (node->kind == AST_IF)
|
|
||||||
vec = &node->data.if_.suffixes_redirections;
|
|
||||||
if (node->kind == AST_LIST)
|
if (node->kind == AST_LIST)
|
||||||
vec = &node->data.list.suffixes_redirections;
|
vec = &node->data.list.suffixes_redirections;
|
||||||
if (node->kind == AST_PIPELINE)
|
if (node->kind == AST_PIPELINE)
|
||||||
vec = &node->data.pipeline.suffixes_redirections;
|
vec = &node->data.pipeline.suffixes_redirections;
|
||||||
if (node->kind == AST_SUBSHELL)
|
if (node->kind == AST_SUBSHELL)
|
||||||
vec = &node->data.subshell.suffixes_redirections;
|
vec = &node->data.subshell.suffixes_redirections;
|
||||||
if (node->kind == AST_UNTIL)
|
if (_append_scripting(node, redirection) != NULL)
|
||||||
vec = &node->data.until.suffixes_redirections;
|
vec = _append_scripting(node, redirection);
|
||||||
if (node->kind == AST_WHILE)
|
|
||||||
vec = &node->data.while_.suffixes_redirections;
|
|
||||||
if (vec != NULL)
|
if (vec != NULL)
|
||||||
vec_ast_push(vec, redirection);
|
vec_ast_push(vec, redirection);
|
||||||
else
|
else
|
||||||
|
|
@ -192,7 +200,6 @@ if (symbol == anon_sym_LT_GT)
|
||||||
*/
|
*/
|
||||||
// RAPH
|
// RAPH
|
||||||
|
|
||||||
|
|
||||||
t_error ast_from_node(t_parse_node node, t_const_str input, t_ast_node *out);
|
t_error ast_from_node(t_parse_node node, t_const_str input, t_ast_node *out);
|
||||||
|
|
||||||
/* FUNCTION THAT ARE DONE */
|
/* FUNCTION THAT ARE DONE */
|
||||||
|
|
@ -201,6 +208,7 @@ t_error ast_from_node(t_parse_node node, t_const_str input, t_ast_node *out);
|
||||||
|
|
||||||
// RAPH
|
// RAPH
|
||||||
// PLUS RAPH
|
// PLUS RAPH
|
||||||
|
|
||||||
t_error build_sym_command_substitution(\
|
t_error build_sym_command_substitution(\
|
||||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue