From 70459a3ab97b13df9bf829e29ed91becfba1ea03 Mon Sep 17 00:00:00 2001 From: nass1pro Date: Thu, 18 Jun 2020 13:19:21 +0200 Subject: Change parse --- include/parser.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/parser.h b/include/parser.h index bc1e549..0dfeb18 100644 --- a/include/parser.h +++ b/include/parser.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/06/17 18:03:33 by nahaddac ### ########.fr */ +/* Updated: 2020/06/18 12:40:22 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,11 +37,20 @@ ** parse.c */ + t_ret *parse(t_ftlst *input); -t_ret *parse_c(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_token_tag tag); int parse_redir_true_false(enum e_token_tag tag); -- cgit From c8091831c4ce1c4cf8703b18de22441aff191f44 Mon Sep 17 00:00:00 2001 From: nass1pro Date: Fri, 19 Jun 2020 13:28:41 +0200 Subject: Update parser_error --- include/ast.h | 9 +++++---- include/lexer.h | 12 ++++++++++++ include/parser.h | 6 +++++- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/ast.h b/include/ast.h index 53221fa..fb1d059 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/06/18 13:35:38 by charles ### ########.fr */ +/* Updated: 2020/06/19 13:15:30 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -48,9 +48,9 @@ typedef struct s_op enum e_ast_tag { - AST_CMD, - AST_OP, - AST_OP_PARENT, + AST_CMD = 1 << 0, + AST_OP = 1 << 1, + AST_OP_PARENT = 1 << 2, }; /* @@ -70,6 +70,7 @@ typedef struct s_ast { t_op op; t_ftlst *cmd_argv; + struct s_ast *parent_ast; }; t_ftlst *redirs; } t_ast; diff --git a/include/lexer.h b/include/lexer.h index 43c3821..df05c20 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* lexer.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: nahaddac +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/06/19 10:51:26 by nahaddac #+# #+# */ +/* Updated: 2020/06/19 10:51:30 by nahaddac ### ########.fr */ +/* */ +/* ************************************************************************** */ + #ifndef LEXER_H # define LEXER_H diff --git a/include/parser.h b/include/parser.h index f3a425e..0bdc679 100644 --- a/include/parser.h +++ b/include/parser.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/06/18 14:04:07 by nahaddac ### ########.fr */ +/* Updated: 2020/06/18 16:34:18 by nahaddac ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ # define PARSE_H # include "minishell.h" +#include "libft_str.h" # include "ast.h" /* @@ -54,4 +55,7 @@ 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); +// error +t_token *error_syntax_simple(t_ftlst *in); + #endif -- cgit