diff --git a/42sh/file b/42sh/file new file mode 100644 index 00000000..1d552218 --- /dev/null +++ b/42sh/file @@ -0,0 +1,2 @@ +ls: feew: No such file or directory +ls: feew: No such file or directory diff --git a/42sh/file1 b/42sh/file1 new file mode 100644 index 00000000..e69de29b diff --git a/42sh/includes/types.h b/42sh/includes/types.h index 95080d63..474b8b7a 100644 --- a/42sh/includes/types.h +++ b/42sh/includes/types.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ -/* Updated: 2017/02/25 18:47:20 by ariard ### ########.fr */ +/* Updated: 2017/02/25 19:37:31 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/sample/redir/redir.sh b/42sh/sample/redir/redir.sh index 521002db..8b137891 100644 --- a/42sh/sample/redir/redir.sh +++ b/42sh/sample/redir/redir.sh @@ -1 +1 @@ -ls >> 1 >> 2 >> 3 < 4 < 5 ; pwd > 1 > 2 + diff --git a/42sh/src/lexer/lexer_default.c b/42sh/src/lexer/lexer_default.c index f1781eed..d8799ebe 100644 --- a/42sh/src/lexer/lexer_default.c +++ b/42sh/src/lexer/lexer_default.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 18:36:21 by jhalford #+# #+# */ -/* Updated: 2017/02/24 20:43:56 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:04:41 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_delim.c b/42sh/src/lexer/lexer_delim.c index c7e789f1..026a0f4a 100644 --- a/42sh/src/lexer/lexer_delim.c +++ b/42sh/src/lexer/lexer_delim.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:58:44 by jhalford #+# #+# */ -/* Updated: 2017/02/21 22:42:41 by ariard ### ########.fr */ +/* Updated: 2017/02/25 19:56:31 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_great.c b/42sh/src/lexer/lexer_great.c index cce8f831..8bbb462b 100644 --- a/42sh/src/lexer/lexer_great.c +++ b/42sh/src/lexer/lexer_great.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:06:35 by jhalford #+# #+# */ -/* Updated: 2017/02/21 21:09:31 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:12:58 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,6 +21,7 @@ int lexer_great(t_list **alst, t_lexer *lexer) lexer->pos++; if (lexer->str[lexer->pos] == '&') { + DG("lex greatand"); token->type = TK_GREATAND; token_append(token, lexer, 0, 0); lexer->pos++; @@ -28,6 +29,7 @@ int lexer_great(t_list **alst, t_lexer *lexer) } if (lexer->str[lexer->pos] == '>') { + DG("lex great"); token->type = TK_DGREAT; token_append(token, lexer, 0, 0); lexer->pos++; diff --git a/42sh/src/lexer/lexer_greatand.c b/42sh/src/lexer/lexer_greatand.c index 350bbec1..af86cb7f 100644 --- a/42sh/src/lexer/lexer_greatand.c +++ b/42sh/src/lexer/lexer_greatand.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:56:58 by jhalford #+# #+# */ -/* Updated: 2017/02/20 20:52:49 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:11:03 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_less.c b/42sh/src/lexer/lexer_less.c index 241f9ae1..0aa0174c 100644 --- a/42sh/src/lexer/lexer_less.c +++ b/42sh/src/lexer/lexer_less.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:06:53 by jhalford #+# #+# */ -/* Updated: 2017/02/20 20:53:06 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:11:17 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_lessand.c b/42sh/src/lexer/lexer_lessand.c index f411b225..d0e79268 100644 --- a/42sh/src/lexer/lexer_lessand.c +++ b/42sh/src/lexer/lexer_lessand.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:58:51 by jhalford #+# #+# */ -/* Updated: 2017/02/09 19:56:29 by jhalford ### ########.fr */ +/* Updated: 2017/02/25 20:11:10 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_number.c b/42sh/src/lexer/lexer_number.c index 0508f70f..11e9eb6e 100644 --- a/42sh/src/lexer/lexer_number.c +++ b/42sh/src/lexer/lexer_number.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */ -/* Updated: 2017/02/20 20:53:20 by ariard ### ########.fr */ +/* Updated: 2017/02/25 19:55:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,6 +18,7 @@ int lexer_number(t_list **alst, t_lexer *lexer) t_lexstate state; token = (*alst)->content; + token->type = TK_IO_NUMBER; if ((state = get_state_global(lexer))) { lexer->state = state; diff --git a/42sh/src/lexer/lexer_word.c b/42sh/src/lexer/lexer_word.c index 910be7b8..157668ba 100644 --- a/42sh/src/lexer/lexer_word.c +++ b/42sh/src/lexer/lexer_word.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */ -/* Updated: 2017/02/24 21:00:15 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:10:39 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ int lexer_word(t_list **alst, t_lexer *lexer) token = (*alst)->content; token->type = TK_WORD; + DG("lexer word"); if ((state = get_state_global(lexer))) { lexer->state = state; diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index ac3ffd25..76e2b3a5 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/02/25 18:25:11 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:34:27 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -61,6 +61,7 @@ int handle_instruction(int fd) else if (parser.state == ERROR) error_syntax(&token); token = NULL; + ast = NULL; } DG("succesful parsing:"); btree_print(STDBUG, ast, &ft_putast); diff --git a/42sh/src/parser/add_file.c b/42sh/src/parser/add_file.c index d7df98a9..c056049c 100644 --- a/42sh/src/parser/add_file.c +++ b/42sh/src/parser/add_file.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/17 16:39:05 by ariard #+# #+# */ -/* Updated: 2017/02/25 19:29:53 by ariard ### ########.fr */ +/* Updated: 2017/02/25 20:33:12 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ int isdir(t_btree **ast, t_list **list) t_token *token; token = (*list)->content; - if (ast) + if (*ast) { DG("isdir"); node = (*ast)->item; @@ -61,7 +61,9 @@ int add_redir(t_btree **ast, t_list **lst) t_token *token; t_redir *redir; - DG("add_redir"); + DG("add redir"); + if (!ast) + gen_node(ast); token = (*lst)->content; node = (*ast)->item; redir = ft_memalloc(sizeof(redir)); diff --git a/42sh/wide b/42sh/wide new file mode 100644 index 00000000..6efd26c6 --- /dev/null +++ b/42sh/wide @@ -0,0 +1 @@ +ls: ewfef: No such file or directory diff --git a/42sh/yolo b/42sh/yolo new file mode 100644 index 00000000..627968d4 --- /dev/null +++ b/42sh/yolo @@ -0,0 +1,2 @@ +ls: wefewf: No such file or directory +ls: wefewf: No such file or directory