aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-03-24 18:27:55 +0100
committerCharles <sircharlesaze@gmail.com>2020-03-24 18:27:55 +0100
commit0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c (patch)
treecd4950fcc80e408df07af54035395eebc7f08d3d /include
parent61493998e35bd6adf5a02876cff6095a6e69e6c9 (diff)
downloadminishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.tar.gz
minishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.tar.bz2
minishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.zip
Added comments to the ms_parse.h structs
Diffstat (limited to 'include')
-rw-r--r--include/ms_parse.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/ms_parse.h b/include/ms_parse.h
index 4a6ebfa..c6885ca 100644
--- a/include/ms_parse.h
+++ b/include/ms_parse.h
@@ -15,6 +15,18 @@
# include "minishell.h"
+/*
+** TAG_CMD: command name
+** TAG_ARG: command argument
+** TAG_ENDCMD: `;`
+** TAG_PIPE: `|`
+** TAG_AND: `&&`
+** TAG_OR: `||`
+** TAG_REDIR_OUT: `>`
+** TAG_REDIR_IN: `<`
+** TAG_REDIR_APPEND: `>>`
+*/
+
typedef enum
{
TAG_CMD,
@@ -28,6 +40,31 @@ typedef enum
TAG_REDIR_APPEND
} t_tag;
+/*
+** AST (Abstract Syntax Tree)
+** A node of the ast is represented by a tag (his type) and a content associated with it.
+** (i.e a TAG_CMD would be paired with the command executable name)
+** Each node also has children node which must be evaluated before him
+**
+** examle: "echo foo bar && ls"
+**
+** tags:
+** TAG_AND
+** / \
+** / \
+** TAG_CMD TAG_CMD
+** / \
+** TAG_ARG TAG_ARG
+**
+** content:
+** &&
+** / \
+** / \
+** echo ls
+** / \
+** foo bar
+*/
+
typedef struct t_ast {
t_tag tag;
char* contents;