aboutsummaryrefslogtreecommitdiff
path: root/src/repl.c
diff options
context:
space:
mode:
authorChristopher Uhlig2024-10-17 14:22:47 +0200
committerChristopher Uhlig2024-10-17 14:22:47 +0200
commit981d02c8544388e81abf1423c31578c50d019d28 (patch)
tree195ea0964faa8abcf23712715111b2f21837e9d1 /src/repl.c
parent9b1ddf7b3491f26d8b3ba9daeca7174aede9c781 (diff)
parent85d82207526e7220bd14bc96e5f8079ec781fc75 (diff)
downloadminishell-981d02c8544388e81abf1423c31578c50d019d28.tar.gz
minishell-981d02c8544388e81abf1423c31578c50d019d28.zip
removed merch conflict
Diffstat (limited to 'src/repl.c')
-rw-r--r--src/repl.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/repl.c b/src/repl.c
index 1fd7be7..d590fec 100644
--- a/src/repl.c
+++ b/src/repl.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/24 16:07:04 by dkaiser #+# #+# */
-/* Updated: 2024/08/09 15:27:11 by chuhlig ### ########.fr */
+/* Updated: 2024/09/13 16:26:35 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,24 +17,21 @@ void repl(const char *prompt)
{
char *input;
t_token *token_list;
- t_token *current;
- t_token *next;
+ t_list *lines;
while (1)
{
input = readline(prompt);
if (input == NULL)
return ;
+ if (input[0] == '\0')
+ continue ;
add_history(input);
token_list = NULL;
- tokenizer(input, &token_list);
- current = token_list;
- while (current != NULL)
- {
- next = current->next;
- free_token(current);
- current = next;
- }
+ tokenizer(input, &token_list, '\0');
+ lines = parse(token_list);
+ if (lines)
+ print_ast(lines->content);
free(input);
}
}