This commit is contained in:
Loic Deridder
2025-02-12 13:48:54 +01:00
parent 256724e601
commit 3ac1625f5a
12 changed files with 89 additions and 61 deletions

View File

@@ -13,6 +13,8 @@
#ifndef AST_H
# define AST_H
# include <unistd.h>
typedef struct s_node t_node;
typedef struct s_msh t_msh;
@@ -50,7 +52,7 @@ typedef struct s_ast_n
int _stdin;
int save_stdo;
int save_stdi;
t_redir *redir;
t_redir *redir;
char *input;
char **files;
bool sh;
@@ -58,16 +60,16 @@ typedef struct s_ast_n
typedef struct s_nodell
{
t_node *node;
t_node *node;
struct s_nodell *next;
} t_nodell;
t_ast_n *get_ast(t_msh *msh, t_node *lst);
t_nodell *cutll(t_node *lst, t_node *expected, size_t limiter);
t_node *get_top_token(t_node *lst, t_state *state);
t_node *get_top_token(t_node *lst, t_state *state);
// recurce
t_ast_n *create_ast_n(t_node *lst, t_ast_n *parent, t_msh *msh, bool subsh);
t_ast_n *create_ast_n(t_node *lst, t_ast_n *parent, t_msh *msh, bool subsh);
// redir
t_redir get_redir(t_node *node);
void create_redir(t_node *cpy, t_ast_n *self);
@@ -75,14 +77,15 @@ void create_redir_subsh(t_node *head, t_ast_n *self);
// cmd
void create_cmd(t_ast_n *self, t_node *lst);
// subsh
void create_subsh(t_ast_n *parent, t_node *lst, t_msh *msh);
void create_subsh(t_ast_n *parent, t_node *lst, t_msh *msh);
// pipeline
void create_pline(t_ast_n *self, t_node *lst, t_node *token, t_msh *msh);
// and_or
void create_and_or(t_ast_n *parrent, t_node *lst, t_node *token, t_msh *msh);
void create_and_or(t_ast_n *parrent, t_node *lst, t_node *token,
t_msh *msh);
// free
void free_ast(t_ast_n *node);
void free_lltab(t_nodell *nodell);
void free_lltab(t_nodell *nodell);
#endif