before pull
This commit is contained in:
parent
871b4da000
commit
f5fafb4c19
15 changed files with 71 additions and 64 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
||||||
# Updated: 2017/02/25 00:13:39 by ariard ### ########.fr #
|
# Updated: 2017/03/01 15:37:46 by ariard ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -234,6 +234,7 @@ parser/add_loop.c\
|
||||||
parser/add_sep.c\
|
parser/add_sep.c\
|
||||||
parser/add_case.c\
|
parser/add_case.c\
|
||||||
parser/add_func.c\
|
parser/add_func.c\
|
||||||
|
parser/add_redir.c\
|
||||||
parser/aggregate_sym.c\
|
parser/aggregate_sym.c\
|
||||||
parser/build_tree.c\
|
parser/build_tree.c\
|
||||||
parser/error_syntax.c\
|
parser/error_syntax.c\
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */
|
/* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/03/01 16:24:58 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,9 +22,9 @@
|
||||||
|
|
||||||
enum e_parstate
|
enum e_parstate
|
||||||
{
|
{
|
||||||
ERROR = 0,
|
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
|
ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
# define TK_REDIR(x) (TK_LESS <= x && x <= TK_GREATAND)
|
# define TK_REDIR(x) (TK_LESS <= x && x <= TK_GREATAND)
|
||||||
|
|
@ -83,7 +84,6 @@ int push_stack(t_sym *stack, t_sym new_sym);
|
||||||
int pop_stack(t_sym **stack, t_sym erase_sym);
|
int pop_stack(t_sym **stack, t_sym erase_sym);
|
||||||
|
|
||||||
int error_syntax(t_list **token);
|
int error_syntax(t_list **token);
|
||||||
int error_EOF(void);
|
|
||||||
|
|
||||||
int ft_read_stack(t_sym *stack);
|
int ft_read_stack(t_sym *stack);
|
||||||
char *read_state(t_sym current);
|
char *read_state(t_sym current);
|
||||||
|
|
@ -107,26 +107,18 @@ int build_tree(t_btree **ast, t_list **lst);
|
||||||
int add_sep(t_btree **ast, t_list **lst);
|
int add_sep(t_btree **ast, t_list **lst);
|
||||||
int add_cmd(t_btree **ast, t_list **lst);
|
int add_cmd(t_btree **ast, t_list **lst);
|
||||||
int add_file(t_btree **ast, t_list **lst);
|
int add_file(t_btree **ast, t_list **lst);
|
||||||
int add_redir(t_btree **ast, t_list **lst);
|
|
||||||
int add_loop_cmd(t_btree **ast, t_list **lst);
|
int add_loop_cmd(t_btree **ast, t_list **lst);
|
||||||
int add_loop_sep(t_btree **ast, t_list **lst);
|
int add_loop_sep(t_btree **ast, t_list **lst);
|
||||||
int add_loop_condition(t_btree **ast, t_list **lst);
|
|
||||||
int add_condition_cmd(t_btree **ast, t_list **lst);
|
int add_condition_cmd(t_btree **ast, t_list **lst);
|
||||||
int add_condition_sep(t_btree **ast, t_list **lst);
|
int add_condition_sep(t_btree **ast, t_list **lst);
|
||||||
int add_branch(t_btree **ast, t_list **lst);
|
int add_branch(t_btree **ast, t_list **lst);
|
||||||
int add_case_cmd(t_btree **ast, t_list **lst);
|
int add_redir_word(t_btree **ast, t_list **lst)
|
||||||
int add_case_sep(t_btree **ast, t_list **lst);
|
int add_redir_type(t_btree **ast, t_list **lst)
|
||||||
int add_pattern(t_btree **ast, t_list **lst);
|
int isloop(t_btree **ast);
|
||||||
int add_subshell_cmd(t_btree **ast, t_list **lst);
|
int isdir(t_btree **ast);
|
||||||
int add_subshell_sep(t_btree **ast, t_list **lst);
|
int iscondition(t_btree **ast, t_list **list);
|
||||||
int add_func_cmd(t_btree **ast, t_list **lst);
|
int isdir_sep(t_list **list);
|
||||||
int add_func_sep(t_btree **ast, t_list **lst);
|
int isdir_word(t_btree **ast, t_list **list);
|
||||||
int isloop(t_btree **ast, t_list **lst);
|
|
||||||
int isdir(t_btree **ast, t_list **lst);
|
|
||||||
int iscase(t_btree **ast, t_list **lst);
|
|
||||||
int iscondition(t_btree **ast, t_list **lst);
|
|
||||||
int issubshell(t_btree **ast, t_list **lst);
|
|
||||||
int isfunc(t_btree **ast, t_list **lst);
|
|
||||||
|
|
||||||
int join_ast(t_btree **ast, t_btree **new_node);
|
int join_ast(t_btree **ast, t_btree **new_node);
|
||||||
int gen_node(t_btree **ast);
|
int gen_node(t_btree **ast);
|
||||||
|
|
@ -150,10 +142,15 @@ struct s_redir
|
||||||
int close;
|
int close;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct s_cmd
|
||||||
|
{
|
||||||
|
t_list * redir;
|
||||||
|
t_ld *token;
|
||||||
|
}
|
||||||
|
|
||||||
union u_astdata
|
union u_astdata
|
||||||
{
|
{
|
||||||
t_redir redir;
|
t_cmd *cmd;
|
||||||
t_ld *token;
|
|
||||||
t_list *wordlist;
|
t_list *wordlist;
|
||||||
char **sstr;
|
char **sstr;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
@ -164,7 +161,6 @@ struct s_astnode
|
||||||
|
|
||||||
int nest;
|
int nest;
|
||||||
int full;
|
int full;
|
||||||
int pattern;
|
|
||||||
t_type type;
|
t_type type;
|
||||||
t_astdata data;
|
t_astdata data;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/25 19:37:31 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:19:09 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,6 +30,7 @@ typedef struct s_token t_token;
|
||||||
typedef struct s_ld t_ld;
|
typedef struct s_ld t_ld;
|
||||||
typedef struct s_astnode t_astnode;
|
typedef struct s_astnode t_astnode;
|
||||||
typedef struct s_redir t_redir;
|
typedef struct s_redir t_redir;
|
||||||
|
typedef struct s_cmd t_cmd;
|
||||||
typedef union u_astdata t_astdata;
|
typedef union u_astdata t_astdata;
|
||||||
typedef union u_word t_word;
|
typedef union u_word t_word;
|
||||||
typedef long long t_type;
|
typedef long long t_type;
|
||||||
|
|
@ -156,6 +157,7 @@ enum e_sym
|
||||||
PATTERN_CASE,
|
PATTERN_CASE,
|
||||||
FUNC_NAME,
|
FUNC_NAME,
|
||||||
CLOSE_LIST,
|
CLOSE_LIST,
|
||||||
|
REDIR,
|
||||||
ALL = 200,
|
ALL = 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */
|
/* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/25 20:10:39 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 14:06:03 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,6 @@ int lexer_word(t_list **alst, t_lexer *lexer)
|
||||||
|
|
||||||
token = (*alst)->content;
|
token = (*alst)->content;
|
||||||
token->type = TK_WORD;
|
token->type = TK_WORD;
|
||||||
DG("lexer word");
|
|
||||||
if ((state = get_state_global(lexer)))
|
if ((state = get_state_global(lexer)))
|
||||||
{
|
{
|
||||||
lexer->state = state;
|
lexer->state = state;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/24 21:48:47 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:25:30 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 18:18:04 by jhalford #+# #+# */
|
/* Created: 2016/11/14 18:18:04 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/25 00:17:44 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 15:56:54 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,6 +17,8 @@ char *ft_putast(void *nodein)
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
node = nodein;
|
node = nodein;
|
||||||
|
|
||||||
|
if (node->type == REDIR)
|
||||||
|
return ("REDIR");
|
||||||
if (node->type == CLOSE_LIST)
|
if (node->type == CLOSE_LIST)
|
||||||
return ("CLOSE_LIST");
|
return ("CLOSE_LIST");
|
||||||
if (node->type == FNAME)
|
if (node->type == FNAME)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/25 20:34:27 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 15:55:23 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/15 20:49:15 by ariard #+# #+# */
|
/* Created: 2017/02/15 20:49:15 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 18:50:30 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:25:27 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,13 +18,12 @@ int add_cmd(t_btree **ast, t_list **lst)
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
char **my_tab;
|
char **my_tab;
|
||||||
|
|
||||||
DG("add cmd");
|
|
||||||
if ((token = (*lst)->content)->type == TK_IN || token->type == TK_PAREN_OPEN)
|
if ((token = (*lst)->content)->type == TK_IN || token->type == TK_PAREN_OPEN)
|
||||||
return (0);
|
return (0);
|
||||||
else if (!*ast)
|
else if (!*ast)
|
||||||
gen_node(ast);
|
gen_node(ast);
|
||||||
else if (isdir(ast, lst))
|
else if (isdir(ast, lst))
|
||||||
return (add_file(ast, lst));
|
return (add_redir_word(ast, lst));
|
||||||
else if (isloop(ast, lst) == 3)
|
else if (isloop(ast, lst) == 3)
|
||||||
return (add_loop_condition(ast, lst));
|
return (add_loop_condition(ast, lst));
|
||||||
else if (isloop(ast, lst))
|
else if (isloop(ast, lst))
|
||||||
|
|
@ -44,16 +43,17 @@ int add_cmd(t_btree **ast, t_list **lst)
|
||||||
else if (isfunc(ast, lst))
|
else if (isfunc(ast, lst))
|
||||||
return (add_func_cmd(ast, lst));
|
return (add_func_cmd(ast, lst));
|
||||||
else if ((node = (*ast)->item)->type != TK_DO && node->type != TK_THEN
|
else if ((node = (*ast)->item)->type != TK_DO && node->type != TK_THEN
|
||||||
&& node->type != TK_PAREN_CLOSE)
|
&& node->type != TK_PAREN_CLOSE && node->type != TK_WORD)
|
||||||
return (add_cmd(&(*ast)->right, lst));
|
return (add_cmd(&(*ast)->right, lst));
|
||||||
my_tab = NULL;
|
my_tab = NULL;
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
node->type = token->type;
|
node->type = token->type;
|
||||||
if (token->type == TK_WORD)
|
if (token->type == TK_WORD)
|
||||||
{
|
{
|
||||||
|
DG("add data");
|
||||||
my_tab = ft_sstradd(my_tab, token->data);
|
my_tab = ft_sstradd(my_tab, token->data);
|
||||||
my_tab = ft_sstradd(my_tab, (char *)token->esc);
|
my_tab = ft_sstradd(my_tab, (char *)token->esc);
|
||||||
ft_ld_pushback(&node->data.token, my_tab);
|
ft_ld_pushback(&node->data.cmd.token, my_tab);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/19 18:12:52 by ariard #+# #+# */
|
/* Created: 2017/02/19 18:12:52 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 00:11:09 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 15:59:58 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,25 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/17 16:39:05 by ariard #+# #+# */
|
/* Created: 2017/02/17 16:39:05 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 20:33:12 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:25:15 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
int isdir(t_btree **ast, t_list **list)
|
int isdir_sep(t_list **list)
|
||||||
|
{
|
||||||
|
t_token *token;
|
||||||
|
|
||||||
|
token = (*list)->content;
|
||||||
|
if (token->type == TK_LESS || token->type == TK_GREAT ||
|
||||||
|
|| token->type == TK_GREATAND || token->type == TK_LESSAND
|
||||||
|
|| token->type == TK_DLESS || TK_DGREAT)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isdir_word(t_btree **ast, t_list **list)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
@ -20,25 +32,14 @@ int isdir(t_btree **ast, t_list **list)
|
||||||
token = (*list)->content;
|
token = (*list)->content;
|
||||||
if (*ast)
|
if (*ast)
|
||||||
{
|
{
|
||||||
DG("isdir");
|
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
if ((node->type == TK_LESS || node->type == TK_GREAT
|
if (token->type == TK_WORD && node->type == REDIR)
|
||||||
|| node->type == TK_LESSAND || node->type == TK_GREATAND
|
|
||||||
|| node->type == TK_DGREAT)
|
|
||||||
&& token->type == TK_WORD)
|
|
||||||
return (1);
|
return (1);
|
||||||
if ((node->type == TK_LESS || node->type == TK_GREAT
|
|
||||||
|| node->type == TK_LESSAND || node->type == TK_GREATAND
|
|
||||||
|| node->type == TK_DGREAT)
|
|
||||||
&& (token->type == TK_LESS || token->type == TK_GREAT
|
|
||||||
|| token->type == TK_LESSAND || token->type == TK_GREATAND
|
|
||||||
|| token->type == TK_DGREAT))
|
|
||||||
return (2);
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_file(t_btree **ast, t_list **lst)
|
int add_redir_word(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
@ -46,16 +47,21 @@ int add_file(t_btree **ast, t_list **lst)
|
||||||
|
|
||||||
token = (*lst)->content;
|
token = (*lst)->content;
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
if (node->data.wordlist)
|
if (node->data.cmd.redir)
|
||||||
{
|
{
|
||||||
DG("add file");
|
DG("add file");
|
||||||
redir = (ft_lstlast(node->data.wordlist))->content;
|
redir = (ft_lstlast(node->data.cmd.redir))->content;
|
||||||
|
if (redir->type == TK_DLESS)
|
||||||
|
redir->word.word = NULL;
|
||||||
|
else if (ft_stris((char *)token->data, &isdigit))
|
||||||
|
redir->word.fd = ft_atoi(token->data);
|
||||||
|
else
|
||||||
redir->word.word = token->data;
|
redir->word.word = token->data;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_redir(t_btree **ast, t_list **lst)
|
int add_redir_type(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
@ -66,8 +72,9 @@ int add_redir(t_btree **ast, t_list **lst)
|
||||||
gen_node(ast);
|
gen_node(ast);
|
||||||
token = (*lst)->content;
|
token = (*lst)->content;
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
|
node->type = REDIR;
|
||||||
redir = ft_memalloc(sizeof(redir));
|
redir = ft_memalloc(sizeof(redir));
|
||||||
redir->type = token->type;
|
redir->type = token->type;
|
||||||
ft_lsteadd(&node->data.wordlist, ft_lstnew(redir, sizeof(redir)));
|
ft_lsteadd(&node->data.cmd.redir, ft_lstnew(redir, sizeof(redir)));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/15 19:12:07 by ariard #+# #+# */
|
/* Created: 2017/02/15 19:12:07 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 20:39:38 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:25:35 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 17:39:18 by ariard #+# #+# */
|
/* Created: 2017/02/09 17:39:18 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 13:53:57 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 14:45:19 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -92,8 +92,6 @@ t_aggrematch g_aggrematch[] =
|
||||||
{NEWLINE_LIST, FOR_WORDLIST, SEQUENTIAL_SEP, 0},
|
{NEWLINE_LIST, FOR_WORDLIST, SEQUENTIAL_SEP, 0},
|
||||||
|
|
||||||
//to check
|
//to check
|
||||||
{IO_HERE, TK_IO_NUMBER, IO_REDIRECT, TK_IO_NUMBER},
|
|
||||||
{IO_HERE, ALL, IO_REDIRECT, 0},
|
|
||||||
{FILENAME, TK_LESS, IO_FILE, TK_LESS},
|
{FILENAME, TK_LESS, IO_FILE, TK_LESS},
|
||||||
{FILENAME, TK_LESSAND, IO_FILE, TK_LESSAND},
|
{FILENAME, TK_LESSAND, IO_FILE, TK_LESSAND},
|
||||||
{FILENAME, TK_GREAT, IO_FILE, TK_GREAT},
|
{FILENAME, TK_GREAT, IO_FILE, TK_GREAT},
|
||||||
|
|
@ -102,9 +100,12 @@ t_aggrematch g_aggrematch[] =
|
||||||
{FILENAME, TK_LESSGREAT, IO_FILE, TK_LESSGREAT},
|
{FILENAME, TK_LESSGREAT, IO_FILE, TK_LESSGREAT},
|
||||||
{FILENAME, TK_CLOBBER, IO_FILE, TK_CLOBBER},
|
{FILENAME, TK_CLOBBER, IO_FILE, TK_CLOBBER},
|
||||||
|
|
||||||
|
{HERE_END, TK_DLESS, IO_HERE, TK_DLESS},
|
||||||
//to check
|
//to check
|
||||||
{IO_FILE, TK_IO_NUMBER, IO_REDIRECT, TK_IO_NUMBER},
|
{IO_FILE, TK_IO_NUMBER, IO_REDIRECT, TK_IO_NUMBER},
|
||||||
{IO_FILE, ALL, IO_REDIRECT, 0},
|
{IO_FILE, ALL, IO_REDIRECT, 0},
|
||||||
|
{IO_HERE, TK_IO_NUMBER, IO_REDIRECT, TK_IO_NUMBER},
|
||||||
|
{IO_HERE, ALL, IO_REDIRECT, 0},
|
||||||
{IO_REDIRECT, CMD_SUPERIOR, CMD_SUPERIOR, CMD_SUPERIOR},
|
{IO_REDIRECT, CMD_SUPERIOR, CMD_SUPERIOR, CMD_SUPERIOR},
|
||||||
{IO_REDIRECT, COMPOUND_COMMAND, REDIRECT_LIST, REDIRECT_LIST},
|
{IO_REDIRECT, COMPOUND_COMMAND, REDIRECT_LIST, REDIRECT_LIST},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 17:58:34 by ariard #+# #+# */
|
/* Created: 2017/02/09 17:58:34 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 13:54:08 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 14:40:24 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 00:15:00 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 16:25:33 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
|
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
|
||||||
/* Updated: 2017/02/25 19:10:34 by ariard ### ########.fr */
|
/* Updated: 2017/03/01 15:59:32 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -26,8 +26,7 @@ int gen_node(t_btree **ast)
|
||||||
if (!*ast)
|
if (!*ast)
|
||||||
{
|
{
|
||||||
*ast = btree_create_node(&item, sizeof(item));
|
*ast = btree_create_node(&item, sizeof(item));
|
||||||
((t_astnode *)(*ast)->item)->data.token = NULL;
|
((t_astnode *)(*ast)->item)->data.cmd = NULL;
|
||||||
((t_astnode *)(*ast)->item)->data.redir.word.word = NULL;
|
|
||||||
((t_astnode *)(*ast)->item)->nest = 0;
|
((t_astnode *)(*ast)->item)->nest = 0;
|
||||||
((t_astnode *)(*ast)->item)->full = 0;
|
((t_astnode *)(*ast)->item)->full = 0;
|
||||||
((t_astnode *)(*ast)->item)->type = 0;
|
((t_astnode *)(*ast)->item)->type = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue