diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/ast.h | 10 | ||||
| -rw-r--r-- | include/lexer.h | 43 | ||||
| -rw-r--r-- | include/minishell.h | 4 | ||||
| -rw-r--r-- | include/ms_glob.h | 3 | ||||
| -rw-r--r-- | include/parse.h | 6 |
5 files changed, 36 insertions, 30 deletions
diff --git a/include/ast.h b/include/ast.h index b725c8b..e63ab22 100644 --- a/include/ast.h +++ b/include/ast.h @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:38 by charles #+# #+# */ -/* Updated: 2020/05/04 11:59:43 by charles ### ########.fr */ +/* Updated: 2020/06/09 11:44:45 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,9 +66,9 @@ typedef struct s_line typedef struct s_cmd { - char **argv; - char *in; - char *out; + char **argv; // change to t_ftvec of t_token + char *in; // change to t_token + char *out; // change to t_token bool is_append; } t_cmd; @@ -98,7 +98,7 @@ typedef struct s_ast { t_line line; t_cmd cmd; - } ; + }; } t_ast; t_ast *ast_new(t_ast_tag tag, void *data); diff --git a/include/lexer.h b/include/lexer.h index 694b09d..90f9353 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -1,32 +1,32 @@ +#ifndef LEXER_H +# define LEXER_H -# include <stdio.h> # include <stdlib.h> # include "libft_lst.h" # include "libft_str.h" - +# include "minishell.h" enum e_token_tag { - LTAG_AND = 1 << 0, - LTAG_END = 1 << 1, - LTAG_OR = 1 << 2, - LTAG_PIPE = 1 << 3, - LTAG_REDIR_IN = 1 << 4, - LTAG_REDIR_OUT = 1 << 5, - LTAG_REDIR_APPEND = 1 << 6, - LTAG_PARENT_OPEN = 1 << 7, - LTAG_PARENT_CLOSE = 1 << 8, - LTAG_STR = 1 << 9, - LTAG_STR_DOUBLE = 1 << 10, - LTAG_STR_SINGLE = 1 << 11, - LTAG_STICK = 1 << 12, + LTAG_AND = 1 << 0, + LTAG_END = 1 << 1, + LTAG_OR = 1 << 2, + LTAG_PIPE = 1 << 3, + LTAG_REDIR_IN = 1 << 4, + LTAG_REDIR_OUT = 1 << 5, + LTAG_REDIR_APPEND = 1 << 6, + LTAG_PARENT_OPEN = 1 << 7, + LTAG_PARENT_CLOSE = 1 << 8, + LTAG_STR = 1 << 9, + LTAG_STR_DOUBLE = 1 << 10, + LTAG_STR_SINGLE = 1 << 11, + LTAG_STICK = 1 << 12, }; -typedef struct s_token +typedef struct { - enum e_token_tag token; - char *value; - + enum e_token_tag tag; + char *content; } t_token; t_ftlst *lexer(char *input); @@ -36,3 +36,8 @@ enum e_token_tag ret_token_sep_redir_append(char *input, int i); int lexer_sep(char input); int lexer_verif_entre_cote(char *input, int i); int lexe_space(char *input); + +t_token *token_new(enum e_token_tag tag, char *content); +void token_destroy(t_token *token); + +#endif diff --git a/include/minishell.h b/include/minishell.h index 9551c1f..2afbed9 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */ -/* Updated: 2020/04/05 14:52:20 by charles ### ########.fr */ +/* Updated: 2020/06/12 11:57:36 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -109,6 +109,6 @@ int builtin_exit(char **argv, t_env env); ** preprocess.c */ -char *preprocess(char *input, t_env env); +char **preprocess(t_ftvec *argv, t_env env); #endif diff --git a/include/ms_glob.h b/include/ms_glob.h index a5c21bd..5b5c932 100644 --- a/include/ms_glob.h +++ b/include/ms_glob.h @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/05 11:45:11 by charles #+# #+# */ -/* Updated: 2020/04/05 13:05:10 by charles ### ########.fr */ +/* Updated: 2020/06/09 17:51:34 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,5 +29,6 @@ struct s_glob_param t_ftvec *glob_matches(char *pattern); char *ms_glob(char *pattern); +char *ms_globf(char *pattern); #endif diff --git a/include/parse.h b/include/parse.h index bc86230..ec95ef9 100644 --- a/include/parse.h +++ b/include/parse.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/04/01 17:49:45 by charles ### ########.fr */ +/* Updated: 2020/06/13 11:59:47 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,12 +37,12 @@ ** lexer.c */ -char **lexer(char *input); +// char **lexer(char *input); /* ** parse.c */ -t_ast *parse(char *input); +t_ast *parse(char **input); #endif |
