42-archive/42sh/src/parser/tree_wrapper.c
ariard@student.42.fr f5fafb4c19 before pull
2017-03-01 16:25:53 +01:00

38 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tree_wrapper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
/* Updated: 2017/03/01 15:59:32 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "parser.h"
int join_ast(t_btree **ast, t_btree **new_node)
{
(*new_node)->left = *ast;
*ast = *new_node;
return (0);
}
int gen_node(t_btree **ast)
{
t_astnode item;
if (!*ast)
{
*ast = btree_create_node(&item, sizeof(item));
((t_astnode *)(*ast)->item)->data.cmd = NULL;
((t_astnode *)(*ast)->item)->nest = 0;
((t_astnode *)(*ast)->item)->full = 0;
((t_astnode *)(*ast)->item)->type = 0;
((t_astnode *)(*ast)->item)->pattern = 0;
}
return (0);
}