pipes in subsh in pipes error solved
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
# include "exec/exec.h"
|
# include "exec/exec.h"
|
||||||
# include "exec/expander.h"
|
# include "exec/expander.h"
|
||||||
|
|
||||||
# define DEBUG 0
|
# define DEBUG 1
|
||||||
|
|
||||||
# ifndef DIO_PATH
|
# ifndef DIO_PATH
|
||||||
# define DIO_PATH "ast.xml"
|
# define DIO_PATH "ast.xml"
|
||||||
|
|||||||
@@ -31,7 +31,17 @@ static void add_nodell(t_nodell **nodell, t_node *node)
|
|||||||
tmp->next->next = NULL;
|
tmp->next->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static t_node *get_node(t_node **lst, t_node *expected, int limiter)
|
static void update_subsh_l(int *shlvl, t_node *lst)
|
||||||
|
{
|
||||||
|
if (!lst)
|
||||||
|
return;
|
||||||
|
if (!ft_strncmp(")", lst->val, 1))
|
||||||
|
*shlvl = 0;
|
||||||
|
if (!ft_strncmp("(", lst->val, 1))
|
||||||
|
*shlvl = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static t_node *get_node(t_node **lst, t_node *expected, int limiter, int *shlvl)
|
||||||
{
|
{
|
||||||
t_node *node;
|
t_node *node;
|
||||||
|
|
||||||
@@ -41,9 +51,9 @@ static t_node *get_node(t_node **lst, t_node *expected, int limiter)
|
|||||||
add_node_back(&node, (*lst)->val, (*lst)->token, (*lst)->pressision);
|
add_node_back(&node, (*lst)->val, (*lst)->token, (*lst)->pressision);
|
||||||
(*lst) = (*lst)->next;
|
(*lst) = (*lst)->next;
|
||||||
}
|
}
|
||||||
while (limiter == -1 && (*lst) && ft_strncmp((*lst)->val, expected->val,
|
while (limiter == -1 && (*lst) && ( *shlvl == 1 || ft_strncmp((*lst)->val, expected->val, ft_strlen((*lst)->val))))
|
||||||
ft_strlen((*lst)->val)))
|
|
||||||
{
|
{
|
||||||
|
update_subsh_l(shlvl, *lst);
|
||||||
add_node_back(&node, (*lst)->val, (*lst)->token, (*lst)->pressision);
|
add_node_back(&node, (*lst)->val, (*lst)->token, (*lst)->pressision);
|
||||||
(*lst) = (*lst)->next;
|
(*lst) = (*lst)->next;
|
||||||
}
|
}
|
||||||
@@ -56,20 +66,24 @@ t_nodell *cutll(t_node *lst, t_node *expected, size_t limiter)
|
|||||||
t_node *node;
|
t_node *node;
|
||||||
size_t i;
|
size_t i;
|
||||||
t_nodell *tmp;
|
t_nodell *tmp;
|
||||||
|
int shlvl;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
out = NULL;
|
out = NULL;
|
||||||
|
shlvl = 0;
|
||||||
while (i <= limiter)
|
while (i <= limiter)
|
||||||
{
|
{
|
||||||
node = get_node(&lst, expected, limiter);
|
update_subsh_l(&shlvl, lst);
|
||||||
|
node = get_node(&lst, expected, limiter, &shlvl);
|
||||||
if (!node)
|
if (!node)
|
||||||
break ;
|
break ;
|
||||||
add_nodell(&out, node);
|
add_nodell(&out, node);
|
||||||
tmp = out;
|
tmp = out;
|
||||||
while (tmp)
|
while (tmp)
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
if (lst && lst->next)
|
if (!lst)
|
||||||
lst = lst->next;
|
break;
|
||||||
|
lst = lst->next;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (out);
|
return (out);
|
||||||
|
|||||||
Reference in New Issue
Block a user