merge
This commit is contained in:
commit
eb466c6c70
17 changed files with 44 additions and 35 deletions
1
42sh/file
Normal file
1
42sh/file
Normal file
|
|
@ -0,0 +1 @@
|
|||
cat: wefwewef: No such file or directory
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/06 22:09:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/13 17:41:41 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/13 17:42:53 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/26 00:07:05 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/06 17:59:39 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:55:08 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -33,11 +33,13 @@ t_rvwords g_rvwords[] =
|
|||
|
||||
static int recognization_rvwords(t_token *pv_tk)
|
||||
{
|
||||
if (!pv_tk || (pv_tk->type == TK_NEWLINE || pv_tk->type == TK_AMP
|
||||
|| pv_tk->type == TK_SEMI || pv_tk->type == TK_WHILE
|
||||
|| pv_tk->type == TK_DONE || pv_tk->type == TK_DO
|
||||
|| pv_tk->type == TK_IF || pv_tk->type == TK_FI || pv_tk->type == TK_THEN
|
||||
|| pv_tk->type == TK_ELIF || pv_tk->type == TK_ELSE))
|
||||
if (!pv_tk || (pv_tk->type == TK_NEWLINE || pv_tk->type == TK_AMP
|
||||
|| pv_tk->type == TK_SEMI || pv_tk->type == TK_PIPE
|
||||
|| pv_tk->type == TK_WHILE || pv_tk->type == TK_DONE
|
||||
|| pv_tk->type == TK_DO || pv_tk->type == TK_IF
|
||||
|| pv_tk->type == TK_FI || pv_tk->type == TK_THEN
|
||||
|| pv_tk->type == TK_ELIF || pv_tk->type == TK_ELSE
|
||||
|| pv_tk->type == TK_DSEMI))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/13 16:43:05 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/13 17:42:49 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/10 14:57:45 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 16:29:08 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:25:38 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/04 20:42:13 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 15:33:30 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:26:28 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,6 +21,10 @@ int iscase(t_btree **ast, t_list **lst)
|
|||
if (*ast)
|
||||
{
|
||||
node = (*ast)->item;
|
||||
if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|
||||
|| node->type == TK_AMP || node->type == TK_PIPE)
|
||||
&& iscase(&(*ast)->right, lst) == 1)
|
||||
return (1);
|
||||
if (node->type == TK_CASE || node->type == TK_PAREN_OPEN)
|
||||
return (1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/10 17:06:16 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 15:36:33 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:10:30 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,15 +15,14 @@
|
|||
int iscondition(t_btree **ast, t_list **lst)
|
||||
{
|
||||
t_astnode *node;
|
||||
// t_token *token;
|
||||
|
||||
node = NULL;
|
||||
// token = (*lst)->content;
|
||||
if (*ast)
|
||||
{
|
||||
node = (*ast)->item;
|
||||
if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|
||||
|| node->type == TK_AMP) && iscondition(&(*ast)->right, lst) == 1)
|
||||
|| node->type == TK_AMP || node->type == TK_PIPE)
|
||||
&& iscondition(&(*ast)->right, lst) == 1)
|
||||
return (1);
|
||||
if ((node->type == TK_IF || node->type == TK_ELIF
|
||||
|| node->type == TK_ELSE) && node->full == 0)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/24 23:43:07 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 15:41:11 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:24:17 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -44,7 +44,8 @@ int isfunc(t_btree **ast, t_list **lst)
|
|||
{
|
||||
node = (*ast)->item;
|
||||
if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|
||||
|| node->type == TK_AMP) && isfunc(&(*ast)->right, lst) == 1)
|
||||
|| node->type == TK_AMP || node->type == TK_PIPE)
|
||||
&& isfunc(&(*ast)->right, lst) == 1)
|
||||
return (1);
|
||||
if (node->type == FNAME && node->full == 0)
|
||||
return (1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/17 22:17:14 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 14:23:53 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:12:35 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -22,7 +22,8 @@ int isloop(t_btree **ast, t_list **lst)
|
|||
{
|
||||
node = (*ast)->item;
|
||||
if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|
||||
|| node->type == TK_AMP) && isloop(&(*ast)->right, lst) == 1)
|
||||
|| node->type == TK_AMP || node->type == TK_PIPE)
|
||||
&& isloop(&(*ast)->right, lst) == 1)
|
||||
return (1);
|
||||
if ((node->type == TK_WHILE || node->type == TK_UNTIL
|
||||
|| node->type == TK_FOR) && node->full == 0)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/05 17:28:31 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 16:21:50 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:58:33 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/17 16:39:05 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 16:24:44 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:57:59 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 19:12:07 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 15:55:45 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:25:31 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 14:25:12 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:09:23 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/12 00:50:41 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:26:59 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -388,20 +388,20 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
|
|||
return (1);
|
||||
i = 0;
|
||||
head = (*stack)->content;
|
||||
// DG("aggregate head %s && sym %s",
|
||||
// read_state(*head), read_state(*new_sym));
|
||||
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("MATCH : %s", read_state(g_aggrematch[i].new_sym));
|
||||
DG("MATCH : %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));
|
||||
DG("stack after pop: %s", read_state(*head));
|
||||
}
|
||||
if (eval_sym(stack, *new_sym))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 16:17:10 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:39:28 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -830,12 +830,13 @@ t_stackmatch g_stackmatch[] =
|
|||
{CONDITION, COMPOUND_LIST},
|
||||
{CONDITION, CASE_LIST_NS},
|
||||
{CONDITION, COMPLETE_CONDITION},
|
||||
{CONDITION, SEQUENCE},
|
||||
{COMPLETE_CONDITION, LINEBREAK},
|
||||
{COMPLETE_CONDITION, TK_PAREN_OPEN},
|
||||
{COMPLETE_CONDITION, TK_LBRACE},
|
||||
{COMPLETE_CONDITION, COMPLETE_COMMANDS},
|
||||
{COMPLETE_CONDITION, COMPLETE_CONDITION},
|
||||
{COMPLETE_CONDITION, COMPLETE_CONDITION},
|
||||
{COMPLETE_CONDITION, SEQUENCE},
|
||||
{BRACE_GROUP, LINEBREAK},
|
||||
{BRACE_GROUP, TK_PAREN_OPEN},
|
||||
{BRACE_GROUP, TK_LBRACE},
|
||||
|
|
@ -1266,7 +1267,7 @@ int eval_sym(t_list **stack, t_sym new_sym)
|
|||
if (!*stack)
|
||||
return (1);
|
||||
head = (*stack)->content;
|
||||
// DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
|
||||
DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
|
||||
i = 0;
|
||||
while (g_stackmatch[i].top)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 16:21:05 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 16:40:27 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:57:08 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 17:58:34 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/11 16:22:18 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/13 16:31:42 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -130,8 +130,8 @@ int produce_sym(t_list **stack, t_sym *new_sym, t_list **lst)
|
|||
return (1);
|
||||
token = (*lst)->content;
|
||||
head = (*stack)->content;
|
||||
// DG("produce stack : %s && token : %s", read_state(*head),
|
||||
// read_state(token->type));
|
||||
DG("produce stack : %s && token : %s", read_state(*head),
|
||||
read_state(token->type));
|
||||
i = 0;
|
||||
*new_sym = 0;
|
||||
while (g_prodmatch[i].new_sym)
|
||||
|
|
@ -139,7 +139,7 @@ int produce_sym(t_list **stack, t_sym *new_sym, t_list **lst)
|
|||
if (token->type == g_prodmatch[i].token
|
||||
&& *head == g_prodmatch[i].stack)
|
||||
{
|
||||
// DG("MATCH : %s", read_state(g_prodmatch[i].new_sym));
|
||||
DG("MATCH : %s", read_state(g_prodmatch[i].new_sym));
|
||||
*new_sym = g_prodmatch[i].new_sym;
|
||||
}
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue