diff --git a/42sh/src/parser/add_cmd.c b/42sh/src/parser/add_cmd.c index bdc8fe11..38565bea 100644 --- a/42sh/src/parser/add_cmd.c +++ b/42sh/src/parser/add_cmd.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 20:49:15 by ariard #+# #+# */ -/* Updated: 2017/02/23 18:04:26 by ariard ### ########.fr */ +/* Updated: 2017/02/24 14:51:47 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/add_condition.c b/42sh/src/parser/add_condition.c index b1d43125..769f4425 100644 --- a/42sh/src/parser/add_condition.c +++ b/42sh/src/parser/add_condition.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/19 18:12:52 by ariard #+# #+# */ -/* Updated: 2017/02/20 18:18:56 by ariard ### ########.fr */ +/* Updated: 2017/02/24 14:51:05 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,16 +22,15 @@ int iscondition(t_btree **ast, t_list **lst) if (*ast) { node = (*ast)->item; - if ((node->type == TK_IF || iscondition(&(*ast)->right, lst)) - && (token->type == TK_ELIF || token->type == TK_ELSE) - && node->nest == 0) + if ((node->type == TK_CASE || node->type == TK_PAREN_OPEN) + && node->pattern = 0 && token->type == TK_WORD) return (2); - if ((node->type == TK_IF || node->type == TK_ELIF || node->type == TK_ELSE) - && node->full == 0) - return (1); - if ((node->type == TK_NEWLINE || node->type == TK_SEMI - || node->type == TK_AMP) && iscondition(&(*ast)->right, lst) == 1) - return (1); + if (node->type == TK_CASE) + return (3); + if (node->type == TK_PAREN_OPEN && nest == 0) + return (3); + if (node->type == TK_PAREN_OPEN && nest > 0) + return (0); } return (0); } diff --git a/42sh/src/parser/add_loop.c b/42sh/src/parser/add_loop.c index 81d9e016..9d892675 100644 --- a/42sh/src/parser/add_loop.c +++ b/42sh/src/parser/add_loop.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/17 22:17:14 by ariard #+# #+# */ -/* Updated: 2017/02/20 19:03:04 by ariard ### ########.fr */ +/* Updated: 2017/02/24 14:41:20 by ariard ### ########.fr */ /* */ /* ************************************************************************** */