From 5ade92701836ce5ee1d39fc8d486b7709547058e Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 9 Jun 2020 17:09:55 +0200 Subject: Added iterpolation like bash according to lexer output (2 leaks) --- include/ast.h | 8 ++++---- include/lexer.h | 19 ++++++++++++++++++- include/minishell.h | 3 ++- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/ast.h b/include/ast.h index 1dd28a1..e63ab22 100644 --- a/include/ast.h +++ b/include/ast.h @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:38 by charles #+# #+# */ -/* Updated: 2020/05/14 23:54:46 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; diff --git a/include/lexer.h b/include/lexer.h index e7a6cdf..e20e0e7 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -1,6 +1,23 @@ - #include "minishell.h" +// just to make iterpolation compile +////////////////////////////////////// +enum e_token_tag +{ + LTAG_STR, + LTAG_STR_SINGLE, + LTAG_STR_DOUBLE, +}; + +typedef struct +{ + enum e_token_tag tag; + char *content; +} t_token; + +t_token *token_new(enum e_token_tag tag, char *content); +////////////////////////////////////// + char **lexer(char *input); int lexer_sep(char input); int lexer_verif_entre_cote(char *input, int i); diff --git a/include/minishell.h b/include/minishell.h index 9551c1f..76e4f7a 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */ -/* Updated: 2020/04/05 14:52:20 by charles ### ########.fr */ +/* Updated: 2020/06/09 14:05:36 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -110,5 +110,6 @@ int builtin_exit(char **argv, t_env env); */ char *preprocess(char *input, t_env env); +char **preprocess_argv(t_ftvec *argv, t_env env); #endif -- cgit