From e6ef9f494b7759db086664f7d5605e5eb304f549 Mon Sep 17 00:00:00 2001 From: gazhonsepaskwa Date: Wed, 12 Feb 2025 15:47:26 +0100 Subject: [PATCH] sush fix --- includes/minishell.h | 2 +- srcs/parsing/ast/top_token.c | 9 +++++++-- srcs/parsing/syntax.c | 11 +++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/includes/minishell.h b/includes/minishell.h index 734f033..ea1701e 100644 --- a/includes/minishell.h +++ b/includes/minishell.h @@ -33,7 +33,7 @@ # include "exec/exec.h" # include "exec/expander.h" -# define DEBUG 1 +# define DEBUG 0 # ifndef DIO_PATH # define DIO_PATH "ast.xml" diff --git a/srcs/parsing/ast/top_token.c b/srcs/parsing/ast/top_token.c index 15bbd66..58f5256 100644 --- a/srcs/parsing/ast/top_token.c +++ b/srcs/parsing/ast/top_token.c @@ -11,6 +11,7 @@ /* ************************************************************************** */ #include "../../../includes/minishell.h" +#include static int last_tok_subsh(t_node *lst) { @@ -27,8 +28,12 @@ static int last_tok_redir(t_node *lst) { while (lst) { - if ((lst->next == NULL || lst->next->pressision == D_RED_R - || lst->next->pressision == RED_R) && !ft_strncmp(lst->val, ")", + if ((lst->next == NULL + || lst->next->pressision == D_RED_R + || lst->next->pressision == RED_R + || lst->next->pressision == RED_L + || lst->next->pressision == HEREDOC + )&& !ft_strncmp(lst->val, ")", 1)) return (1); lst = lst->next; diff --git a/srcs/parsing/syntax.c b/srcs/parsing/syntax.c index e6ca0c0..ba80fee 100644 --- a/srcs/parsing/syntax.c +++ b/srcs/parsing/syntax.c @@ -11,6 +11,7 @@ /* ************************************************************************** */ #include "../../includes/minishell.h" +#include int syntax_err_mess(char *token_base, int selected) { @@ -87,6 +88,16 @@ int unclosed(t_node *head) return (0); } +int is_redir(t_node *cpy) +{ + if (cpy->pressision == RED_L + || cpy->pressision == RED_R + || cpy->pressision == HEREDOC + || cpy->pressision == D_RED_R) + return (1); + return (0); +} + int syntax_error(t_node *head) { t_node *cpy;