aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ast.h18
-rw-r--r--include/eval.h4
-rw-r--r--include/minishell.h9
-rw-r--r--include/parser.h25
4 files changed, 22 insertions, 34 deletions
diff --git a/include/ast.h b/include/ast.h
index 7fec75d..8048dd2 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -6,7 +6,7 @@
/* By: charles <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/01 17:05:38 by charles #+# #+# */
-/* Updated: 2020/07/14 09:57:43 by charles ### ########.fr */
+/* Updated: 2020/08/27 18:38:45 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,7 +46,7 @@ typedef struct s_op
** \param TAG_OP Operation AST node
*/
-enum e_ast_tag
+enum e_ast
{
AST_CMD,
AST_OP,
@@ -65,24 +65,24 @@ enum e_ast_tag
typedef struct s_ast
{
- enum e_ast_tag tag;
+ enum e_ast tag;
union
{
t_op op;
- t_ftlst *cmd_argv;
+ t_tok_lst *cmd_argv;
struct s_ast *parent_ast;
};
- t_ftlst *redirs;
+ t_tok_lst *redirs;
} t_ast;
-typedef struct s_ret
+typedef struct s_parsed
{
bool syntax_error;
t_ast *ast;
- t_ftlst *rest;
-} t_ret;
+ t_tok_lst *rest;
+} t_parsed;
-t_ast *ast_new(enum e_ast_tag tag);
+t_ast *ast_new(enum e_ast tag);
void ast_destroy(t_ast *ast);
#endif
diff --git a/include/eval.h b/include/eval.h
index f2920b2..c9adf72 100644
--- a/include/eval.h
+++ b/include/eval.h
@@ -6,7 +6,7 @@
/* By: charles <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/01 17:05:30 by charles #+# #+# */
-/* Updated: 2020/07/20 13:22:26 by nahaddac ### ########.fr */
+/* Updated: 2020/08/27 17:15:19 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -64,7 +64,7 @@ t_ftlst *split_token(t_ftlst **lst, enum e_tok);
** redir.c
*/
-bool redir_extract(t_ftlst *redirs, t_env env, int fds[2]);
+bool redir_extract(t_tok_lst *redirs, t_env env, int fds[2]);
/*
** exec.c
diff --git a/include/minishell.h b/include/minishell.h
index a934bb7..1b23952 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/08/20 14:45:19 by charles ### ########.fr */
+/* Updated: 2020/08/27 17:18:43 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -37,6 +37,8 @@
# include "libft_vec.h"
# include "libft_dstr.h"
+# include "lexer.h"
+
/*
** \brief Value of pipe entry if closed
*/
@@ -107,8 +109,8 @@ int builtin_exit(char **argv, t_env env);
** preprocess.c
*/
-char **preprocess(t_ftlst **tokens, t_env env);
-char *preprocess_filename(t_ftlst **tokens, t_env env);
+char **preprocess(t_tok_lst **tokens, t_env env);
+char *preprocess_filename(t_tok_lst **tokens, t_env env);
/*
** error.c
@@ -125,6 +127,7 @@ typedef enum
} t_err;
void errorf(const char *format, ...);
+void verrorf(const char *format, va_list ap);
/*
** signal.c
diff --git a/include/parser.h b/include/parser.h
index d228dca..7103d0b 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -6,7 +6,7 @@
/* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */
-/* Updated: 2020/06/18 16:34:18 by nahaddac ### ########.fr */
+/* Updated: 2020/08/27 18:40:55 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -38,24 +38,9 @@
** parse.c
*/
-
-t_ret *parse(t_ftlst *input);
-t_ret *parse_op(t_ftlst *input);
-t_ret *parse_expr(t_ftlst *input);
-t_ret *parse_cmd(t_ftlst *input);
-
-// utils
-t_ret *ret_wrap_ast(t_ast *ast, t_ftlst *rest);
-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_tok tag);
-int parse_redir_true_false(enum e_tok tag);
-
-// error
-t_token *error_syntax_simple(t_ftlst *in);
+t_parsed *parse(t_tok_lst *input);
+t_parsed *parse_op(t_tok_lst *input);
+t_parsed *parse_expr(t_tok_lst *input);
+t_parsed *parse_cmd(t_tok_lst *input);
#endif