skip parentesis fix
This commit is contained in:
4
Makefile
4
Makefile
@@ -29,10 +29,10 @@ $(LIBFT): $(LIBFT_SRCS)
|
|||||||
|
|
||||||
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@$(CC) $(WFLAGS) -MMD -MP -I$(INCDIR) -D DIO_PATH="\"$(HOME)/ast.xml\"" -c $< -o $@ $(LINK)
|
@$(CC) $(WFLAGS) -gdwarf-4 -MMD -MP -I$(INCDIR) -D DIO_PATH="\"$(HOME)/ast.xml\"" -c $< -o $@ $(LINK)
|
||||||
|
|
||||||
$(NAME): $(LIBFT) $(OBJS)
|
$(NAME): $(LIBFT) $(OBJS)
|
||||||
@$(CC) $(WFLAGS) $(OBJS) $(LIBFT) -D DIO_PATH="\"$(HOME)/ast.xml\"" -o $(NAME) $(LINK)
|
@$(CC) $(WFLAGS) -gdwarf-4 $(OBJS) $(LIBFT) -D DIO_PATH="\"$(HOME)/ast.xml\"" -o $(NAME) $(LINK)
|
||||||
@echo "$(CYAN)Build completed: $(NAME)$(RESET)"
|
@echo "$(CYAN)Build completed: $(NAME)$(RESET)"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ t_node *remove_parentheses(t_node *lst)
|
|||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
out = NULL;
|
out = NULL;
|
||||||
|
str = NULL;
|
||||||
it = lst;
|
it = lst;
|
||||||
it = it->next;
|
it = it->next;
|
||||||
deepness = 1;
|
deepness = 1;
|
||||||
@@ -36,7 +37,7 @@ t_node *remove_parentheses(t_node *lst)
|
|||||||
free(str);
|
free(str);
|
||||||
it = it->next;
|
it = it->next;
|
||||||
}
|
}
|
||||||
free(str);
|
// ft_free(&str);
|
||||||
return (out);
|
return (out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/01/31 17:14:26 by nalebrun #+# #+# */
|
/* Created: 2025/01/31 17:14:26 by nalebrun #+# #+# */
|
||||||
/* Updated: 2025/02/07 17:56:02 by nalebrun ### ########.fr */
|
/* Updated: 2025/02/14 10:59:00 by nalebrun ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -28,12 +28,11 @@ static int last_tok_redir(t_node *lst)
|
|||||||
{
|
{
|
||||||
while (lst)
|
while (lst)
|
||||||
{
|
{
|
||||||
if ((lst->next == NULL
|
if ((lst->next == NULL || lst->next->pressision == D_RED_R
|
||||||
|| lst->next->pressision == D_RED_R
|
|
||||||
|| lst->next->pressision == RED_R
|
|| lst->next->pressision == RED_R
|
||||||
|| lst->next->pressision == RED_L
|
|| lst->next->pressision == RED_L
|
||||||
|| lst->next->pressision == HEREDOC)
|
|| lst->next->pressision == HEREDOC) && !ft_strncmp(lst->val,
|
||||||
&& !ft_strncmp(lst->val, ")", 1))
|
")", 1))
|
||||||
return (1);
|
return (1);
|
||||||
lst = lst->next;
|
lst = lst->next;
|
||||||
}
|
}
|
||||||
@@ -44,12 +43,16 @@ static void skip_parentheses(t_node **lst)
|
|||||||
{
|
{
|
||||||
if (!ft_strncmp((*lst)->val, "(", 1))
|
if (!ft_strncmp((*lst)->val, "(", 1))
|
||||||
{
|
{
|
||||||
while ((*lst)->next && ft_strncmp((*lst)->next->val, ")", 1))
|
(*lst) = (*lst)->next;
|
||||||
|
while (*lst && ft_strncmp((*lst)->val, ")", 1))
|
||||||
{
|
{
|
||||||
if (!ft_strncmp((*lst)->val, "(", 1))
|
if (!ft_strncmp((*lst)->val, "(", 1))
|
||||||
skip_parentheses(&(*lst)->next);
|
skip_parentheses(lst);
|
||||||
*lst = (*lst)->next;
|
else
|
||||||
|
(*lst) = (*lst)->next;
|
||||||
}
|
}
|
||||||
|
if (*lst)
|
||||||
|
(*lst) = (*lst)->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,9 +61,10 @@ static t_node *find_token(char *tok, t_node *lst)
|
|||||||
while (lst)
|
while (lst)
|
||||||
{
|
{
|
||||||
skip_parentheses(&lst);
|
skip_parentheses(&lst);
|
||||||
if (!ft_strncmp(lst->val, tok, ft_strlen(tok)))
|
if (lst && !ft_strncmp(lst->val, tok, ft_strlen(tok)))
|
||||||
return (lst);
|
return (lst);
|
||||||
lst = lst->next;
|
if (lst)
|
||||||
|
lst = lst->next;
|
||||||
}
|
}
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user