aboutsummaryrefslogtreecommitdiff
path: root/src/lexer/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer/lexer.c')
-rw-r--r--src/lexer/lexer.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c
index 185ff83..92cd34a 100644
--- a/src/lexer/lexer.c
+++ b/src/lexer/lexer.c
@@ -1,4 +1,3 @@
-
#include "lexer.h"
int len_is_not_sep(char *input)
@@ -76,16 +75,16 @@ t_token *lexer_lst_token_str(char *input, int i, int j)
if (!(lst_token = malloc(sizeof(t_token) * 1)))
return (NULL);
- lst_token->token = 0;
- lst_token->value = NULL;
- if (!(lst_token->value = malloc(sizeof(char) * j + 1)))
+ lst_token->tag = 0;
+ lst_token->content = NULL;
+ if (!(lst_token->content = malloc(sizeof(char) * j + 1)))
return(0);
- if (!(ft_strlcpy(lst_token->value, &input[i], j + 1)))
+ if (!(ft_strlcpy(lst_token->content, &input[i], j + 1)))
{
free(lst_token);
return(0);
}
- //printf("%s-\n", lst_token->value);
+ //printf("%s-\n", lst_token->content);
return (lst_token);
}
@@ -93,11 +92,11 @@ enum e_token_tag token_verif_stick(t_token *lst_token)
{
int i;
- i = ft_strlen(lst_token->value);
+ i = ft_strlen(lst_token->content);
- if (lst_token->value[i - 1] == ' ')
- return(lst_token->token);
- return(lst_token->token | LTAG_STICK);
+ if (lst_token->content[i - 1] == ' ')
+ return(lst_token->tag);
+ return(lst_token->tag | LTAG_STICK);
}
enum e_token_tag token_str_or_cote(t_token *lst_token)
@@ -105,21 +104,21 @@ enum e_token_tag token_str_or_cote(t_token *lst_token)
int i;
i = 0;
- while(lst_token->value[i] != '\0')
+ while(lst_token->content[i] != '\0')
{
- if(lst_token->value[i] == '\'')
+ if(lst_token->content[i] == '\'')
{
- lst_token->token = LTAG_STR_SINGLE;
+ lst_token->tag = LTAG_STR_SINGLE;
return(token_verif_stick(lst_token));
}
- if(lst_token->value[i] == '"')
+ if(lst_token->content[i] == '"')
{
- lst_token->token = LTAG_STR_DOUBLE;
+ lst_token->tag = LTAG_STR_DOUBLE;
return(token_verif_stick(lst_token));
}
else
{
- lst_token->token = LTAG_STR;
+ lst_token->tag = LTAG_STR;
return(token_verif_stick(lst_token));
}
i++;
@@ -131,12 +130,12 @@ t_token *push_token_enum_and_trim(t_token *lst_token)
{
enum e_token_tag tk;
- tk = ret_token(lst_token->value, 0);
+ tk = ret_token(lst_token->content, 0);
if (tk == 0)
{
- lst_token->token = token_str_or_cote(lst_token);
+ lst_token->tag = token_str_or_cote(lst_token);
}
- printf("%s-, %d\n",lst_token->value, (int)lst_token->token);
+ /* printf("%s-, %d\n",lst_token->content, (int)lst_token->tag); */
return (lst_token);
}