From c5cde6afd3cecb44bbe9da0c28d970524da80228 Mon Sep 17 00:00:00 2001 From: nass1pro Date: Fri, 12 Jun 2020 10:12:03 +0200 Subject: probleme token ok reste trim and exception ok --- include/lexer.h | 38 + src/lexer/.DS_Store | Bin 0 -> 6148 bytes src/lexer/lexer.c | 178 ++ src/lexer/lexer_utils.c | 89 + test_mini/a.out | Bin 17828 -> 0 bytes test_mini/cat | 36 - test_mini/lexer.c | 140 -- test_mini/lexer.h | 37 - test_mini/lexer_utils.c | 88 - test_mini/libft/.gitignore | 11 - test_mini/libft/.libftignore | 1 - test_mini/libft/.travis.yml | 4 - test_mini/libft/Doxyfile | 2503 -------------------- test_mini/libft/LICENSE | 21 - test_mini/libft/Makefile | 97 - test_mini/libft/README.md | 37 - test_mini/libft/include/libft.h | 34 - test_mini/libft/include/libft_algo.h | 59 - test_mini/libft/include/libft_bt.h | 28 - test_mini/libft/include/libft_ctype.h | 36 - test_mini/libft/include/libft_ht.h | 71 - test_mini/libft/include/libft_io.h | 46 - test_mini/libft/include/libft_lst.h | 65 - test_mini/libft/include/libft_mem.h | 39 - test_mini/libft/include/libft_printf.h | 27 - test_mini/libft/include/libft_str.h | 87 - test_mini/libft/include/libft_types.h | 30 - test_mini/libft/include/libft_util.h | 20 - test_mini/libft/include/libft_vec.h | 47 - test_mini/libft/script/find_src.sh | 20 - .../libft/script/generate_boilerplate_test.sh | 9 - test_mini/libft/script/generate_rendu.sh | 26 - test_mini/libft/script/generate_rendu_makefile.sh | 5 - test_mini/libft/script/template.makefile | 38 - test_mini/libft/script/test.sh | 14 - test_mini/libft/src/algo/ft_bsearch.c | 32 - test_mini/libft/src/algo/ft_compar_int.c | 18 - test_mini/libft/src/algo/ft_heapsort.c | 54 - test_mini/libft/src/algo/ft_is_set.c | 32 - test_mini/libft/src/algo/ft_lfind.c | 28 - test_mini/libft/src/algo/ft_lsearch.c | 23 - test_mini/libft/src/algo/ft_mergesort.c | 76 - test_mini/libft/src/algo/ft_qsort.c | 64 - test_mini/libft/src/algo/ft_reverse.c | 27 - test_mini/libft/src/bt/ft_btdestroy.c | 23 - test_mini/libft/src/bt/ft_btnew.c | 25 - test_mini/libft/src/ctype/ft_isalnum.c | 18 - test_mini/libft/src/ctype/ft_isalpha.c | 16 - test_mini/libft/src/ctype/ft_isascii.c | 16 - test_mini/libft/src/ctype/ft_isblank.c | 16 - test_mini/libft/src/ctype/ft_isdigit.c | 16 - test_mini/libft/src/ctype/ft_isprint.c | 16 - test_mini/libft/src/ctype/ft_isspace.c | 19 - test_mini/libft/src/ctype/ft_todigit.c | 20 - test_mini/libft/src/ctype/ft_tolower.c | 24 - test_mini/libft/src/ctype/ft_toupper.c | 20 - test_mini/libft/src/ht/ft_htdelone.c | 29 - test_mini/libft/src/ht/ft_htdestroy.c | 30 - test_mini/libft/src/ht/ft_htentry_new.c | 37 - test_mini/libft/src/ht/ft_htget.c | 35 - test_mini/libft/src/ht/ft_hthash.c | 36 - test_mini/libft/src/ht/ft_htiter.c | 31 - test_mini/libft/src/ht/ft_htnew.c | 38 - test_mini/libft/src/ht/ft_htset.c | 56 - test_mini/libft/src/ht/ft_inter_htkey_cmp.c | 25 - test_mini/libft/src/io/ft_getchar.c | 22 - test_mini/libft/src/io/ft_next_line.c | 113 - test_mini/libft/src/io/ft_printf/ft_asprintf.c | 24 - test_mini/libft/src/io/ft_printf/ft_dprintf.c | 24 - test_mini/libft/src/io/ft_printf/ft_printf.c | 24 - test_mini/libft/src/io/ft_printf/ft_snprintf.c | 24 - test_mini/libft/src/io/ft_printf/ft_sprintf.c | 24 - test_mini/libft/src/io/ft_printf/ft_vasprintf.c | 21 - test_mini/libft/src/io/ft_printf/ft_vasprintf.h | 155 -- test_mini/libft/src/io/ft_printf/ft_vdprintf.c | 24 - test_mini/libft/src/io/ft_printf/ft_vprintf.c | 18 - test_mini/libft/src/io/ft_printf/ft_vsnprintf.c | 26 - test_mini/libft/src/io/ft_printf/ft_vsprintf.c | 18 - .../libft/src/io/ft_printf/internals/convert.c | 122 - .../src/io/ft_printf/internals/convert_char.c | 53 - .../libft/src/io/ft_printf/internals/convert_hex.c | 34 - .../libft/src/io/ft_printf/internals/convert_int.c | 40 - .../src/io/ft_printf/internals/convert_none.c | 25 - .../src/io/ft_printf/internals/convert_percent.c | 23 - .../libft/src/io/ft_printf/internals/convert_ptr.c | 29 - .../libft/src/io/ft_printf/internals/convert_str.c | 25 - .../src/io/ft_printf/internals/convert_uint.c | 34 - .../src/io/ft_printf/internals/convert_written.c | 28 - .../libft/src/io/ft_printf/internals/extract.c | 98 - .../src/io/ft_printf/internals/length_modifier.c | 39 - test_mini/libft/src/io/ft_printf/internals/list.c | 67 - test_mini/libft/src/io/ft_printf/internals/parse.c | 61 - test_mini/libft/src/io/ft_printf/internals/utils.c | 115 - test_mini/libft/src/io/ft_putchar.c | 18 - test_mini/libft/src/io/ft_putchar_fd.c | 20 - test_mini/libft/src/io/ft_putendl.c | 18 - test_mini/libft/src/io/ft_putendl_fd.c | 21 - test_mini/libft/src/io/ft_putnbr.c | 18 - test_mini/libft/src/io/ft_putnbr_fd.c | 30 - test_mini/libft/src/io/ft_putstr.c | 18 - test_mini/libft/src/io/ft_putstr_fd.c | 20 - test_mini/libft/src/lst/ft_lstbsearch.c | 65 - test_mini/libft/src/lst/ft_lstdelone.c | 27 - test_mini/libft/src/lst/ft_lstdestroy.c | 29 - test_mini/libft/src/lst/ft_lstiter.c | 29 - test_mini/libft/src/lst/ft_lstlast.c | 27 - test_mini/libft/src/lst/ft_lstlfind.c | 22 - test_mini/libft/src/lst/ft_lstlsearch.c | 27 - test_mini/libft/src/lst/ft_lstmap.c | 56 - test_mini/libft/src/lst/ft_lstnew.c | 29 - test_mini/libft/src/lst/ft_lstpop_front.c | 29 - test_mini/libft/src/lst/ft_lstpush_back.c | 30 - test_mini/libft/src/lst/ft_lstpush_front.c | 26 - test_mini/libft/src/lst/ft_lstremove_if.c | 38 - test_mini/libft/src/lst/ft_lstreverse.c | 22 - test_mini/libft/src/lst/ft_lstreverse_ret.c | 32 - test_mini/libft/src/lst/ft_lstsize.c | 31 - test_mini/libft/src/lst/ft_lstsort.c | 46 - test_mini/libft/src/lst/ft_lstsorted_merge.c | 43 - test_mini/libft/src/mem/ft_bzero.c | 18 - test_mini/libft/src/mem/ft_calloc.c | 23 - test_mini/libft/src/mem/ft_memalloc.c | 18 - test_mini/libft/src/mem/ft_memccpy.c | 31 - test_mini/libft/src/mem/ft_memchr.c | 26 - test_mini/libft/src/mem/ft_memcmp.c | 30 - test_mini/libft/src/mem/ft_memcpy.c | 33 - test_mini/libft/src/mem/ft_memdel.c | 21 - test_mini/libft/src/mem/ft_memmem.c | 58 - test_mini/libft/src/mem/ft_memmove.c | 35 - test_mini/libft/src/mem/ft_memset.c | 31 - test_mini/libft/src/mem/ft_memset_pattern4.c | 26 - test_mini/libft/src/mem/ft_memswap.c | 29 - test_mini/libft/src/str/ft_atoi.c | 22 - test_mini/libft/src/str/ft_atoi_strict.c | 38 - test_mini/libft/src/str/ft_itoa.c | 40 - test_mini/libft/src/str/ft_split.c | 73 - test_mini/libft/src/str/ft_strcasecmp.c | 24 - test_mini/libft/src/str/ft_strcat.c | 19 - test_mini/libft/src/str/ft_strchr.c | 18 - test_mini/libft/src/str/ft_strclr.c | 20 - test_mini/libft/src/str/ft_strcmp.c | 23 - test_mini/libft/src/str/ft_strcount.c | 24 - test_mini/libft/src/str/ft_strcpy.c | 18 - test_mini/libft/src/str/ft_strcspn.c | 23 - test_mini/libft/src/str/ft_strdel.c | 18 - test_mini/libft/src/str/ft_strdup.c | 22 - test_mini/libft/src/str/ft_strequ.c | 20 - test_mini/libft/src/str/ft_striter.c | 21 - test_mini/libft/src/str/ft_striteri.c | 27 - test_mini/libft/src/str/ft_strjoin.c | 25 - test_mini/libft/src/str/ft_strjoin3.c | 36 - test_mini/libft/src/str/ft_strjoinf.c | 35 - test_mini/libft/src/str/ft_strlcat.c | 32 - test_mini/libft/src/str/ft_strlcpy.c | 28 - test_mini/libft/src/str/ft_strlen.c | 41 - test_mini/libft/src/str/ft_strmap.c | 34 - test_mini/libft/src/str/ft_strmapi.c | 34 - test_mini/libft/src/str/ft_strncasecmp.c | 26 - test_mini/libft/src/str/ft_strncat.c | 29 - test_mini/libft/src/str/ft_strncmp.c | 26 - test_mini/libft/src/str/ft_strncpy.c | 24 - test_mini/libft/src/str/ft_strndup.c | 23 - test_mini/libft/src/str/ft_strnequ.c | 20 - test_mini/libft/src/str/ft_strnew.c | 18 - test_mini/libft/src/str/ft_strnlen.c | 25 - test_mini/libft/src/str/ft_strnstr.c | 29 - test_mini/libft/src/str/ft_strpbrk.c | 24 - test_mini/libft/src/str/ft_strrchr.c | 24 - test_mini/libft/src/str/ft_strsep.c | 27 - test_mini/libft/src/str/ft_strspn.c | 23 - test_mini/libft/src/str/ft_strstr.c | 29 - test_mini/libft/src/str/ft_strtol.c | 80 - test_mini/libft/src/str/ft_strtolower.c | 26 - test_mini/libft/src/str/ft_strtoupper.c | 26 - test_mini/libft/src/str/ft_strtrim.c | 31 - test_mini/libft/src/str/ft_substr.c | 26 - test_mini/libft/src/util/ft_split_destroy.c | 24 - test_mini/libft/src/vec/ft_vecdestroy.c | 29 - test_mini/libft/src/vec/ft_vecgrow.c | 43 - test_mini/libft/src/vec/ft_veciter.c | 31 - test_mini/libft/src/vec/ft_vecnew.c | 38 - test_mini/libft/src/vec/ft_vecpop.c | 28 - test_mini/libft/src/vec/ft_vecpush.c | 30 - test_mini/libft/src/vec/ft_vecremove.c | 31 - test_mini/libft/subject.pdf | Bin 1657956 -> 0 bytes test_mini/libft/test/Makefile | 79 - .../libft/test/include/helper/helper_segfault.h | 20 - test_mini/libft/test/include/libft_test.h | 27 - test_mini/libft/test/src/algo/test_ft_bsearch.c | 55 - test_mini/libft/test/src/algo/test_ft_compar_int.c | 20 - test_mini/libft/test/src/algo/test_ft_heapsort.c | 27 - test_mini/libft/test/src/algo/test_ft_is_set.c | 23 - test_mini/libft/test/src/algo/test_ft_lfind.c | 38 - test_mini/libft/test/src/algo/test_ft_lsearch.c | 52 - test_mini/libft/test/src/algo/test_ft_mergesort.c | 26 - test_mini/libft/test/src/algo/test_ft_qsort.c | 26 - test_mini/libft/test/src/algo/test_ft_reverse.c | 19 - test_mini/libft/test/src/ctype/test_ft_isalnum.c | 15 - test_mini/libft/test/src/ctype/test_ft_isalpha.c | 15 - test_mini/libft/test/src/ctype/test_ft_isascii.c | 15 - test_mini/libft/test/src/ctype/test_ft_isblank.c | 15 - test_mini/libft/test/src/ctype/test_ft_isdigit.c | 15 - test_mini/libft/test/src/ctype/test_ft_isprint.c | 15 - test_mini/libft/test/src/ctype/test_ft_isspace.c | 15 - test_mini/libft/test/src/ctype/test_ft_todigit.c | 20 - test_mini/libft/test/src/ctype/test_ft_tolower.c | 15 - test_mini/libft/test/src/ctype/test_ft_toupper.c | 15 - test_mini/libft/test/src/ht/test_ft_htdelone.c | 68 - test_mini/libft/test/src/ht/test_ft_htdestroy.c | 38 - test_mini/libft/test/src/ht/test_ft_htget.c | 114 - test_mini/libft/test/src/ht/test_ft_hthash.c | 0 test_mini/libft/test/src/ht/test_ft_htnew.c | 48 - test_mini/libft/test/src/ht/test_ft_htset.c | 100 - test_mini/libft/test/src/ht/test_ftht_entry_new.c | 43 - test_mini/libft/test/src/lst/test_ft_lstbsearch.c | 37 - test_mini/libft/test/src/lst/test_ft_lstdelone.c | 26 - test_mini/libft/test/src/lst/test_ft_lstdestroy.c | 14 - test_mini/libft/test/src/lst/test_ft_lstiter.c | 52 - test_mini/libft/test/src/lst/test_ft_lstlast.c | 29 - test_mini/libft/test/src/lst/test_ft_lstlfind.c | 55 - test_mini/libft/test/src/lst/test_ft_lstlsearch.c | 55 - test_mini/libft/test/src/lst/test_ft_lstmap.c | 82 - test_mini/libft/test/src/lst/test_ft_lstnew.c | 25 - .../libft/test/src/lst/test_ft_lstpop_front.c | 31 - .../libft/test/src/lst/test_ft_lstpush_back.c | 41 - .../libft/test/src/lst/test_ft_lstpush_front.c | 41 - .../libft/test/src/lst/test_ft_lstremove_if.c | 70 - test_mini/libft/test/src/lst/test_ft_lstreverse.c | 45 - .../libft/test/src/lst/test_ft_lstreverse_ret.c | 45 - test_mini/libft/test/src/lst/test_ft_lstsize.c | 37 - test_mini/libft/test/src/lst/test_ft_lstsort.c | 38 - .../libft/test/src/lst/test_ft_lstsorted_merge.c | 40 - test_mini/libft/test/src/main.c | 85 - test_mini/libft/test/src/mem/test_ft_bzero.c | 30 - test_mini/libft/test/src/mem/test_ft_calloc.c | 33 - test_mini/libft/test/src/mem/test_ft_memccpy.c | 45 - test_mini/libft/test/src/mem/test_ft_memchr.c | 35 - test_mini/libft/test/src/mem/test_ft_memcmp.c | 42 - test_mini/libft/test/src/mem/test_ft_memcpy.c | 47 - test_mini/libft/test/src/mem/test_ft_memmem.c | 65 - test_mini/libft/test/src/mem/test_ft_memmove.c | 39 - test_mini/libft/test/src/mem/test_ft_memset.c | 42 - .../libft/test/src/mem/test_ft_memset_pattern4.c | 42 - test_mini/libft/test/src/mem/test_ft_memswap.c | 41 - test_mini/libft/test/src/runner/test_runner_algo.c | 59 - .../libft/test/src/runner/test_runner_ctype.c | 64 - test_mini/libft/test/src/runner/test_runner_ht.c | 51 - test_mini/libft/test/src/runner/test_runner_lst.c | 103 - test_mini/libft/test/src/runner/test_runner_mem.c | 69 - test_mini/libft/test/src/runner/test_runner_str.c | 6 - test_mini/libft/test/src/runner/test_runner_vec.c | 50 - test_mini/libft/test/src/str/test_ft_strlen.c | 24 - test_mini/libft/test/src/vec/test_ft_vecdestroy.c | 26 - test_mini/libft/test/src/vec/test_ft_vecgrow.c | 47 - test_mini/libft/test/src/vec/test_ft_veciter.c | 52 - test_mini/libft/test/src/vec/test_ft_vecnew.c | 47 - test_mini/libft/test/src/vec/test_ft_vecpop.c | 47 - test_mini/libft/test/src/vec/test_ft_vecpush.c | 57 - test_mini/libft/test/src/vec/test_ft_vecremove.c | 64 - test_mini/libft/vendor/_unity/LICENSE.txt | 21 - test_mini/libft/vendor/_unity/Makefile | 41 - test_mini/libft/vendor/_unity/README.md | 191 -- test_mini/libft/vendor/_unity/include/unity.h | 617 ----- .../libft/vendor/_unity/include/unity_fixture.h | 83 - .../_unity/include/unity_fixture_internals.h | 50 - .../libft/vendor/_unity/include/unity_internals.h | 1007 -------- .../libft/vendor/_unity/include/unity_memory.h | 60 - test_mini/libft/vendor/_unity/src/unity.c | 2088 ---------------- test_mini/libft/vendor/_unity/src/unity_fixture.c | 310 --- test_mini/libft/vendor/_unity/unity_memory.c | 202 -- test_mini/main.c | 34 - test_mini/parse/parse.c | 25 - test_mini/parse/parse.h | 89 - test_mini/parse/utils_parse.c | 35 - test_mini/speudo_code | 15 - 275 files changed, 305 insertions(+), 16462 deletions(-) create mode 100644 include/lexer.h create mode 100644 src/lexer/.DS_Store create mode 100644 src/lexer/lexer.c create mode 100644 src/lexer/lexer_utils.c delete mode 100755 test_mini/a.out delete mode 100644 test_mini/cat delete mode 100644 test_mini/lexer.c delete mode 100644 test_mini/lexer.h delete mode 100644 test_mini/lexer_utils.c delete mode 100644 test_mini/libft/.gitignore delete mode 100644 test_mini/libft/.libftignore delete mode 100644 test_mini/libft/.travis.yml delete mode 100644 test_mini/libft/Doxyfile delete mode 100644 test_mini/libft/LICENSE delete mode 100644 test_mini/libft/Makefile delete mode 100644 test_mini/libft/README.md delete mode 100644 test_mini/libft/include/libft.h delete mode 100644 test_mini/libft/include/libft_algo.h delete mode 100644 test_mini/libft/include/libft_bt.h delete mode 100644 test_mini/libft/include/libft_ctype.h delete mode 100644 test_mini/libft/include/libft_ht.h delete mode 100644 test_mini/libft/include/libft_io.h delete mode 100644 test_mini/libft/include/libft_lst.h delete mode 100644 test_mini/libft/include/libft_mem.h delete mode 100644 test_mini/libft/include/libft_printf.h delete mode 100644 test_mini/libft/include/libft_str.h delete mode 100644 test_mini/libft/include/libft_types.h delete mode 100644 test_mini/libft/include/libft_util.h delete mode 100644 test_mini/libft/include/libft_vec.h delete mode 100755 test_mini/libft/script/find_src.sh delete mode 100755 test_mini/libft/script/generate_boilerplate_test.sh delete mode 100755 test_mini/libft/script/generate_rendu.sh delete mode 100644 test_mini/libft/script/generate_rendu_makefile.sh delete mode 100644 test_mini/libft/script/template.makefile delete mode 100644 test_mini/libft/script/test.sh delete mode 100644 test_mini/libft/src/algo/ft_bsearch.c delete mode 100644 test_mini/libft/src/algo/ft_compar_int.c delete mode 100644 test_mini/libft/src/algo/ft_heapsort.c delete mode 100644 test_mini/libft/src/algo/ft_is_set.c delete mode 100644 test_mini/libft/src/algo/ft_lfind.c delete mode 100644 test_mini/libft/src/algo/ft_lsearch.c delete mode 100644 test_mini/libft/src/algo/ft_mergesort.c delete mode 100644 test_mini/libft/src/algo/ft_qsort.c delete mode 100644 test_mini/libft/src/algo/ft_reverse.c delete mode 100644 test_mini/libft/src/bt/ft_btdestroy.c delete mode 100644 test_mini/libft/src/bt/ft_btnew.c delete mode 100644 test_mini/libft/src/ctype/ft_isalnum.c delete mode 100644 test_mini/libft/src/ctype/ft_isalpha.c delete mode 100644 test_mini/libft/src/ctype/ft_isascii.c delete mode 100644 test_mini/libft/src/ctype/ft_isblank.c delete mode 100644 test_mini/libft/src/ctype/ft_isdigit.c delete mode 100644 test_mini/libft/src/ctype/ft_isprint.c delete mode 100644 test_mini/libft/src/ctype/ft_isspace.c delete mode 100644 test_mini/libft/src/ctype/ft_todigit.c delete mode 100644 test_mini/libft/src/ctype/ft_tolower.c delete mode 100644 test_mini/libft/src/ctype/ft_toupper.c delete mode 100644 test_mini/libft/src/ht/ft_htdelone.c delete mode 100644 test_mini/libft/src/ht/ft_htdestroy.c delete mode 100644 test_mini/libft/src/ht/ft_htentry_new.c delete mode 100644 test_mini/libft/src/ht/ft_htget.c delete mode 100644 test_mini/libft/src/ht/ft_hthash.c delete mode 100644 test_mini/libft/src/ht/ft_htiter.c delete mode 100644 test_mini/libft/src/ht/ft_htnew.c delete mode 100644 test_mini/libft/src/ht/ft_htset.c delete mode 100644 test_mini/libft/src/ht/ft_inter_htkey_cmp.c delete mode 100644 test_mini/libft/src/io/ft_getchar.c delete mode 100644 test_mini/libft/src/io/ft_next_line.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_asprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_dprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_printf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_snprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_sprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vasprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vasprintf.h delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vdprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vsnprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vsprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_char.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_hex.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_int.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_none.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_percent.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_ptr.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_str.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_uint.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_written.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/extract.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/length_modifier.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/list.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/parse.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/utils.c delete mode 100644 test_mini/libft/src/io/ft_putchar.c delete mode 100644 test_mini/libft/src/io/ft_putchar_fd.c delete mode 100644 test_mini/libft/src/io/ft_putendl.c delete mode 100644 test_mini/libft/src/io/ft_putendl_fd.c delete mode 100644 test_mini/libft/src/io/ft_putnbr.c delete mode 100644 test_mini/libft/src/io/ft_putnbr_fd.c delete mode 100644 test_mini/libft/src/io/ft_putstr.c delete mode 100644 test_mini/libft/src/io/ft_putstr_fd.c delete mode 100644 test_mini/libft/src/lst/ft_lstbsearch.c delete mode 100644 test_mini/libft/src/lst/ft_lstdelone.c delete mode 100644 test_mini/libft/src/lst/ft_lstdestroy.c delete mode 100644 test_mini/libft/src/lst/ft_lstiter.c delete mode 100644 test_mini/libft/src/lst/ft_lstlast.c delete mode 100644 test_mini/libft/src/lst/ft_lstlfind.c delete mode 100644 test_mini/libft/src/lst/ft_lstlsearch.c delete mode 100644 test_mini/libft/src/lst/ft_lstmap.c delete mode 100644 test_mini/libft/src/lst/ft_lstnew.c delete mode 100644 test_mini/libft/src/lst/ft_lstpop_front.c delete mode 100644 test_mini/libft/src/lst/ft_lstpush_back.c delete mode 100644 test_mini/libft/src/lst/ft_lstpush_front.c delete mode 100644 test_mini/libft/src/lst/ft_lstremove_if.c delete mode 100644 test_mini/libft/src/lst/ft_lstreverse.c delete mode 100644 test_mini/libft/src/lst/ft_lstreverse_ret.c delete mode 100644 test_mini/libft/src/lst/ft_lstsize.c delete mode 100644 test_mini/libft/src/lst/ft_lstsort.c delete mode 100644 test_mini/libft/src/lst/ft_lstsorted_merge.c delete mode 100644 test_mini/libft/src/mem/ft_bzero.c delete mode 100644 test_mini/libft/src/mem/ft_calloc.c delete mode 100644 test_mini/libft/src/mem/ft_memalloc.c delete mode 100644 test_mini/libft/src/mem/ft_memccpy.c delete mode 100644 test_mini/libft/src/mem/ft_memchr.c delete mode 100644 test_mini/libft/src/mem/ft_memcmp.c delete mode 100644 test_mini/libft/src/mem/ft_memcpy.c delete mode 100644 test_mini/libft/src/mem/ft_memdel.c delete mode 100644 test_mini/libft/src/mem/ft_memmem.c delete mode 100644 test_mini/libft/src/mem/ft_memmove.c delete mode 100644 test_mini/libft/src/mem/ft_memset.c delete mode 100644 test_mini/libft/src/mem/ft_memset_pattern4.c delete mode 100644 test_mini/libft/src/mem/ft_memswap.c delete mode 100644 test_mini/libft/src/str/ft_atoi.c delete mode 100644 test_mini/libft/src/str/ft_atoi_strict.c delete mode 100644 test_mini/libft/src/str/ft_itoa.c delete mode 100644 test_mini/libft/src/str/ft_split.c delete mode 100644 test_mini/libft/src/str/ft_strcasecmp.c delete mode 100644 test_mini/libft/src/str/ft_strcat.c delete mode 100644 test_mini/libft/src/str/ft_strchr.c delete mode 100644 test_mini/libft/src/str/ft_strclr.c delete mode 100644 test_mini/libft/src/str/ft_strcmp.c delete mode 100644 test_mini/libft/src/str/ft_strcount.c delete mode 100644 test_mini/libft/src/str/ft_strcpy.c delete mode 100644 test_mini/libft/src/str/ft_strcspn.c delete mode 100644 test_mini/libft/src/str/ft_strdel.c delete mode 100644 test_mini/libft/src/str/ft_strdup.c delete mode 100644 test_mini/libft/src/str/ft_strequ.c delete mode 100644 test_mini/libft/src/str/ft_striter.c delete mode 100644 test_mini/libft/src/str/ft_striteri.c delete mode 100644 test_mini/libft/src/str/ft_strjoin.c delete mode 100644 test_mini/libft/src/str/ft_strjoin3.c delete mode 100644 test_mini/libft/src/str/ft_strjoinf.c delete mode 100644 test_mini/libft/src/str/ft_strlcat.c delete mode 100644 test_mini/libft/src/str/ft_strlcpy.c delete mode 100644 test_mini/libft/src/str/ft_strlen.c delete mode 100644 test_mini/libft/src/str/ft_strmap.c delete mode 100644 test_mini/libft/src/str/ft_strmapi.c delete mode 100644 test_mini/libft/src/str/ft_strncasecmp.c delete mode 100644 test_mini/libft/src/str/ft_strncat.c delete mode 100644 test_mini/libft/src/str/ft_strncmp.c delete mode 100644 test_mini/libft/src/str/ft_strncpy.c delete mode 100644 test_mini/libft/src/str/ft_strndup.c delete mode 100644 test_mini/libft/src/str/ft_strnequ.c delete mode 100644 test_mini/libft/src/str/ft_strnew.c delete mode 100644 test_mini/libft/src/str/ft_strnlen.c delete mode 100644 test_mini/libft/src/str/ft_strnstr.c delete mode 100644 test_mini/libft/src/str/ft_strpbrk.c delete mode 100644 test_mini/libft/src/str/ft_strrchr.c delete mode 100644 test_mini/libft/src/str/ft_strsep.c delete mode 100644 test_mini/libft/src/str/ft_strspn.c delete mode 100644 test_mini/libft/src/str/ft_strstr.c delete mode 100644 test_mini/libft/src/str/ft_strtol.c delete mode 100644 test_mini/libft/src/str/ft_strtolower.c delete mode 100644 test_mini/libft/src/str/ft_strtoupper.c delete mode 100644 test_mini/libft/src/str/ft_strtrim.c delete mode 100644 test_mini/libft/src/str/ft_substr.c delete mode 100644 test_mini/libft/src/util/ft_split_destroy.c delete mode 100644 test_mini/libft/src/vec/ft_vecdestroy.c delete mode 100644 test_mini/libft/src/vec/ft_vecgrow.c delete mode 100644 test_mini/libft/src/vec/ft_veciter.c delete mode 100644 test_mini/libft/src/vec/ft_vecnew.c delete mode 100644 test_mini/libft/src/vec/ft_vecpop.c delete mode 100644 test_mini/libft/src/vec/ft_vecpush.c delete mode 100644 test_mini/libft/src/vec/ft_vecremove.c delete mode 100644 test_mini/libft/subject.pdf delete mode 100644 test_mini/libft/test/Makefile delete mode 100644 test_mini/libft/test/include/helper/helper_segfault.h delete mode 100644 test_mini/libft/test/include/libft_test.h delete mode 100644 test_mini/libft/test/src/algo/test_ft_bsearch.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_compar_int.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_heapsort.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_is_set.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_lfind.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_lsearch.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_mergesort.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_qsort.c delete mode 100644 test_mini/libft/test/src/algo/test_ft_reverse.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isalnum.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isalpha.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isascii.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isblank.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isdigit.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isprint.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_isspace.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_todigit.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_tolower.c delete mode 100644 test_mini/libft/test/src/ctype/test_ft_toupper.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_htdelone.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_htdestroy.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_htget.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_hthash.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_htnew.c delete mode 100644 test_mini/libft/test/src/ht/test_ft_htset.c delete mode 100644 test_mini/libft/test/src/ht/test_ftht_entry_new.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstbsearch.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstdelone.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstdestroy.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstiter.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstlast.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstlfind.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstlsearch.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstmap.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstnew.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstpop_front.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstpush_back.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstpush_front.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstremove_if.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstreverse.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstreverse_ret.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstsize.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstsort.c delete mode 100644 test_mini/libft/test/src/lst/test_ft_lstsorted_merge.c delete mode 100644 test_mini/libft/test/src/main.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_bzero.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_calloc.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memccpy.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memchr.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memcmp.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memcpy.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memmem.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memmove.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memset.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memset_pattern4.c delete mode 100644 test_mini/libft/test/src/mem/test_ft_memswap.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_algo.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_ctype.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_ht.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_lst.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_mem.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_str.c delete mode 100644 test_mini/libft/test/src/runner/test_runner_vec.c delete mode 100644 test_mini/libft/test/src/str/test_ft_strlen.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecdestroy.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecgrow.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_veciter.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecnew.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecpop.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecpush.c delete mode 100644 test_mini/libft/test/src/vec/test_ft_vecremove.c delete mode 100644 test_mini/libft/vendor/_unity/LICENSE.txt delete mode 100644 test_mini/libft/vendor/_unity/Makefile delete mode 100644 test_mini/libft/vendor/_unity/README.md delete mode 100644 test_mini/libft/vendor/_unity/include/unity.h delete mode 100644 test_mini/libft/vendor/_unity/include/unity_fixture.h delete mode 100644 test_mini/libft/vendor/_unity/include/unity_fixture_internals.h delete mode 100644 test_mini/libft/vendor/_unity/include/unity_internals.h delete mode 100644 test_mini/libft/vendor/_unity/include/unity_memory.h delete mode 100644 test_mini/libft/vendor/_unity/src/unity.c delete mode 100644 test_mini/libft/vendor/_unity/src/unity_fixture.c delete mode 100644 test_mini/libft/vendor/_unity/unity_memory.c delete mode 100644 test_mini/main.c delete mode 100644 test_mini/parse/parse.c delete mode 100644 test_mini/parse/parse.h delete mode 100644 test_mini/parse/utils_parse.c delete mode 100644 test_mini/speudo_code diff --git a/include/lexer.h b/include/lexer.h new file mode 100644 index 0000000..694b09d --- /dev/null +++ b/include/lexer.h @@ -0,0 +1,38 @@ + +# include +# include +# include "libft_lst.h" +# include "libft_str.h" + + +enum e_token_tag +{ + LTAG_AND = 1 << 0, + LTAG_END = 1 << 1, + LTAG_OR = 1 << 2, + LTAG_PIPE = 1 << 3, + LTAG_REDIR_IN = 1 << 4, + LTAG_REDIR_OUT = 1 << 5, + LTAG_REDIR_APPEND = 1 << 6, + LTAG_PARENT_OPEN = 1 << 7, + LTAG_PARENT_CLOSE = 1 << 8, + LTAG_STR = 1 << 9, + LTAG_STR_DOUBLE = 1 << 10, + LTAG_STR_SINGLE = 1 << 11, + LTAG_STICK = 1 << 12, +}; + +typedef struct s_token +{ + enum e_token_tag token; + char *value; + +} t_token; + +t_ftlst *lexer(char *input); +enum e_token_tag ret_token(char *input, int i); +enum e_token_tag ret_token_sep_redir_append(char *input, int i); + +int lexer_sep(char input); +int lexer_verif_entre_cote(char *input, int i); +int lexe_space(char *input); diff --git a/src/lexer/.DS_Store b/src/lexer/.DS_Store new file mode 100644 index 0000000..fcaf8ef Binary files /dev/null and b/src/lexer/.DS_Store differ diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c new file mode 100644 index 0000000..994ea55 --- /dev/null +++ b/src/lexer/lexer.c @@ -0,0 +1,178 @@ + +#include "lexer.h" + +int len_is_not_sep(char *input) +{ + int i; + + i = -1; + while(input[++i]) + { + if (lexer_sep(input[i])) + { + if (input[i + 1] == ' ') + while(input[++i] == ' ') + ; + return(i); + } + if (input[i] == '\'' || input[i] == '"') + return(i); + if (input[i] == ' ') + { + while(input[++i] == ' ') + ; + return (i); + } + } + return(i); +} + +int check_input(char *input) +{ + int i; + + i = 0; + if (lexer_sep(input[i])) + { + while(input[i] == input[i + 1]) + i++; + i += lexe_space(&input[i + 1]); + return (i + 1); + } + if (input[i] == 39 || input[i] == '"') + return(lexer_verif_entre_cote(input, i)); + if (input[i] == ' ') + { + while(input[++i] == ' ') + ; + return (i); + } + return(len_is_not_sep(&input[i])); +} + + +int check_input_out(char *input) +{ + int i; + int j; + + i = 0; + while(input[i] != '\0') + { + j = 0; + j += len_is_not_sep(&input[i]); + if (j != 0) + return(j); + i += j; + j = check_input(&input[i]); + return(j); + } + return(0); +} + +t_token *lexer_lst_token_str(char *input, int i, int j) +{ + t_token *lst_token; + + 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))) + return(0); + if (!(ft_strlcpy(lst_token->value, &input[i], j + 1))) + { + free(lst_token); + return(0); + } + //printf("%s-\n", lst_token->value); + return (lst_token); +} + +enum e_token_tag token_verif_stick(t_token *lst_token) +{ + int i; + + i = ft_strlen(lst_token->value); + + if (lst_token->value[i - 1] == ' ') + return(lst_token->token); + return(lst_token->token | LTAG_STICK); +} + +enum e_token_tag token_str_or_cote(t_token *lst_token) +{ + int i; + + i = 0; + while(lst_token->value[i] != '\0') + { + if(lst_token->value[i] == '\'') + { + lst_token->token = LTAG_STR_SINGLE; + return(token_verif_stick(lst_token)); + } + if(lst_token->value[i] == '"') + { + lst_token->token = LTAG_STR_DOUBLE; + return(token_verif_stick(lst_token)); + } + else + { + lst_token->token = LTAG_STR; + return(token_verif_stick(lst_token)); + } + i++; + } + return(0); +} + +t_token *push_token_enum_and_trim(t_token *lst_token) +{ + enum e_token_tag tk; + + tk = ret_token(lst_token->value, 0); + if (tk == 0) + { + lst_token->token = token_str_or_cote(lst_token); + } + printf("%s-, %d\n",lst_token->value, (int)lst_token->token); + return (lst_token); +} + +static t_ftlst *create_token_list(char *input, t_ftlst **lst) +{ + t_token *lst_token; + t_ftlst *new; + int i; + int j; + + i = 0; + while (i < (int)ft_strlen(input)) + { + j = 0; + j += check_input(&input[i]); + lst_token = lexer_lst_token_str(input,i,j); + lst_token = push_token_enum_and_trim(lst_token); + new = ft_lstnew((void *) lst_token); + ft_lstpush_back(lst, new); + i += j; + } + return (*lst); +} + +t_ftlst *lexer(char *input) +{ + t_ftlst **lst; + int i; + + if (!input) + return (0); + lst = malloc(sizeof(t_ftlst *) * 1); + if (!lst) + return(0); + *lst = create_token_list(input, lst); + i = ft_lstsize(*lst); + free(lst); + return (0); +} diff --git a/src/lexer/lexer_utils.c b/src/lexer/lexer_utils.c new file mode 100644 index 0000000..72d8288 --- /dev/null +++ b/src/lexer/lexer_utils.c @@ -0,0 +1,89 @@ + +#include "lexer.h" + + + +enum e_token_tag ret_token_sep_redir_append(char *input, int i) +{ + if (input[i + 1] == '>') + return(LTAG_REDIR_APPEND); + return (LTAG_REDIR_OUT); + +} + +enum e_token_tag ret_token(char *input, int i) +{ + if (input[i] == ';') + return(LTAG_AND); + if (input[i] == '&') + return(LTAG_END); + if (input[i] == '|' && input[i + 1] == '|') + return(LTAG_OR); + if(input[i] == '|') + return(LTAG_PIPE); + if (input[i] == '>') + return(ret_token_sep_redir_append(input,i)); + if (input[i] == '<') + return(LTAG_REDIR_IN); + if (input[i] == '(') + return(LTAG_PARENT_OPEN); + if (input[i] == ')') + return(LTAG_PARENT_CLOSE); + return(0); + +} + + +int lexer_sep(char input) +{ + char *sep; + int i; + + i = 0; + sep = ";&|><()"; + while(sep[i] != '\0') + { + if(sep[i] == input) + return(1); + i++; + } + return (0); +} + +int lexe_space(char *input) +{ + int i; + + i=0; + while(input[i] == ' ') + i++; + return(i); +} + +static int lex_verif_simple_cote(char *input, int i) +{ + i++; + while(input[i] != '\0') + { + ++i; + if(input[i] == '\'') + break; + } + if (input[i + 1] == ' ') + while(input[i + 1] == ' ') + i++; + return(i + 1); +} + +int lexer_verif_entre_cote(char *input, int i) +{ + if(input[i] == '\'') + return(lex_verif_simple_cote(input, i)); + i++; + while(input[i] != '"' && (input[i] != '\0')) + ++i; + if (input[i + 1] == ' ') + while(input[i + 1] == ' ') + i++; + return(i + 1); +} diff --git a/test_mini/a.out b/test_mini/a.out deleted file mode 100755 index 9b7deeb..0000000 Binary files a/test_mini/a.out and /dev/null differ diff --git a/test_mini/cat b/test_mini/cat deleted file mode 100644 index 45dcc70..0000000 --- a/test_mini/cat +++ /dev/null @@ -1,36 +0,0 @@ -ARGV: -[0] ./a.out -[1] echo -[2] salutsalut -[3] parfait - -ENV: -[0] USER=nassimehaddacha -[1] PATH=/Users/nassimehaddacha/miniconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/nassimehaddacha/miniconda/bin:/Users/nassimehaddacha/miniconda3/condabin -[2] LOGNAME=nassimehaddacha -[3] SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.VYiVzHotCo/Listeners -[4] HOME=/Users/nassimehaddacha -[5] SHELL=/bin/zsh -[6] __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x62 -[7] TMPDIR=/var/folders/3s/wv71r7ws2hj4d1ss15_3vg4w0000gn/T/ -[8] XPC_SERVICE_NAME=0 -[9] XPC_FLAGS=0x0 -ARGV: -[0] ./a.out -[1] echo -[2] salutsalut -[3] parfait - -ENV: -[0] USER=nassimehaddacha -[1] PATH=/Users/nassimehaddacha/miniconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/nassimehaddacha/miniconda/bin:/Users/nassimehaddacha/miniconda3/condabin -[2] LOGNAME=nassimehaddacha -[3] SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.VYiVzHotCo/Listeners -[4] HOME=/Users/nassimehaddacha -[5] SHELL=/bin/zsh -[6] __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x62 -[7] TMPDIR=/var/folders/3s/wv71r7ws2hj4d1ss15_3vg4w0000gn/T/ -[8] XPC_SERVICE_NAME=0 -[9] XPC_FLAGS=0x0 -echo4 -0 diff --git a/test_mini/lexer.c b/test_mini/lexer.c deleted file mode 100644 index 7e4fad2..0000000 --- a/test_mini/lexer.c +++ /dev/null @@ -1,140 +0,0 @@ - -#include "lexer.h" -#include "parse/parse.h" - - -int len_is_not_sep(char *input) -{ - int i; - - i = -1; - while(input[++i]) - { - if (input[i] == '\\' && input[i + 1] == ' ') - i += 2; - if (lexer_sep(input[i])) - { - if (input[i + 1] == ' ') - while(input[++i] == ' ') - ; - return(i); - } - if (input[i] == '\'' || input[i] == '"') - { - i += lexer_verif_entre_cote(input, i); - if (input[i] == ' ') - return(i + 1); - return(i); - } - if (input[i] == ' ') - { - while(input[++i] == ' ') - ; - return (i); - } - } - return(i); -} - -int check_input(char *input) -{ - int i; - - i = 0; - if (lexer_sep(input[i])) - { - while(input[i] == input[i + 1]) - i++; - i += lexe_space(&input[i + 1]); - return (i + 1); - } - if (input[i] == 39 || input[i] == '"') - return(lexer_verif_entre_cote(input, i)); - if (input[i] == ' ') - { - while(input[++i] == ' ') - ; - return (i); - } - return(len_is_not_sep(&input[i])); -} - - - -int check_input_out(char *input) -{ - int i; - int j; - char *str; - - i = 0; - while(input[i] != '\0') - { - j = 0; - j += len_is_not_sep(&input[i]); - if (j != 0) - { - return(j); - } - i += j; - j = check_input(&input[i]); - return(j); - } - return(0); -} - -t_token *lexer_lst_token_str(char *input, int i, int j) -{ - t_token *lst_token; - - 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))) - return(0); - if (!(ft_strlcpy(lst_token->value, &input[i], j + 1))) - { - free(lst_token); - return(0); - } - printf("%s\n", lst_token->value); - return (lst_token); -} - -static t_ftlst *create_token_list(char *input, t_ftlst **lst) -{ - t_token *lst_token; - t_ftlst *new; - int i; - int j; - - i = 0; - while (i < ft_strlen(input)) - { - j = 0; - j += check_input(&input[i]); - lst_token = lexer_lst_token_str(input,i,j); - new = ft_lstnew((void *) lst_token); - ft_lstpush_back(lst, new); - i += j; - } - return (*lst); -} - -t_ftlst *lexer(char *input) -{ - t_ftlst **lst; - int i; - - if (!input) - return (0); - lst = malloc(sizeof(t_ftlst *) * 1); - if (!lst) - return(0); - *lst = create_token_list(input, lst); - i = ft_lstsize(*lst); - printf("%d\n", i); - free(lst); - return (0); -} diff --git a/test_mini/lexer.h b/test_mini/lexer.h deleted file mode 100644 index 6ae832c..0000000 --- a/test_mini/lexer.h +++ /dev/null @@ -1,37 +0,0 @@ - -# include -# include -# include "libft/include/libft_lst.h" -# include "libft/include/libft_str.h" - - -enum e_token_tag -{ - LTAG_AND = 1 << 0, - LTAG_END = 1 << 1, - LTAG_OR = 1 << 2, - LTAG_PIPE = 1 << 3, - LTAG_REDIR_IN = 1 << 4, - LTAG_REDIR_OUT = 1 << 5, - LTAG_REDIR_APPEND = 1 << 6, - LTAG_PARENT_OPEN = 1 << 7, - LTAG_PARENT_CLOSE = 1 << 8, - LTAG_STR = 1 << 9, - LTAG_STR_DOUBLE = 1 << 10, - LTAG_STR_SINGLE = 1 << 11, -}; - -typedef struct s_token -{ - enum e_token_tag token; - char *value; - -} t_token; - -t_ftlst *lexer(char *input); -enum e_token_tag ret_token_sep(char *input, int i); -enum e_token_tag ret_token_sep_redir_append(char *input, int i); - -int lexer_sep(char input); -int lexer_verif_entre_cote(char *input, int i); -int lexe_space(char *input); diff --git a/test_mini/lexer_utils.c b/test_mini/lexer_utils.c deleted file mode 100644 index d7fe8f4..0000000 --- a/test_mini/lexer_utils.c +++ /dev/null @@ -1,88 +0,0 @@ - -#include "lexer.h" - - -enum e_token_tag ret_token_sep_redir_append(char *input, int i) -{ - if (input[i + 1] == '>') - return(LTAG_REDIR_APPEND); - return (LTAG_REDIR_OUT); - -} - -enum e_token_tag ret_token_sep(char *input, int i) -{ - if (input[i] == ';') - return(LTAG_AND); - if (input[i] == '&') - return(LTAG_END); - if (input[i] == '|' && input[i + 1] == '|') - return(LTAG_OR); - if(input[i] == '|') - return(LTAG_PIPE); - if (input[i] == '>') - return(ret_token_sep_redir_append(input,i)); - if (input[i] == '<') - return(LTAG_REDIR_IN); - - return(0); - -} - - -int lexer_sep(char input) -{ - char *sep; - int i; - - i = 0; - sep = ";&|><()"; - while(sep[i] != '\0') - { - if(sep[i] == input) - return(1); - i++; - } - return (0); -} - -int lexe_space(char *input) -{ - int i; - - i=0; - while(input[i] == ' ') - i++; - return(i); -} - -static int lex_verif_simple_cote(char *input, int i) -{ - i++; - while(input[i] != '\0') - { - ++i; - if(input[i] == '\'') - break; - } - if (input[i + 1] == ' ') - while(input[i] == ' ') - i++; - return(i + 1); -} -int lexer_verif_entre_cote(char *input, int i) -{ - if(input[i] == '\'') - return(lex_verif_simple_cote(input, i)); - i++; - while(input[i] != '"' && (input[i] != '\0')) - { - ++i; - if (input[i] == '\'') - break; - } - if (input[i + 1] == ' ') - while(input[i] == ' ') - i++; - return(i + 1); -} diff --git a/test_mini/libft/.gitignore b/test_mini/libft/.gitignore deleted file mode 100644 index 07a12bb..0000000 --- a/test_mini/libft/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -*.o -*.so -*.a -*.ghc -*.dSYM -a.out -test/libft_test -obj/* -rendu.makefile -doc/* -tmp/* diff --git a/test_mini/libft/.libftignore b/test_mini/libft/.libftignore deleted file mode 100644 index 68d827a..0000000 --- a/test_mini/libft/.libftignore +++ /dev/null @@ -1 +0,0 @@ -*ft_printf* diff --git a/test_mini/libft/.travis.yml b/test_mini/libft/.travis.yml deleted file mode 100644 index 71027dd..0000000 --- a/test_mini/libft/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: c -compiler: gcc - -script: make all && make -C ./test run_v diff --git a/test_mini/libft/Doxyfile b/test_mini/libft/Doxyfile deleted file mode 100644 index 64cc49b..0000000 --- a/test_mini/libft/Doxyfile +++ /dev/null @@ -1,2503 +0,0 @@ -# Doxyfile 1.8.17 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the configuration -# file that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# https://www.gnu.org/software/libiconv/ for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "libft" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line -# such as -# /*************** -# as being the beginning of a Javadoc-style comment "banner". If set to NO, the -# Javadoc-style will behave just like regular comments and it will not be -# interpreted by doxygen. -# The default value is: NO. - -JAVADOC_BANNER = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice -# sources only. Doxygen will then generate output that is more tailored for that -# language. For instance, namespaces will be presented as modules, types will be -# separated into more groups, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_SLICE = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: -# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser -# tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is -# Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See https://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 5. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 5 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explici