aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorChristopher Uhlig2025-01-22 02:40:27 +0100
committerChristopher Uhlig2025-01-22 02:40:27 +0100
commitf6e474d27a1398c6d4f2e88c7f2d3797b85217da (patch)
tree7dd7bd5f2a151b39498991b567ae51cff8242782 /src/parser.c
parent78dc50a2bce3c6e31405437189e2990d8fc720ac (diff)
downloadminishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.tar.gz
minishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.zip
kinda fix for pipe error and again.vs for you db just chnage workfolder gn
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c
index 1375954..e7b53c2 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/29 15:53:29 by dkaiser #+# #+# */
-/* Updated: 2025/01/11 16:06:54 by chuhlig ### ########.fr */
+/* Updated: 2025/01/21 21:27:15 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,7 @@ static t_token *find_token_by_type(t_token *tokens, int type);
t_token *split_at_first(t_token **tokens, int type);
static t_node *parse_statement(t_token *tokens, t_env **env);
-t_list *parse(t_token *tokens, t_env **env)
+t_node *parse(t_token *tokens, t_env **env)
{
t_node *result;
@@ -29,7 +29,7 @@ t_list *parse(t_token *tokens, t_env **env)
result = parse_statement(tokens, env);
if (result == NULL)
printf("Parsing error.\n");
- return (ft_lstnew(result));
+ return (result);
}
static t_node *parse_statement(t_token *tokens, t_env **env)
@@ -40,6 +40,7 @@ static t_node *parse_statement(t_token *tokens, t_env **env)
if (left_side_tokens == NULL)
{
free_tokens(tokens);
+ tokens = NULL;
return (NULL);
}
else if (tokens != NULL)
@@ -70,6 +71,7 @@ t_token *split_at_first(t_token **tokens, int type)
if (result == split)
result = NULL;
free_token(split);
+ split = NULL;
return (result);
}