aboutsummaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rwxr-xr-xsrc/parse/cmd_parse.c5
-rwxr-xr-xsrc/parse/parse.c37
-rwxr-xr-xsrc/parse/redir_parse.c4
3 files changed, 23 insertions, 23 deletions
diff --git a/src/parse/cmd_parse.c b/src/parse/cmd_parse.c
index 562cea3..8b52d0a 100755
--- a/src/parse/cmd_parse.c
+++ b/src/parse/cmd_parse.c
@@ -15,17 +15,16 @@ t_ast *parse_cmd(t_ast *ast, t_ftlst *rest)
{
t_ftlst *new;
- new = rest->data;
+ /* new = rest->data; */
if (ast == NULL)
{
-
ast = ast_new(AST_CMD);
ast->cmd_argv = ft_lstnew((t_token *)rest->data);
}
else
{
new = ft_lstnew((t_token *)rest->data);
- ft_lstpush_back(&ast->cmd_argv, (void *)new);
+ ft_lstpush_back(&ast->cmd_argv, new);
}
return (ast);
}
diff --git a/src/parse/parse.c b/src/parse/parse.c
index a0d981f..87478ac 100755
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -13,7 +13,7 @@
t_ret *parse(t_ftlst *input)
{
t_ret *ret;
- /* t_ret *first; */
+ t_ret *first;
enum e_token_tag tag;
int i = 0;
@@ -22,7 +22,7 @@ t_ret *parse(t_ftlst *input)
ret->rest = input;
ret->ast = NULL;
ret->unexpected = NULL;
- /* first = ret; */
+ first = ret;
while (ret->rest != NULL)
{
@@ -49,22 +49,23 @@ t_ret *parse(t_ftlst *input)
if (ret->rest != NULL)
ret->rest = ret->rest->next;
}
- while(ret->ast->cmd_argv != NULL)
- {
- /* printf("%s\n", ((t_token *)ret->ast->cmd_argv->data)->content); */
- ret->ast->cmd_argv = ret->ast->cmd_argv->next;
- }
- while(ret->ast->redirs != NULL)
- {
- if (i == 0)
- {
- /* printf("redir"); */
- i++;
- }
- /* printf("%s\n", ((t_token *)ret->ast->redirs->data)->content); */
- ret->ast->redirs = ret->ast->redirs->next;
- }
+
+ /* while(ret->ast->cmd_argv != NULL) */
+ /* { */
+ /* printf("%s\n", ((t_token *)ret->ast->cmd_argv->data)->content); */
+ /* ret->ast->cmd_argv = ret->ast->cmd_argv->next; */
+ /* } */
+ /* while(ret->ast->redirs != NULL) */
+ /* { */
+ /* if (i == 0) */
+ /* { */
+ /* printf("redir"); */
+ /* i++; */
+ /* } */
+ /* printf("%s\n", ((t_token *)ret->ast->redirs->data)->content); */
+ /* ret->ast->redirs = ret->ast->redirs->next; */
+ /* } */
/* ast_destroy(ret->ast); */
/* ft_lstdestroy(&ret->rest, (void (*)(void*))token_destroy); */
- return NULL;
+ return first;
}
diff --git a/src/parse/redir_parse.c b/src/parse/redir_parse.c
index bdcb3ab..c92d639 100755
--- a/src/parse/redir_parse.c
+++ b/src/parse/redir_parse.c
@@ -12,7 +12,7 @@ t_ast *parse_redir(t_ast *ast, t_ftlst *rest)
{
t_ftlst *new;
- new = rest->data;
+ /* new = rest->data; */
if (ast == NULL)
{
ast = ast_new(AST_CMD);
@@ -21,7 +21,7 @@ t_ast *parse_redir(t_ast *ast, t_ftlst *rest)
else
{
new = ft_lstnew((t_token *)rest->data);
- ft_lstpush_back(&ast->redirs, (void *)new);
+ ft_lstpush_back(&ast->redirs, new);
}
return (ast);
}