aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-10 08:39:24 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-10 08:39:24 +0200
commit5f908033e68f6f3e03f2c38f4c396a0eab77ed05 (patch)
tree993f38b720a00b3013828da7969df22e05b013c3 /include
parent25ca78b5a53c931b0bc388aef099974dbba4b6ff (diff)
downloadminishell-5f908033e68f6f3e03f2c38f4c396a0eab77ed05.tar.gz
minishell-5f908033e68f6f3e03f2c38f4c396a0eab77ed05.tar.bz2
minishell-5f908033e68f6f3e03f2c38f4c396a0eab77ed05.zip
Norming lexer
Diffstat (limited to 'include')
-rw-r--r--include/lexer.h26
-rw-r--r--include/minishell.h6
2 files changed, 15 insertions, 17 deletions
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 <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */
@@ -65,10 +65,6 @@ enum e_tok
};
/*
-** tok_lst.c
-*/
-
-/*
** \brief Token list struct
** \param content token string content
** \param next next token in the list (NULL if end)
@@ -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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);