brackets good
This commit is contained in:
parent
cffec70bf1
commit
d47557fdd1
5 changed files with 1132 additions and 710 deletions
File diff suppressed because one or more lines are too long
|
|
@ -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/13 19:04:55 by ariard ### ########.fr */
|
/* Updated: 2017/03/18 15:50:28 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -40,9 +40,17 @@ int add_subshell_cmd(t_btree **ast, t_list **lst)
|
||||||
|
|
||||||
token = (*lst)->content;
|
token = (*lst)->content;
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
if (token->type == TK_PAREN_CLOSE && node->type == SUBSHELL)
|
if ((token->type == SUBSHELL && node->type == SUBSHELL)
|
||||||
|
|| (token->type == TK_LBRACE && node->type == TK_LBRACE))
|
||||||
|
node->nest++;
|
||||||
|
if (((token->type == TK_PAREN_CLOSE && node->type == SUBSHELL)
|
||||||
|
|| (token->type == TK_RBRACE && node->type == TK_LBRACE)) && node->nest > 0)
|
||||||
|
node->nest--;
|
||||||
|
else if (token->type == TK_PAREN_CLOSE && node->type == SUBSHELL
|
||||||
|
&& node->nest == 0)
|
||||||
return ((node->full = 1));
|
return ((node->full = 1));
|
||||||
if (token->type == TK_RBRACE && node->type == TK_LBRACE)
|
else if (token->type == TK_RBRACE && node->type == TK_LBRACE
|
||||||
|
&& node->nest == 0)
|
||||||
return ((node->full = 1));
|
return ((node->full = 1));
|
||||||
return (add_cmd(&(*ast)->right, lst));
|
return (add_cmd(&(*ast)->right, lst));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/17 18:23:50 by ariard ### ########.fr */
|
/* Updated: 2017/03/18 15:52:52 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/17 18:12:41 by ariard ### ########.fr */
|
/* Updated: 2017/03/18 15:51:55 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -413,6 +413,7 @@ t_stackmatch g_stackmatch[] =
|
||||||
{TK_LBRACE, LINEBREAK},
|
{TK_LBRACE, LINEBREAK},
|
||||||
{TK_LBRACE, TK_BANG},
|
{TK_LBRACE, TK_BANG},
|
||||||
{TK_LBRACE, TK_LBRACE},
|
{TK_LBRACE, TK_LBRACE},
|
||||||
|
{TK_LBRACE, TK_PAREN_OPEN},
|
||||||
{TK_LBRACE, SEPARATOR_OP},
|
{TK_LBRACE, SEPARATOR_OP},
|
||||||
{TK_LBRACE, NEWLINE_LIST},
|
{TK_LBRACE, NEWLINE_LIST},
|
||||||
{TK_LBRACE, SEQUENCE},
|
{TK_LBRACE, SEQUENCE},
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
|
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/17 18:00:34 by ariard ### ########.fr */
|
/* Updated: 2017/03/18 15:46:49 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue