aboutsummaryrefslogtreecommitdiff
path: root/include/parser.h
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-10 08:11:59 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-10 08:11:59 +0200
commit25ca78b5a53c931b0bc388aef099974dbba4b6ff (patch)
tree64a78d39acd408cc3dc0acaaf4c304ed2e1227c6 /include/parser.h
parenta55e414f6709c6b22ff9805cd32a40fae9da2538 (diff)
downloadminishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.tar.gz
minishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.tar.bz2
minishell-25ca78b5a53c931b0bc388aef099974dbba4b6ff.zip
Norming debugging function, Enabling them only when MINISHELL_TEST is defined
Diffstat (limited to 'include/parser.h')
-rw-r--r--include/parser.h35
1 files changed, 17 insertions, 18 deletions
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 <cacharle@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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