diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-08 14:42:54 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-08 14:42:54 +0100 |
| commit | 61493998e35bd6adf5a02876cff6095a6e69e6c9 (patch) | |
| tree | 237536c421df82ca0c9a62f85ed5207ecc62efa7 /include/ms_parse.h | |
| parent | 9b3753960b986d0dcf84369846fd7ac74d2baef6 (diff) | |
| download | minishell-61493998e35bd6adf5a02876cff6095a6e69e6c9.tar.gz minishell-61493998e35bd6adf5a02876cff6095a6e69e6c9.tar.bz2 minishell-61493998e35bd6adf5a02876cff6095a6e69e6c9.zip | |
Changing the parsing struct to an AST
Diffstat (limited to 'include/ms_parse.h')
| -rw-r--r-- | include/ms_parse.h | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/include/ms_parse.h b/include/ms_parse.h index 59c9ca8..4a6ebfa 100644 --- a/include/ms_parse.h +++ b/include/ms_parse.h @@ -17,37 +17,23 @@ typedef enum { - REDIRECTION_OUT, - REDIRECTION_IN, - REDIRECTION_APPEND -} t_redirection_type; - -typedef struct -{ - char *filename; - t_redirection_type type; -} t_redirection; - -typedef struct -{ - char *name; - char **argv; - t_ftlst *redirections; // need to store them in reverse order -} t_command; - -typedef enum -{ - SEPARATOR_SEMICOLON, - SEPARATOR_PIPE, - // SEPARATOR_AND, // with parhenthesis => harder - // SEPARATOR_OR, -} t_separator; - -typedef struct -{ - t_ftlst *commands; - t_ftlst *separators; -} t_parsing; + TAG_CMD, + TAG_ARG, + TAG_ENDCMD, + TAG_PIPE, + TAG_AND, + TAG_OR, + TAG_REDIR_OUT, + TAG_REDIR_IN, + TAG_REDIR_APPEND +} t_tag; + +typedef struct t_ast { + t_tag tag; + char* contents; + int children_num; + struct t_ast** children; +} t_ast; /* ** parse.c |
