diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-07-20 14:55:11 +0200 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-07-20 14:55:11 +0200 |
| commit | 52bb7cc0f234776cd19c7a608b06578150d4695a (patch) | |
| tree | 2812f633709b12fd9a728ff587ac27b27e1b2ba4 /src/parse/parse.c | |
| parent | 7b9b77cbd7cfb3ffa8ac9e8ea69e01aa96179635 (diff) | |
| download | minishell-52bb7cc0f234776cd19c7a608b06578150d4695a.tar.gz minishell-52bb7cc0f234776cd19c7a608b06578150d4695a.tar.bz2 minishell-52bb7cc0f234776cd19c7a608b06578150d4695a.zip | |
update eval_cmd
Diffstat (limited to 'src/parse/parse.c')
| -rw-r--r-- | src/parse/parse.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parse/parse.c b/src/parse/parse.c index 89102bc..29b3ccb 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -6,7 +6,7 @@ /* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/17 18:09:04 by nahaddac #+# #+# */ -/* Updated: 2020/07/19 19:25:29 by charles ### ########.fr */ +/* Updated: 2020/07/20 10:26:14 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -47,6 +47,13 @@ t_ret *parse_redir(t_ftlst *input, t_ftlst **redirs) push_token(redirs, input->data); input = input->next; + if (input == NULL) + { + errorf("syntax error near unexpected token `newline'\n", NULL); + tmp = ret_wrap_ast(NULL, NULL); + tmp->syntax_error = true; + return tmp; + } tag = ((t_token *)input->data)->tag; while(input != NULL && input->next != NULL @@ -91,7 +98,7 @@ t_ret *parse_cmd(t_ftlst *input) else if (tag & TAG_IS_REDIR) { tmp = parse_redir(input, &ast->redirs); - if (tmp->syntax_error || tmp == NULL) + if (tmp == NULL || tmp->syntax_error) return tmp; input = tmp->rest; } |
