diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-06-09 19:48:34 +0200 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-06-13 11:31:00 +0200 |
| commit | 579a26f5593039ffbbd1a81e45ecf0ef8797cb5d (patch) | |
| tree | c5b6761db98e27d15bab3fb45ba9e0a646cf06e0 /test_mini/speudo_code | |
| parent | 9fabc25a980550afc6337fd729632462f2680daa (diff) | |
| download | minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.tar.gz minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.tar.bz2 minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.zip | |
add lexer
add single quote
Diffstat (limited to 'test_mini/speudo_code')
| -rw-r--r-- | test_mini/speudo_code | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test_mini/speudo_code b/test_mini/speudo_code new file mode 100644 index 0000000..c6ad4c1 --- /dev/null +++ b/test_mini/speudo_code @@ -0,0 +1,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); +} |
