yale sauf subshell
This commit is contained in:
parent
aa9097575d
commit
722a290aee
10 changed files with 26 additions and 16 deletions
0
42sh/F
0
42sh/F
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/01 18:02:01 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:39:00 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/01 16:55:33 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:39:16 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/01 17:50:59 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:59:40 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -30,8 +30,10 @@ int handle_instruction(int fd)
|
|||
DG("START: state=%i", parser.state);
|
||||
while (1)
|
||||
{
|
||||
if ((ret = readline(fd, get_lexer_stack(lexer) || parser.state == UNDEFINED, &str)))
|
||||
if ((ret = readline(fd, get_lexer_stack(lexer) ||
|
||||
parser.state == UNDEFINED, &str)))
|
||||
{
|
||||
ft_putstr("bonjour");
|
||||
if (ret == -1)
|
||||
return (-1);
|
||||
return (parser.state == UNDEFINED ? error_EOF() : 1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 20:49:15 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 18:02:27 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:46:31 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,12 +20,12 @@ int add_cmd(t_btree **ast, t_list **lst)
|
|||
|
||||
if ((token = (*lst)->content)->type == TK_IN || token->type == TK_PAREN_OPEN)
|
||||
return (0);
|
||||
else if (isdir_sep(ast, lst))
|
||||
return (add_redir_type(ast, lst));
|
||||
else if (!*ast)
|
||||
gen_node(ast);
|
||||
else if (isdir_word(ast, lst))
|
||||
return (add_redir_word(ast, lst));
|
||||
else if (isdir_sep(ast, lst))
|
||||
return (add_redir_type(ast, lst));
|
||||
else if (isloop(ast, lst) == 3)
|
||||
return (add_loop_condition(ast, lst));
|
||||
else if (isloop(ast, lst))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/17 16:39:05 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 17:59:17 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:44:53 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -27,6 +27,13 @@ int isdir_sep(t_btree **ast, t_list **list)
|
|||
|| token->type == TK_DLESS || token->type == TK_DGREAT))
|
||||
return (1);
|
||||
}
|
||||
if (!*ast)
|
||||
{
|
||||
if (token->type == TK_LESS || token->type == TK_GREAT
|
||||
|| token->type == TK_GREATAND || token->type == TK_LESSAND
|
||||
|| token->type == TK_DLESS || token->type == TK_DGREAT)
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 17:39:18 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 17:00:05 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:55:14 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 18:32:59 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 18:01:38 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:39:39 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ t_treematch g_treematch[] =
|
|||
{TK_DLESS, &add_cmd},
|
||||
{TK_OR_IF, &add_sep},
|
||||
{TK_AND_IF, &add_sep},
|
||||
{TK_AMP, &add_sep},
|
||||
{TK_WHILE, &add_cmd},
|
||||
{TK_UNTIL, &add_cmd},
|
||||
{TK_DO, &add_cmd},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/21 16:14:04 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 17:43:08 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:54:37 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/01 17:17:20 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/01 22:53:39 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,8 +14,10 @@
|
|||
|
||||
char *read_state(t_sym current)
|
||||
{
|
||||
if (current == UNDEFINED)
|
||||
return ("UNDEFINED");
|
||||
if (current == LINEBREAK)
|
||||
return ("LINEBREAK");
|
||||
if (current == CLOSE_LIST)
|
||||
return ("CLOSE_LIST");
|
||||
if (current == BRACE_CLAUSE)
|
||||
return ("BRACE_CLAUSE");
|
||||
if (current == FUNC_NAME)
|
||||
|
|
@ -192,8 +194,6 @@ char *read_state(t_sym current)
|
|||
return ("ALL");
|
||||
if (current == NEWLINE_LIST)
|
||||
return ("NEWLINE_LIST");
|
||||
if (current == LINEBREAK)
|
||||
return ("LINEBREAK");
|
||||
if (current != 0)
|
||||
return ("NON-DEFINED");
|
||||
if (current == 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue