aboutsummaryrefslogtreecommitdiff
path: root/src/lexer/lexer.c
diff options
context:
space:
mode:
authornass1pro <nass1pro@gmail.com>2020-09-13 11:02:56 +0200
committernass1pro <nass1pro@gmail.com>2020-09-13 11:02:56 +0200
commit7e7219da26b9d256e451f8dddb66641d11f75434 (patch)
treeda7e2379d417e5048dd53b89c43c99e803674554 /src/lexer/lexer.c
parent708e091b756fe7e74840fee74385d339bc46bcbd (diff)
downloadminishell-7e7219da26b9d256e451f8dddb66641d11f75434.tar.gz
minishell-7e7219da26b9d256e451f8dddb66641d11f75434.tar.bz2
minishell-7e7219da26b9d256e451f8dddb66641d11f75434.zip
update lexer + \t
Diffstat (limited to 'src/lexer/lexer.c')
-rw-r--r--src/lexer/lexer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c
index 121407d..9d4b9bd 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/09/13 09:01:27 by nahaddac ### ########.fr */
+/* Updated: 2020/09/13 10:54:43 by nahaddac ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,9 +22,9 @@ int len_until_sep(char *input)
if (input[i] == '\\')
{
i += 2;
- if (input[i] == ' ')
+ if (input[i] == ' ' || input[i] == '\t')
{
- while(input[++i] == ' ')
+ while(ft_isblank(input[++i]))
;
return i;
}
@@ -36,9 +36,9 @@ int len_until_sep(char *input)
return(i);
if (input[i] == '\'' || input[i] == '"')
return(i);
- if (input[i] == ' ')
+ if (ft_isblank(input[i]))
{
- while(input[++i] == ' ')
+ while(ft_isblank(input[++i]))
;
return (i);
}
@@ -61,8 +61,8 @@ int check_input(char *input)
if (input[i] == '(' || input[i] == ')')
{
i +=1;
- if(input[i] == ' ')
- while(input[i++] != ' ')
+ if(ft_isblank(input[i]))
+ while(ft_isblank(input[i++]) != 1)
;
return (i);
}
@@ -80,9 +80,9 @@ int check_input(char *input)
}
if (input[i] == 39 || input[i] == '"')
return(lexer_check_between_quote(input, i));
- if (input[i] == ' ')
+ if (ft_isblank(input[i]))
{
- while(input[++i] == ' ')
+ while(ft_isblank(input[++i]))
;
return (i);
}
@@ -116,7 +116,7 @@ enum e_tok token_check_stick(t_tok_lst *tok)
i = ft_strlen(tok->content);
if (i > 0)
- if (tok->content[i - 1] == ' ')
+ if (ft_isblank(tok->content[i - 1]))
return (tok->tag);
return (tok->tag | TAG_STICK);
}
@@ -172,7 +172,7 @@ t_tok_lst *create_token_list(char *input, t_tok_lst **lst)
j += check_input(&input[i]);
tok = tok_lst_new_until(0, input + i, j);
push_token_enum(tok);
- if (tok->content[0] != ' ')
+ if (ft_isblank(tok->content[0]) != 1)
tok_lst_push_back(lst, tok);
i += j;
}