aboutsummaryrefslogtreecommitdiff
path: root/include/ast.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-01 15:55:57 +0200
committerCharles <sircharlesaze@gmail.com>2020-04-01 15:55:57 +0200
commit2eb59ee61e49b60472f82c000dd4f3536bd1987c (patch)
tree190ac7bc42051ee9fcc7c1d781be16afa4d43075 /include/ast.h
parent551e668e1b7a030fdff236067963100c7d8747a5 (diff)
downloadminishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.tar.gz
minishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.tar.bz2
minishell-2eb59ee61e49b60472f82c000dd4f3536bd1987c.zip
Added builtin support in command eval, Refactoring eval/builtin function, Added doc
Diffstat (limited to 'include/ast.h')
-rw-r--r--include/ast.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/ast.h b/include/ast.h
index 63dc12c..754956a 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -27,7 +27,8 @@ typedef enum
SEP_OR,
} t_sep;
-typedef struct s_ast t_ast;
+struct s_ast;
+
/**
** \brief Line struct
** \param left AST to the left of separator
@@ -37,8 +38,8 @@ typedef struct s_ast t_ast;
typedef struct
{
- t_ast *left;
- t_ast *right;
+ struct s_ast *left;
+ struct s_ast *right;
t_sep sep;
} t_line;
@@ -58,6 +59,12 @@ typedef struct
bool is_append;
} t_cmd;
+/**
+** \brief AST node tag (type)
+** \param TAG_CMD Command AST node
+** \param TAG_LINE Line AST node
+*/
+
typedef enum
{
TAG_CMD,
@@ -66,13 +73,13 @@ typedef enum
/**
** \brief AST node struct
-** \param type Node type
+** \param tag Node tag
** \param data Union containning possible node data
** \param data::cmd Command struct
** \param data::line Line struct
*/
-struct s_ast
+typedef struct s_ast
{
t_ast_tag tag;
union
@@ -80,7 +87,7 @@ struct s_ast
t_line line;
t_cmd cmd;
} data;
-};
+} t_ast;
t_ast *ast_new(t_ast_tag tag, void *data);
void ast_destroy(t_ast *ast);