From 5f908033e68f6f3e03f2c38f4c396a0eab77ed05 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 10 Oct 2020 08:39:24 +0200 Subject: Norming lexer --- include/lexer.h | 26 +++++++++++++------------- include/minishell.h | 6 ++---- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/lexer.h b/include/lexer.h index 36dfd5b..123531d 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -6,7 +6,7 @@ /* By: nahaddac +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/19 10:51:26 by nahaddac #+# #+# */ -/* Updated: 2020/10/09 13:44:09 by cacharle ### ########.fr */ +/* Updated: 2020/10/10 08:35:51 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -64,10 +64,6 @@ enum e_tok TAG_IS_SEP = TAG_AND | TAG_END | TAG_OR, }; -/* -** tok_lst.c -*/ - /* ** \brief Token list struct ** \param content token string content @@ -85,27 +81,33 @@ typedef struct s_tok_lst enum e_tok tag; } t_tok_lst; +/* +** tok_lst.c +*/ + t_tok_lst *tok_lst_new(enum e_tok tag, char *content); t_tok_lst *tok_lst_new_until( enum e_tok tag, char *content, size_t n); -void tok_lst_push_back( - t_tok_lst **tokens, t_tok_lst *pushed); t_tok_lst *tok_lst_push_front( t_tok_lst **tokens, t_tok_lst *pushed); +t_tok_lst *tok_lst_uncons(t_tok_lst **tokens); + +/* +** tok_lst_wrapper.c +*/ + +void tok_lst_push_back( + t_tok_lst **tokens, t_tok_lst *pushed); void tok_lst_pop_front( t_tok_lst **tokens, void (*del)(void*)); void *tok_lst_destroy( t_tok_lst **tokens, void (*del)(void*)); t_tok_lst *tok_lst_last(t_tok_lst *tokens); -t_tok_lst *tok_lst_uncons(t_tok_lst **tokens); /* ** lexer.c */ -int len_until_sep(char *input); -int tok_len(char *input); -t_tok_lst *create_token_list(char *input, t_tok_lst **lst); int lexer(char *input, t_tok_lst **out); /* @@ -113,9 +115,7 @@ int lexer(char *input, t_tok_lst **out); */ enum e_tok tok_assign_tag(char *content); -enum e_tok tok_assign_stick(t_tok_lst *tok); enum e_tok tok_assign_str(t_tok_lst *tok); -int lexer_sep(char input); int lexer_space(char *input); int quote_len(char *input, int i); diff --git a/include/minishell.h b/include/minishell.h index 4181c46..b1af152 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/10/10 08:08:21 by cacharle ### ########.fr */ +/* Updated: 2020/10/10 08:14:38 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,6 +37,7 @@ # include "libft_dstr.h" # include "lexer.h" +# include "parser.h" # include "error.h" /* @@ -151,15 +152,12 @@ bool utils_strisblank(char *str); bool setup(char *first_arg, t_env env); - /* ** debug.c */ # ifdef MINISHELL_TEST -# include "parser.h" - int debug_lexer(char *input); int debug_parser(char *input); void ast_print(int level, t_ast *ast); -- cgit