From 0d4f9e94f6d28a154ae4be3b918bfb014b4fa1e0 Mon Sep 17 00:00:00 2001 From: Christopher Uhlig Date: Sun, 11 Aug 2024 15:15:06 +0200 Subject: fixed |> fixed norm added new function --- src/repl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/repl.c') diff --git a/src/repl.c b/src/repl.c index 1fd7be7..fe9faf3 100644 --- a/src/repl.c +++ b/src/repl.c @@ -6,7 +6,7 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/24 16:07:04 by dkaiser #+# #+# */ -/* Updated: 2024/08/09 15:27:11 by chuhlig ### ########.fr */ +/* Updated: 2024/08/11 14:41:29 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,8 +27,8 @@ void repl(const char *prompt) return ; add_history(input); token_list = NULL; - tokenizer(input, &token_list); current = token_list; + tokenizer(input, &token_list, '\0'); while (current != NULL) { next = current->next; -- cgit v1.2.3 From bc55ab9621c9aa80c12f257d043597188f6ad64d Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Thu, 29 Aug 2024 15:31:07 +0200 Subject: Update repl --- src/repl.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/repl.c') diff --git a/src/repl.c b/src/repl.c index fe9faf3..01bcd76 100644 --- a/src/repl.c +++ b/src/repl.c @@ -6,7 +6,7 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/24 16:07:04 by dkaiser #+# #+# */ -/* Updated: 2024/08/11 14:41:29 by chuhlig ### ########.fr */ +/* Updated: 2024/08/29 15:29:16 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,8 +17,7 @@ void repl(const char *prompt) { char *input; t_token *token_list; - t_token *current; - t_token *next; + t_list *lines; while (1) { @@ -27,14 +26,10 @@ void repl(const char *prompt) return ; add_history(input); token_list = NULL; - current = token_list; tokenizer(input, &token_list, '\0'); - while (current != NULL) - { - next = current->next; - free_token(current); - current = next; - } + lines = parse(token_list); + if (lines) + print_ast(lines->content); free(input); } } -- cgit v1.2.3 From 61fe4e28bf95f782105a2907cd6fbfc196a6874b Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Thu, 29 Aug 2024 16:44:56 +0200 Subject: Handle empty input --- src/repl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/repl.c') diff --git a/src/repl.c b/src/repl.c index 01bcd76..02fb879 100644 --- a/src/repl.c +++ b/src/repl.c @@ -6,7 +6,7 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/24 16:07:04 by dkaiser #+# #+# */ -/* Updated: 2024/08/29 15:29:16 by dkaiser ### ########.fr */ +/* Updated: 2024/08/29 15:37:27 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,6 +24,8 @@ void repl(const char *prompt) input = readline(prompt); if (input == NULL) return ; + if (input[0] == '\0') + continue ; add_history(input); token_list = NULL; tokenizer(input, &token_list, '\0'); -- cgit v1.2.3 From 60adeb49de9458b4e2af0abd1c7b256da0950bc3 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Fri, 13 Sep 2024 16:27:13 +0200 Subject: Fix norme issues for env.h and repl.c TODO: Fix for tokenizer.c as well. This was probably already solved in another branch though. --- include/env.h | 23 ++++++++++++----------- src/repl.c | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/repl.c') diff --git a/include/env.h b/include/env.h index 1ea6f2e..f3d3c75 100644 --- a/include/env.h +++ b/include/env.h @@ -6,18 +6,19 @@ /* By: dkaiser +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/24 16:07:04 by dkaiser #+# #+# */ -/* Updated: 2024/08/29 15:37:27 by dkaiser ### ########.fr */ +/* Updated: 2024/09/13 16:26:35 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ void repl(const char *prompt) { char *input; t_token *token_list; - t_list *lines; + t_list *lines; while (1) { -- cgit v1.2.3