From 25ca78b5a53c931b0bc388aef099974dbba4b6ff Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 10 Oct 2020 08:11:59 +0200 Subject: Norming debugging function, Enabling them only when MINISHELL_TEST is defined --- include/parser.h | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'include/parser.h') diff --git a/include/parser.h b/include/parser.h index bd4e5b0..4bf79df 100644 --- a/include/parser.h +++ b/include/parser.h @@ -6,12 +6,12 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/10/09 16:02:40 by cacharle ### ########.fr */ +/* Updated: 2020/10/10 07:37:55 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ -#ifndef PARSE_H -# define PARSE_H +#ifndef PARSER_H +# define PARSER_H /* ** \file parser.h @@ -36,7 +36,7 @@ # include "lexer.h" # include "error.h" -struct s_ast; +struct s_ast; /* ** \brief Operation struct @@ -45,12 +45,11 @@ struct s_ast; ** \param sep Type of separator */ - typedef struct s_op { struct s_ast *left; struct s_ast *right; - enum e_tok sep; + enum e_tok sep; } t_op; /* @@ -77,18 +76,18 @@ enum e_ast ** \param pipline List of commands in a pipeline ** \param parend_ast AST inside parenthesis ** \param redirs Redirections tokens +** \note Norminette doesn't like unamed union +** It breaks my heart to waste memory but +** t_ast isn't heavily used anyway */ typedef struct s_ast { enum e_ast tag; - union - { - t_op op; - t_tok_lst *cmd_argv; - t_ftlst *pipeline; - struct s_ast *parent_ast; - }; + t_op op; + t_tok_lst *cmd_argv; + t_ftlst *pipeline; + struct s_ast *parent_ast; t_tok_lst *redirs; } t_ast; @@ -112,8 +111,8 @@ typedef struct s_parsed t_parsed *parsed_new(t_ast *ast, t_tok_lst *rest); t_parsed *parsed_error(const char *format, ...); -t_parsed *parsed_expected(void); -t_parsed *parsed_unexpected(char *content); +t_parsed *parsed_expected(void); +t_parsed *parsed_unexpected(char *content); void parsed_destroy(t_parsed *parsed); /* @@ -121,8 +120,8 @@ void parsed_destroy(t_parsed *parsed); */ 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); +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 -- cgit