blob: c6ad4c1670d91acd5380dc4c8c5683076bb59a58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
is_space
t_lex *lexer(char *input)
{
char **out;
int j;
int i;
i = 0;
j = 0;
if (!input)
return (0);
i = lexer_count_nb_element(input);
if (!(out = malloc(sizeof(char *) * i + 1)))
return (0);
out[i + 1] = NULL;
out = lexer_malloc_len_elem(input,i, out);
return(out);
}
t_ftlst *lexer(char *input)
{
int i;
int j;
char *temp;
enum e_token_tag token;
i = -1;
j = 0;
if (!input)
return (0);
while(input[++i])
{
if(lexer_sep(input[i]))
{
printf("%d\n", i - j);
token = ret_token_sep(input, i);
temp = malloc(sizeof(char) * i - j + 1);
ft_strlcpy(temp, &input[j], i - j);
j = i;
printf("%s\n", &input[i]);
}
}
printf("%s\n", temp);
free(temp);
return (0);
}
|