|
|
@ -36,7 +36,6 @@ int create_token(t_lexer *lex, char str[]) |
|
|
|
lex->tokens = tok; |
|
|
|
else |
|
|
|
tmp->next = tok; |
|
|
|
ft_bzero(str, 1024); |
|
|
|
return (1); |
|
|
|
} |
|
|
|
|
|
|
@ -119,9 +118,10 @@ int check_state(t_lexer *lex, char **line) |
|
|
|
|
|
|
|
t_token *lexer(t_datas *datas, char *line) |
|
|
|
{ |
|
|
|
t_lexer *lex; |
|
|
|
char *tmp; |
|
|
|
int tmp_i; |
|
|
|
t_lexer *lex; |
|
|
|
t_token *ret; |
|
|
|
char *tmp; |
|
|
|
int tmp_i; |
|
|
|
|
|
|
|
lex = ft_calloc(1, sizeof *lex); |
|
|
|
lex->state = ROOT_ST; |
|
|
@ -134,12 +134,13 @@ t_token *lexer(t_datas *datas, char *line) |
|
|
|
if (lex->state != S_QUOTE_ST && *line == '$') |
|
|
|
tmp_i = replace_var(datas, &line, tmp, tmp_i); |
|
|
|
if (check_register(lex, &line, tmp)) |
|
|
|
tmp_i = 0; |
|
|
|
tmp_i = (ft_bzero(tmp, 1024), 0); |
|
|
|
else |
|
|
|
tmp[tmp_i++] = *(line++); |
|
|
|
} |
|
|
|
create_token(lex, tmp); |
|
|
|
free(tmp); |
|
|
|
ret = lex->tokens; |
|
|
|
free(lex); |
|
|
|
return (lex->tokens); |
|
|
|
return (ret); |
|
|
|
} |
|
|
|