diff --git a/42sh/src/parser/add_case.c b/42sh/src/parser/add_case.c index 8ee56bc8..234fd46f 100644 --- a/42sh/src/parser/add_case.c +++ b/42sh/src/parser/add_case.c @@ -9,33 +9,18 @@ int iscase(t_btree **ast, t_list **lst) token = (*lst)->content; if (*ast) { - node = (*ast)->item; + node = (*ast)->item; + if (node->type == TK_PAREN_OPEN && node->full == 0 && node->nest > 0) + return (4); if (node->type == TK_PAREN_OPEN && node->full == 0) - { - // DG("go right"); return (1); - } if ((node->type == TK_CASE || node->type == TK_PAREN_OPEN || iscase(&(*ast)->right, lst) == 1) && token->type == TK_WORD && node->pattern == 0) - { - // DG("add pattern"); return (2); - } - if ((node->type == TK_CASE || iscase(&(*ast)->right, lst) == 4) + if ((node->type == TK_CASE || iscase(&(*ast)->right, lst) == 1) && token->type == TK_PAREN_OPEN) - { - // DG("new branch"); return (3); - } - if ((node->type == TK_NEWLINE || node->type == TK_SEMI - || node->type == TK_AMP) && iscase(&(*ast)->right, lst) == 1) - { -// DG(" go right"); - return (1); - } - if (node->type == TK_PAREN_OPEN && node->nest == 0) - return (4); } return (0); } diff --git a/42sh/src/parser/add_cmd.c b/42sh/src/parser/add_cmd.c index b8d1112c..bdc8fe11 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/20 22:27:06 by jhalford ### ########.fr */ +/* Updated: 2017/02/23 18:04:26 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/add_sep.c b/42sh/src/parser/add_sep.c index 950b17f5..faa49b14 100644 --- a/42sh/src/parser/add_sep.c +++ b/42sh/src/parser/add_sep.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 19:12:07 by ariard #+# #+# */ -/* Updated: 2017/02/20 17:46:54 by ariard ### ########.fr */ +/* Updated: 2017/02/23 18:04:24 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ int add_sep(t_btree **ast, t_list **lst) return (add_loop_sep(ast, lst)); else if (iscondition(ast, lst) == 1) return (add_condition_sep(ast, lst)); - else if (iscase(ast, lst)) + else if (iscase(ast, lst) == 1) return (add_case_sep(ast, lst)); if (!*ast) gen_node(ast); diff --git a/42sh/src/parser/build_tree.c b/42sh/src/parser/build_tree.c index cbebde17..05ab6407 100644 --- a/42sh/src/parser/build_tree.c +++ b/42sh/src/parser/build_tree.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 18:32:59 by ariard #+# #+# */ -/* Updated: 2017/02/21 20:28:38 by ariard ### ########.fr */ +/* Updated: 2017/02/23 18:03:35 by ariard ### ########.fr */ /* */ /* ************************************************************************** */