This commit is contained in:
Antoine Riard 2017-03-24 19:44:04 +01:00
parent 9f1fe08fe3
commit 5d07da9fb3
5 changed files with 14 additions and 10 deletions

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 11:12:05 by ariard #+# #+# */
/* Updated: 2017/03/24 15:40:00 by ariard ### ########.fr */
/* Updated: 2017/03/24 19:43:40 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,5 +29,6 @@ int exec_var(t_btree **ast)
value = equal ? equal + 1 : NULL;
builtin_setenv("internal", (char*[]){"local", var, value, 0}, NULL);
ft_sstrfree(av);
ft_exec(&(*ast)->right);
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 20:49:15 by ariard #+# #+# */
/* Updated: 2017/03/24 16:56:50 by ariard ### ########.fr */
/* Updated: 2017/03/24 19:25:02 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -59,7 +59,7 @@ static int emblematic_token(t_btree **ast, t_list **lst)
return (0);
if (node->type != TK_DO && node->type != TK_THEN
&& node->type != CMD && node->type != REDIR
&& node->type != TK_ASSIGNMENT_WORD && node->type != TK_FOR)
&& node->type != TK_FOR)
return (1);
}
return (0);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
/* Updated: 2017/03/24 19:09:05 by ariard ### ########.fr */
/* Updated: 2017/03/24 19:26:26 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -380,18 +380,15 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
return (1);
i = -1;
head = (*stack)->content;
DG("aggregate head %s && sym %s", read_state(*head), read_state(*new_sym));
while (g_aggrematch[++i].top)
if (*new_sym == g_aggrematch[i].top
&& MATCH_STACK(*head, g_aggrematch[i].under))
{
DG("MATH: %s", read_state(g_aggrematch[i].new_sym));
*new_sym = g_aggrematch[i].new_sym;
if (g_aggrematch[i].erase_sym)
{
pop_stack(stack, g_aggrematch[i].erase_sym);
head = (*stack)->content;
DG("stack after pop %s", read_state(*head));
}
if (eval_sym(stack, *new_sym) && !(*state = ERROR))
return (1);
@ -400,3 +397,7 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
}
return (0);
}
// DG("aggregate head %s && sym %s", read_state(*head), read_state(*new_sym));
// DG("MATH: %s", read_state(g_aggrematch[i].new_sym));
// DG("stack after pop %s", read_state(*head));

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
/* Updated: 2017/03/24 19:11:10 by ariard ### ########.fr */
/* Updated: 2017/03/24 19:25:44 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -1288,7 +1288,6 @@ int eval_sym(t_list **stack, t_sym new_sym)
return (1);
head = (*stack)->content;
i = 0;
DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
while (g_stackmatch[i].top)
{
if (new_sym == g_stackmatch[i].top && *head == g_stackmatch[i].under)
@ -1297,3 +1296,5 @@ int eval_sym(t_list **stack, t_sym new_sym)
}
return (1);
}
//DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
/* Updated: 2017/03/24 17:01:05 by ariard ### ########.fr */
/* Updated: 2017/03/24 19:26:48 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -49,6 +49,7 @@ int ft_parse(t_btree **ast, t_list **token, t_parser *parser)
parser->state = SUCCESS;
else
parser->state = UNDEFINED;
btree_print(STDBUG, *ast, &ft_putast);
build_tree(ast, token);
if ((end_instruction(&parser->stack) && !(*token)->next))
insert_linebreak(token);