diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-24 18:27:55 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-24 18:27:55 +0100 |
| commit | 0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c (patch) | |
| tree | cd4950fcc80e408df07af54035395eebc7f08d3d | |
| parent | 61493998e35bd6adf5a02876cff6095a6e69e6c9 (diff) | |
| download | minishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.tar.gz minishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.tar.bz2 minishell-0ee30bdc0e6cb7ade2cb9a54165f8de6eea3721c.zip | |
Added comments to the ms_parse.h structs
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | include/ms_parse.h | 37 |
2 files changed, 38 insertions, 0 deletions
@@ -2,3 +2,4 @@ minishell *.o *.ghc *.a +tags 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; |
