aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-27 09:29:42 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-27 09:29:42 +0200
commit454d439575489934791c04329df6e82e56dabf54 (patch)
tree3beaa9ec4eec1e95898d26d77f88cceaff5978d9 /include
parentcde465358750ef03b66655edcbef468a4a2f210b (diff)
downloadminishell-454d439575489934791c04329df6e82e56dabf54.tar.gz
minishell-454d439575489934791c04329df6e82e56dabf54.tar.bz2
minishell-454d439575489934791c04329df6e82e56dabf54.zip
Renaming e_token_tag -> e_tok
Diffstat (limited to 'include')
-rw-r--r--include/ast.h2
-rw-r--r--include/eval.h2
-rw-r--r--include/lexer.h29
-rw-r--r--include/parser.h4
4 files changed, 24 insertions, 13 deletions
diff --git a/include/ast.h b/include/ast.h
index a767444..7fec75d 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -37,7 +37,7 @@ typedef struct s_op
{
struct s_ast *left;
struct s_ast *right;
- enum e_token_tag sep;
+ enum e_tok sep;
} t_op;
/*
diff --git a/include/eval.h b/include/eval.h
index 88b6578..f2920b2 100644
--- a/include/eval.h
+++ b/include/eval.h
@@ -58,7 +58,7 @@ int eval(int fds[2], t_env env, t_path path, t_ast *ast);
int fork_wrap(int fds[2], void *passed, int (*wrapped)(void *param));
int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast);
-t_ftlst *split_token(t_ftlst **lst, enum e_token_tag);
+t_ftlst *split_token(t_ftlst **lst, enum e_tok);
/*
** redir.c
diff --git a/include/lexer.h b/include/lexer.h
index 27910a5..89917d3 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/08/19 13:41:08 by charles ### ########.fr */
+/* Updated: 2020/08/27 09:26:33 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,7 +18,7 @@
# include "libft_str.h"
# include "minishell.h"
-enum e_token_tag
+enum e_tok
{
TAG_AND = 1 << 0,
TAG_END = 1 << 1,
@@ -41,13 +41,13 @@ enum e_token_tag
typedef struct
{
- enum e_token_tag tag;
+ enum e_tok tag;
char *content;
} t_token;
t_ftlst *lexer(char *input);
-enum e_token_tag ret_token(char *input, int i);
-enum e_token_tag ret_token_sep_redir_append(char *input, int i);
+enum e_tok ret_token(char *input, int i);
+enum e_tok ret_token_sep_redir_append(char *input, int i);
int lexer_sep(char input);
int lexer_verif_entre_cote(char *input, int i);
@@ -62,15 +62,26 @@ t_ftlst *lexe_trim_out(t_ftlst *lst);
** token.c
*/
-t_token *token_new(enum e_token_tag tag, char *content);
-t_token *token_new_until(enum e_token_tag tag, char *content, int n);
+t_token *token_new(enum e_tok tag, char *content);
+t_token *token_new_until(enum e_tok tag, char *content, int n);
void token_destroy(t_token *token);
void token_destroy_lst(t_ftlst *tokens);
void token_destroy_lst2(t_ftlst *tokens1, t_ftlst *tokens2);
-enum e_token_tag token_tag(t_ftlst *token_lst);
-void token_set_tag(t_ftlst *token_lst, enum e_token_tag tag);
+enum e_tok token_tag(t_ftlst *token_lst);
+void token_set_tag(t_ftlst *token_lst, enum e_tok tag);
char *token_content(t_ftlst *token_lst);
void token_set_content(t_ftlst *token_lst, char *content);
void token_set_contentf(t_ftlst *token_lst, char *content);
+/*
+** \warning DO NOT change the order of the fields
+*/
+
+typedef struct s_tlst
+{
+ char *content;
+ struct s_tlst *next;
+ enum e_tok tag;
+} t_tlst;
+
#endif
diff --git a/include/parser.h b/include/parser.h
index 0bdc679..d228dca 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -52,8 +52,8 @@ t_ftlst *push_token(t_ftlst **tokens, t_token *pushed);
t_ast *push_cmd(t_ast *ast, t_ftlst *ret);
t_ast *push_redir(t_ast *ast, t_ftlst *rest);
-int parse_cmd_str_true_false(enum e_token_tag tag);
-int parse_redir_true_false(enum e_token_tag tag);
+int parse_cmd_str_true_false(enum e_tok tag);
+int parse_redir_true_false(enum e_tok tag);
// error
t_token *error_syntax_simple(t_ftlst *in);