From d251474db9a648e1b8c4672e3cdb692f3ee1e6a4 Mon Sep 17 00:00:00 2001 From: "ariard@student.42.fr" Date: Fri, 24 Feb 2017 14:52:04 +0100 Subject: [PATCH] erase error --- 42sh/src/parser/add_cmd.c | 2 +- 42sh/src/parser/add_condition.c | 19 +++++++++---------- 42sh/src/parser/add_loop.c | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) 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 */ /* */ /* ************************************************************************** */