diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-07-18 10:57:53 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-07-19 16:10:02 +0200 |
| commit | e9a8977e3867a4a5d93e405c82acc1aac44a0678 (patch) | |
| tree | 788172fff569c8f577c36919f39a04e4564d5eb3 /src | |
| parent | ed45800a6ad9d4cfbd73832d53e4e26bb7645054 (diff) | |
| download | minishell-e9a8977e3867a4a5d93e405c82acc1aac44a0678.tar.gz minishell-e9a8977e3867a4a5d93e405c82acc1aac44a0678.tar.bz2 minishell-e9a8977e3867a4a5d93e405c82acc1aac44a0678.zip | |
Lexer update function create_token_list
Diffstat (limited to 'src')
| -rw-r--r-- | src/lexer/lexer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index 7c6d527..2e16eab 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -6,7 +6,7 @@ /* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/07/16 08:18:25 by nahaddac #+# #+# */ -/* Updated: 2020/07/18 08:58:42 by charles ### ########.fr */ +/* Updated: 2020/07/19 16:08:40 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -74,7 +74,7 @@ int check_input(char *input) { while(input[++i] == ' ') ; - return (i); + return (i); } return(len_is_not_sep(&input[i])); } @@ -142,7 +142,6 @@ t_token *push_token_enum(t_token *lst_token) enum e_token_tag tk; tk = ret_token(lst_token->content, 0); - if (tk == 0) lst_token->tag = token_str_or_cote(lst_token); else @@ -164,8 +163,11 @@ static t_ftlst *create_token_list(char *input, t_ftlst **lst) j += check_input(&input[i]); lst_token = token_new_until(0, input + i, j); lst_token = push_token_enum(lst_token); - new = ft_lstnew(lst_token); - ft_lstpush_back(lst, new); + if (lst_token->content[0] != ' ') + { + new = ft_lstnew(lst_token); + ft_lstpush_back(lst, new); + } i += j; } return (*lst); |
