merge
This commit is contained in:
commit
ccb82193a8
11 changed files with 77 additions and 34 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/17 17:23:34 by gwojda ### ########.fr */
|
/* Updated: 2017/03/22 18:19:43 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -185,5 +185,6 @@ char *path_solver(t_comp *c, char *cmd, char *cwd);
|
||||||
int c_exclusion_folder(t_comp *c);
|
int c_exclusion_folder(t_comp *c);
|
||||||
int ft_sstrlen(char **s);
|
int ft_sstrlen(char **s);
|
||||||
char *ft_sstrtostr(char **s, char *sep);
|
char *ft_sstrtostr(char **s, char *sep);
|
||||||
|
char *ft_add_escape(char *str, char to_escape);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -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/03/22 19:17:46 by jhalford ### ########.fr */
|
/* Updated: 2017/03/22 19:36:55 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -196,8 +196,6 @@ enum e_sym
|
||||||
OPEN_FUNC,
|
OPEN_FUNC,
|
||||||
CLOSE_FUNC,
|
CLOSE_FUNC,
|
||||||
CLOSE_LIST,
|
CLOSE_LIST,
|
||||||
SEMI_SUBSHELL,
|
|
||||||
SEMI_BRACE,
|
|
||||||
REDIR,
|
REDIR,
|
||||||
CMD,
|
CMD,
|
||||||
HEREDOCDATA,
|
HEREDOCDATA,
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,61 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/16 22:17:10 by alao #+# #+# */
|
/* Created: 2017/02/16 22:17:10 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/17 16:51:53 by gwojda ### ########.fr */
|
/* Updated: 2017/03/22 18:23:04 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Count the number of time char c is in str.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static size_t ft_strxchr(char *str, char c)
|
||||||
|
{
|
||||||
|
size_t rt;
|
||||||
|
|
||||||
|
rt = 0;
|
||||||
|
while(*str)
|
||||||
|
{
|
||||||
|
if (*str == c)
|
||||||
|
rt++;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return (rt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Add escape char \ for char to_escape.
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *ft_add_escape(char *str, char to_escape)
|
||||||
|
{
|
||||||
|
char *rt;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
if (!str)
|
||||||
|
return (NULL);
|
||||||
|
if (!ft_strxchr(str, ' '))
|
||||||
|
return (ft_strdup(str));
|
||||||
|
rt = ft_strnew(ft_strlen(str) + ft_strxchr(str, to_escape));
|
||||||
|
i = 0;
|
||||||
|
j = 0;
|
||||||
|
while (str[i])
|
||||||
|
{
|
||||||
|
if (str[i] == to_escape)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
rt[j++] = '\\';
|
||||||
|
rt[j++] = ' ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rt[j++] = str[i++];
|
||||||
|
}
|
||||||
|
return (rt);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Support: Return the size of a char**.
|
** Support: Return the size of a char**.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/21 14:37:14 by gwojda ### ########.fr */
|
/* Updated: 2017/03/22 18:20:29 by alao ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -53,19 +53,22 @@ int c_updater(t_comp *c, char *select)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *rt;
|
char *rt;
|
||||||
|
char *alter;
|
||||||
|
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
rt = NULL;
|
rt = NULL;
|
||||||
|
alter = ft_add_escape(select, ' ');
|
||||||
if (c->match)
|
if (c->match)
|
||||||
tmp = ft_strsub(c->rcmd, 0, ft_strlen(c->rcmd) - ft_strlen(c->match));
|
tmp = ft_strsub(c->rcmd, 0, ft_strlen(c->rcmd) - ft_strlen(c->match));
|
||||||
else
|
else
|
||||||
tmp = ft_strdup(c->rcmd);
|
tmp = ft_strdup(c->rcmd);
|
||||||
rt = ft_strjoin(tmp, select);
|
rt = ft_strjoin(tmp, alter);
|
||||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||||
c->rcmd ? ft_memdel((void *)&c->rcmd) : (0);
|
c->rcmd ? ft_memdel((void *)&c->rcmd) : (0);
|
||||||
c->rcmd = ft_strdup(rt);
|
c->rcmd = ft_strdup(rt);
|
||||||
c_updater_rcmd(c);
|
c_updater_rcmd(c);
|
||||||
rt ? ft_memdel((void *)&rt) : (0);
|
rt ? ft_memdel((void *)&rt) : (0);
|
||||||
|
alter ? ft_memdel((void *)&alter) : (0);
|
||||||
c_clear(data_singleton());
|
c_clear(data_singleton());
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/21 20:18:34 by ariard #+# #+# */
|
/* Created: 2017/03/21 20:18:34 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/21 20:53:45 by ariard ### ########.fr */
|
/* Updated: 2017/03/22 19:25:38 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
int pfree_func(t_process *p)
|
int pfree_func(t_process *p)
|
||||||
{
|
{
|
||||||
ft_putstr("hello");
|
|
||||||
btree_del(&p->data.function.content, &ast_free);
|
btree_del(&p->data.function.content, &ast_free);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 03:23:59 by wescande #+# #+# */
|
/* Created: 2017/03/08 03:23:59 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/22 19:30:13 by jhalford ### ########.fr */
|
/* Updated: 2017/03/22 19:37:08 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
#define FUNCERR_0 SHELL_NAME ":maximum nested function level reached\n"
|
#define FUNCERR_0 SHELL_NAME ":maximum nested function level reached"
|
||||||
|
|
||||||
int plaunch_function(t_process *p)
|
int plaunch_function(t_process *p)
|
||||||
{
|
{
|
||||||
|
|
@ -36,6 +36,6 @@ int plaunch_function(t_process *p)
|
||||||
builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL",
|
builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL",
|
||||||
ft_itoa(value), 0}, NULL);
|
ft_itoa(value), 0}, NULL);
|
||||||
ft_exec(&p->data.function.content);
|
ft_exec(&p->data.function.content);
|
||||||
DG();
|
builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", "0", 0}, NULL);
|
||||||
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
|
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/22 19:18:35 by jhalford ### ########.fr */
|
/* Updated: 2017/03/22 19:37:21 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -43,7 +43,6 @@ static int handle_instruction(t_list **token, t_btree **ast)
|
||||||
return (ret);
|
return (ret);
|
||||||
if (do_lexer_routine(token, stream) > 0)
|
if (do_lexer_routine(token, stream) > 0)
|
||||||
continue ;
|
continue ;
|
||||||
token_print(*token);
|
|
||||||
if ((ret = do_parser_routine(token, ast)) == 1
|
if ((ret = do_parser_routine(token, ast)) == 1
|
||||||
&& SH_NO_INTERACTIVE(data->opts))
|
&& SH_NO_INTERACTIVE(data->opts))
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/24 23:43:07 by ariard #+# #+# */
|
/* Created: 2017/02/24 23:43:07 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/22 16:52:57 by gwojda ### ########.fr */
|
/* Updated: 2017/03/22 19:21:58 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ t_list *is_already_func(t_btree **new)
|
||||||
ret = (new_name && new_name[0] && old_name && old_name[0]
|
ret = (new_name && new_name[0] && old_name && old_name[0]
|
||||||
&& !ft_strcmp(new_name[0], old_name[0])) ? 0 : 1;
|
&& !ft_strcmp(new_name[0], old_name[0])) ? 0 : 1;
|
||||||
ft_tabdel(&old_name);
|
ft_tabdel(&old_name);
|
||||||
tmp = tmp->next;
|
tmp = (ret) ? tmp->next : tmp;
|
||||||
}
|
}
|
||||||
ft_tabdel(&new_name);
|
ft_tabdel(&new_name);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
@ -116,8 +116,10 @@ int add_one_func(t_btree **ast, t_list **lst)
|
||||||
(void)lst;
|
(void)lst;
|
||||||
func_ast = btree_map(*ast, &node_copy);
|
func_ast = btree_map(*ast, &node_copy);
|
||||||
if ((old_func = is_already_func(&func_ast)))
|
if ((old_func = is_already_func(&func_ast)))
|
||||||
|
{
|
||||||
ft_lst_delif(&data_singleton()->lst_func,
|
ft_lst_delif(&data_singleton()->lst_func,
|
||||||
old_func->content, &ft_addrcmp, &tree_func_free);
|
old_func->content, &ft_addrcmp, &tree_func_free);
|
||||||
|
}
|
||||||
ft_lsteadd(&data_singleton()->lst_func, ft_lstnew(&func_ast, sizeof(*ast)));
|
ft_lsteadd(&data_singleton()->lst_func, ft_lstnew(&func_ast, sizeof(*ast)));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/22 16:54:58 by ariard ### ########.fr */
|
/* Updated: 2017/03/22 19:00:06 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -38,7 +38,8 @@ t_aggrematch g_aggrematch[] =
|
||||||
{TK_DONE, COMPOUND_LIST, DO_GROUP, TK_DO},
|
{TK_DONE, COMPOUND_LIST, DO_GROUP, TK_DO},
|
||||||
{TK_ESAC, TK_IN, CASE_CLAUSE, TK_CASE},
|
{TK_ESAC, TK_IN, CASE_CLAUSE, TK_CASE},
|
||||||
{TK_ESAC, CASE_LIST_NS, CASE_CLAUSE, TK_CASE},
|
{TK_ESAC, CASE_LIST_NS, CASE_CLAUSE, TK_CASE},
|
||||||
{TK_PAREN_CLOSE, SEMI_SUBSHELL, SUBSHELL, TK_PAREN_OPEN},
|
{TK_PAREN_CLOSE, SUBSHELL, SUBSHELL, TK_PAREN_OPEN},
|
||||||
|
// {TK_PAREN_CLOSE, SEMI_SUBSHELL, SUBSHELL, TK_PAREN_OPEN},
|
||||||
{TK_PAREN_CLOSE, COMPOUND_LIST, SUBSHELL, TK_PAREN_OPEN},
|
{TK_PAREN_CLOSE, COMPOUND_LIST, SUBSHELL, TK_PAREN_OPEN},
|
||||||
{TK_PAREN_CLOSE, CMD_SUPERIOR, SUBSHELL, TK_PAREN_OPEN},
|
{TK_PAREN_CLOSE, CMD_SUPERIOR, SUBSHELL, TK_PAREN_OPEN},
|
||||||
{TK_PAREN_CLOSE, PIPE_SEMI_SEQUENCE, SUBSHELL, TK_PAREN_OPEN},
|
{TK_PAREN_CLOSE, PIPE_SEMI_SEQUENCE, SUBSHELL, TK_PAREN_OPEN},
|
||||||
|
|
@ -221,9 +222,7 @@ t_aggrematch g_aggrematch[] =
|
||||||
{COMPOUND_LIST, CASE_LIST_NS, CASE_LIST_NS, CASE_LIST_NS},
|
{COMPOUND_LIST, CASE_LIST_NS, CASE_LIST_NS, CASE_LIST_NS},
|
||||||
{CLOSE_LIST, PATTERN, CASE_LIST_NS, PATTERN_CASE},
|
{CLOSE_LIST, PATTERN, CASE_LIST_NS, PATTERN_CASE},
|
||||||
{CLOSE_LIST, FUNC_NAME, FUNCTION_DEFINITION, FUNC_NAME},
|
{CLOSE_LIST, FUNC_NAME, FUNCTION_DEFINITION, FUNC_NAME},
|
||||||
{SUBSHELL, TK_PAREN_OPEN, SEMI_SUBSHELL, 0},
|
|
||||||
{SUBSHELL, ALL, COMPOUND_COMMAND, 0},
|
{SUBSHELL, ALL, COMPOUND_COMMAND, 0},
|
||||||
{BRACE_CLAUSE, TK_LBRACE, SEMI_BRACE, 0},
|
|
||||||
{BRACE_CLAUSE, ALL, COMPOUND_COMMAND, 0},
|
{BRACE_CLAUSE, ALL, COMPOUND_COMMAND, 0},
|
||||||
{COMPOUND_COMMAND, FUNC_NAME, COMMAND, FUNC_NAME},
|
{COMPOUND_COMMAND, FUNC_NAME, COMMAND, FUNC_NAME},
|
||||||
{AND_OR_MINOR, PIPE_SEMI_SEQUENCE, AND_OR_MAJOR, PIPE_SEMI_SEQUENCE},
|
{AND_OR_MINOR, PIPE_SEMI_SEQUENCE, AND_OR_MAJOR, PIPE_SEMI_SEQUENCE},
|
||||||
|
|
@ -382,20 +381,15 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
|
||||||
return (1);
|
return (1);
|
||||||
i = -1;
|
i = -1;
|
||||||
head = (*stack)->content;
|
head = (*stack)->content;
|
||||||
DG("aggregate head %s && sym %s",
|
|
||||||
read_state(*head), read_state(*new_sym));
|
|
||||||
while (g_aggrematch[++i].top)
|
while (g_aggrematch[++i].top)
|
||||||
if (*new_sym == g_aggrematch[i].top
|
if (*new_sym == g_aggrematch[i].top
|
||||||
&& MATCH_STACK(*head, g_aggrematch[i].under))
|
&& MATCH_STACK(*head, g_aggrematch[i].under))
|
||||||
{
|
{
|
||||||
|
|
||||||
DG("MATCH : %s", read_state(g_aggrematch[i].new_sym));
|
|
||||||
*new_sym = g_aggrematch[i].new_sym;
|
*new_sym = g_aggrematch[i].new_sym;
|
||||||
if (g_aggrematch[i].erase_sym)
|
if (g_aggrematch[i].erase_sym)
|
||||||
{
|
{
|
||||||
pop_stack(stack, g_aggrematch[i].erase_sym);
|
pop_stack(stack, g_aggrematch[i].erase_sym);
|
||||||
head = (*stack)->content;
|
head = (*stack)->content;
|
||||||
DG("stack after pop: %s", read_state(*head));
|
|
||||||
}
|
}
|
||||||
if (eval_sym(stack, *new_sym) && !(*state = ERROR))
|
if (eval_sym(stack, *new_sym) && !(*state = ERROR))
|
||||||
return (1);
|
return (1);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/22 16:56:05 by ariard ### ########.fr */
|
/* Updated: 2017/03/22 19:00:15 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -578,7 +578,7 @@ t_stackmatch g_stackmatch[] =
|
||||||
{TK_PAREN_CLOSE, COMPOUND_LIST},
|
{TK_PAREN_CLOSE, COMPOUND_LIST},
|
||||||
{TK_PAREN_CLOSE, FUNC_NAME},
|
{TK_PAREN_CLOSE, FUNC_NAME},
|
||||||
{TK_PAREN_CLOSE, OPEN_FUNC},
|
{TK_PAREN_CLOSE, OPEN_FUNC},
|
||||||
{TK_PAREN_CLOSE, SEMI_SUBSHELL},
|
{TK_PAREN_CLOSE, SUBSHELL},
|
||||||
{TK_RBRACE, TK_SEMI},
|
{TK_RBRACE, TK_SEMI},
|
||||||
{TK_RBRACE, END_COMMAND},
|
{TK_RBRACE, END_COMMAND},
|
||||||
{TK_RBRACE, SEPARATOR_OP},
|
{TK_RBRACE, SEPARATOR_OP},
|
||||||
|
|
@ -1048,7 +1048,6 @@ t_stackmatch g_stackmatch[] =
|
||||||
{SUBSHELL, COMPLETE_CONDITION},
|
{SUBSHELL, COMPLETE_CONDITION},
|
||||||
{SUBSHELL, CONDITION},
|
{SUBSHELL, CONDITION},
|
||||||
{SUBSHELL, AND_OR_MAJOR},
|
{SUBSHELL, AND_OR_MAJOR},
|
||||||
{SEMI_SUBSHELL, TK_PAREN_OPEN},
|
|
||||||
{COMPOUND_COMMAND, LINEBREAK},
|
{COMPOUND_COMMAND, LINEBREAK},
|
||||||
{COMPOUND_COMMAND, TK_PAREN_OPEN},
|
{COMPOUND_COMMAND, TK_PAREN_OPEN},
|
||||||
{COMPOUND_COMMAND, TK_LBRACE},
|
{COMPOUND_COMMAND, TK_LBRACE},
|
||||||
|
|
@ -1273,7 +1272,6 @@ int eval_sym(t_list **stack, t_sym new_sym)
|
||||||
return (1);
|
return (1);
|
||||||
head = (*stack)->content;
|
head = (*stack)->content;
|
||||||
i = 0;
|
i = 0;
|
||||||
DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
|
|
||||||
while (g_stackmatch[i].top)
|
while (g_stackmatch[i].top)
|
||||||
{
|
{
|
||||||
if (new_sym == g_stackmatch[i].top && *head == g_stackmatch[i].under)
|
if (new_sym == g_stackmatch[i].top && *head == g_stackmatch[i].under)
|
||||||
|
|
|
||||||
|
|
@ -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/03/22 16:34:24 by ariard ### ########.fr */
|
/* Updated: 2017/03/22 19:26:03 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -68,14 +68,14 @@ t_prodmatch g_prodmatch[] =
|
||||||
{TK_ASSIGNMENT_WORD, TK_ELIF, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, TK_ELIF, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, TK_ELSE, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, TK_ELSE, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, NEWLINE_LIST, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, NEWLINE_LIST, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, CMD_NAME, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, CMD_NAME, CMD_SUFFIX},
|
||||||
{TK_ASSIGNMENT_WORD, CMD_SUPERIOR, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, CMD_SUPERIOR, CMD_SUFFIX},
|
||||||
{TK_ASSIGNMENT_WORD, COMPOUND_LIST, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, COMPOUND_LIST, CMD_SUFFIX},
|
||||||
{TK_ASSIGNMENT_WORD, COMPLETE_CONDITION, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, COMPLETE_CONDITION, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, CONDITION, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, CONDITION, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, AND_OR, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, AND_OR, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, AND_OR_MAJOR, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, AND_OR_MAJOR, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, PIPE_SEMI_SEQUENCE, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, PIPE_SEMI_SEQUENCE, CMD_SUFFIX},
|
||||||
{TK_ASSIGNMENT_WORD, SEQUENCE, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, SEQUENCE, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, COMPLETE_COMMANDS, CMD_PREFIX},
|
{TK_ASSIGNMENT_WORD, COMPLETE_COMMANDS, CMD_PREFIX},
|
||||||
{TK_ASSIGNMENT_WORD, CMD_WORD, CMD_SUFFIX},
|
{TK_ASSIGNMENT_WORD, CMD_WORD, CMD_SUFFIX},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue