aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-06 15:57:29 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-06 15:57:29 +0200
commit54394620893f7245c7697a57d724d430d06b57d1 (patch)
tree8e51b671bcb2cdba4306165eaba39cc1f99f1cf4 /include
parent930bb63605984abeda8c887a6333109c004d3b00 (diff)
downloadminishell-54394620893f7245c7697a57d724d430d06b57d1.tar.gz
minishell-54394620893f7245c7697a57d724d430d06b57d1.tar.bz2
minishell-54394620893f7245c7697a57d724d430d06b57d1.zip
Added pipeline ast and pipeline evaluation (not working when first command is infinite)
Diffstat (limited to 'include')
-rw-r--r--include/parser.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/parser.h b/include/parser.h
index ff644ed..d2d3351 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -6,7 +6,7 @@
/* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */
-/* Updated: 2020/08/28 10:06:44 by charles ### ########.fr */
+/* Updated: 2020/10/06 08:35:42 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -54,17 +54,19 @@ typedef struct s_op
} t_op;
/*
-** \brief AST node tag (type)
-** \param TAG_CMD Command AST node
-** \param TAG_OP Operation AST node
-** \param TAG_PARENT Parenthesis AST node
+** \brief AST node tag (type)
+** \param TAG_CMD Command AST node
+** \param TAG_OP Operation AST node
+** \param TAG_PARENT Parenthesis AST node
+** \param TAG_PIPELINE Pipeline AST node
*/
-enum e_ast
+enum e_ast
{
AST_CMD,
AST_OP,
AST_PARENT,
+ AST_PIPELINE,
};
/*
@@ -72,6 +74,7 @@ enum e_ast
** \param tag Node tag
** \param op Operation struct
** \param cmd_argv Command argv tokens
+** \param pipline List of commands in a pipeline
** \param parend_ast AST inside parenthesis
** \param redirs Redirections tokens
*/
@@ -83,6 +86,7 @@ typedef struct s_ast
{
t_op op;
t_tok_lst *cmd_argv;
+ t_ftlst *pipeline;
struct s_ast *parent_ast;
};
t_tok_lst *redirs;
@@ -102,18 +106,13 @@ void ast_destroy(t_ast *ast);
typedef struct s_parsed
{
bool syntax_error;
- union
- {
- t_ast *ast;
- t_tok_lst *redir; // more general
- };
+ t_ast *ast;
t_tok_lst *rest;
} t_parsed;
t_parsed *parsed_new(t_ast *ast, t_tok_lst *rest);
t_parsed *parsed_error(const char *format, ...);
-
/*
** parse.c
*/