This commit is contained in:
gwojda 2017-03-22 15:47:09 +01:00
commit 2f209fad5b
7 changed files with 20 additions and 13 deletions

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/10 14:57:45 by ariard #+# #+# */ /* Created: 2017/03/10 14:57:45 by ariard #+# #+# */
/* Updated: 2017/03/20 18:11:11 by gwojda ### ########.fr */ /* Updated: 2017/03/22 15:34:25 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,7 +22,9 @@ int isbang(t_btree **ast, t_list **lst)
{ {
node = (*ast)->item; node = (*ast)->item;
if ((node->type == TK_NEWLINE || node->type == TK_SEMI if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|| node->type == TK_AMP) && isbang(&(*ast)->right, lst) == 1) || node->type == TK_AMP || node->type == TK_AND_IF
|| node->type == TK_OR_IF || node->type == TK_PIPE)
&& isbang(&(*ast)->right, lst) == 1)
return (1); return (1);
if (node->type == TK_BANG && node->full == 0) if (node->type == TK_BANG && node->full == 0)
return (1); return (1);
@ -44,7 +46,8 @@ int isbang_sep(t_btree **ast, t_list **lst)
|| token->type == TK_OR_IF) && node->type == TK_BANG || token->type == TK_OR_IF) && node->type == TK_BANG
&& node->nest == 0) && node->nest == 0)
node->full = 1; node->full = 1;
if (token->type == TK_PIPE && node->type == TK_BANG && node->full == 0) if (token->type == TK_PIPE && node->type == TK_BANG
&& node->full == 0)
return (1); return (1);
} }
return (0); return (0);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/04 20:42:13 by ariard #+# #+# */ /* Created: 2017/03/04 20:42:13 by ariard #+# #+# */
/* Updated: 2017/03/15 01:09:23 by ariard ### ########.fr */ /* Updated: 2017/03/22 15:30:25 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,7 +22,8 @@ int iscase(t_btree **ast, t_list **lst)
{ {
node = (*ast)->item; node = (*ast)->item;
if ((node->type == TK_NEWLINE || node->type == TK_SEMI if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|| node->type == TK_AMP || node->type == TK_PIPE) || node->type == TK_AMP || node->type == TK_PIPE
|| node->type == TK_AND_IF || node->type == TK_OR_IF)
&& iscase(&(*ast)->right, lst) == 1) && iscase(&(*ast)->right, lst) == 1)
return (1); return (1);
if ((node->type == TK_CASE || node->type == TK_PAREN_OPEN) if ((node->type == TK_CASE || node->type == TK_PAREN_OPEN)

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/10 17:06:16 by ariard #+# #+# */ /* Created: 2017/03/10 17:06:16 by ariard #+# #+# */
/* Updated: 2017/03/20 18:11:18 by gwojda ### ########.fr */ /* Updated: 2017/03/22 15:33:12 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -21,7 +21,8 @@ int iscondition(t_btree **ast, t_list **lst)
{ {
node = (*ast)->item; node = (*ast)->item;
if ((node->type == TK_NEWLINE || node->type == TK_SEMI if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|| node->type == TK_AMP || node->type == TK_PIPE) || node->type == TK_AMP || node->type == TK_PIPE
|| node->type == TK_AND_IF || node->type == TK_OR_IF)
&& iscondition(&(*ast)->right, lst) == 1) && iscondition(&(*ast)->right, lst) == 1)
return (1); return (1);
if ((node->type == TK_IF || node->type == TK_ELIF if ((node->type == TK_IF || node->type == TK_ELIF

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/17 22:17:14 by ariard #+# #+# */ /* Created: 2017/02/17 22:17:14 by ariard #+# #+# */
/* Updated: 2017/03/17 17:45:41 by ariard ### ########.fr */ /* Updated: 2017/03/22 15:29:37 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -29,7 +29,8 @@ int isloop(t_btree **ast, t_list **lst)
|| token->type == TK_NAME) && node->pattern == 0) || token->type == TK_NAME) && node->pattern == 0)
return (0); return (0);
if ((node->type == TK_NEWLINE || node->type == TK_SEMI if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|| node->type == TK_AMP || node->type == TK_PIPE) || node->type == TK_AMP || node->type == TK_PIPE
|| node->type == TK_AND_IF || node->type == TK_OR_IF)
&& isloop(&(*ast)->right, lst) == 1) && isloop(&(*ast)->right, lst) == 1)
return (1); return (1);
if ((node->type == TK_WHILE || node->type == TK_UNTIL if ((node->type == TK_WHILE || node->type == TK_UNTIL

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/05 17:28:31 by ariard #+# #+# */ /* Created: 2017/03/05 17:28:31 by ariard #+# #+# */
/* Updated: 2017/03/20 15:39:36 by jhalford ### ########.fr */ /* Updated: 2017/03/22 15:32:16 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -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/03/15 18:57:13 by ariard ### ########.fr */ /* Updated: 2017/03/22 15:30:32 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */ /* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
/* Updated: 2017/03/20 14:57:34 by gwojda ### ########.fr */ /* Updated: 2017/03/22 15:32:43 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,7 +22,8 @@ int issubshell(t_btree **ast, t_list **lst)
{ {
node = (*ast)->item; node = (*ast)->item;
if ((node->type == TK_NEWLINE || node->type == TK_SEMI if ((node->type == TK_NEWLINE || node->type == TK_SEMI
|| node->type == TK_AMP || node->type == TK_PIPE) || node->type == TK_AMP || node->type == TK_PIPE
|| node->type == TK_AND_IF || node->type == TK_OR_IF)
&& issubshell(&(*ast)->right, lst) == 1) && issubshell(&(*ast)->right, lst) == 1)
return (1); return (1);
if (node->type == SUBSHELL && node->full == 0) if (node->type == SUBSHELL && node->full == 0)