This commit is contained in:
Maix0 2024-05-26 17:30:51 +02:00
parent 7e14390441
commit a4476eb47d
7 changed files with 139 additions and 44 deletions

View file

@ -6,19 +6,19 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/25 19:30:30 by maiboyer #+# #+# */
/* Updated: 2024/05/25 20:42:26 by maiboyer ### ########.fr */
/* Updated: 2024/05/26 17:25:10 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef AST_H
#define AST_H
#include "me/types.h"
#include "ast/forward.h"
#include "me/types.h"
/// @brief Node types enumeration
/// @details This enumeration is used to identify the type of a node
typedef enum e_ast_type
enum e_ast_type
{
TY_EMPTY = 0,
TY_PROGRAM,
@ -30,7 +30,7 @@ typedef enum e_ast_type
TY_AND_OR_LIST,
TY_NOT,
TY_PIPE_LIST
} t_ast_type;
};
/// Can be either a t_sequential_list, t_async_command, t_and_or_list, t_not,
/// t_pipe_list or an t_command
@ -217,13 +217,13 @@ struct s_simple_command
t_usize suffix_len;
};
typedef enum e_assignement_modifier
enum e_assignement_modifier
{
AM_NONE = 0,
AM_EXPORT,
AM_LOCAL,
AM_READONLY,
} t_assignement_modifier;
};
struct s_assignment_list
{
@ -273,11 +273,11 @@ union u_if_clauses {
struct s_if_command
{
t_ast_type type;
t_ast_type type;
t_if_clauses *clauses;
t_usize clauses_len;
t_redirect *redirect;
t_usize redirect_len;
t_usize clauses_len;
t_redirect *redirect;
t_usize redirect_len;
};
struct s_if_clause
@ -363,7 +363,7 @@ union u_redirect {
t_redirect_heredoc *heredoc;
};
typedef enum e_redirect_file_op
enum e_redirect_file_op
{
RO_INPUT, // <
RO_OUTPUT, // >
@ -372,7 +372,7 @@ typedef enum e_redirect_file_op
RO_DUP_OUTPUT, // >&
RO_CLOBBER, // >|
RO_INPUT_OUPUT, // <>
} t_redirect_file_op;
};
struct s_redirect_file
{
@ -382,11 +382,11 @@ struct s_redirect_file
t_word *file;
};
typedef enum e_redirect_heredoc_op
enum e_redirect_heredoc_op
{
RH_HEREDOC, // <<
RH_HEREDOC_IDENT // <<-
} t_redirect_heredoc_op;
};
struct s_redirect_heredoc
{
@ -432,12 +432,12 @@ struct s_word
#define OP_NONE 0
typedef enum e_op_pre
enum e_op_pre
{
OP_PRE_HASH = 1, // '#'
} t_op_pre;
};
typedef enum e_op_in
enum e_op_in
{
OP_IN_COLON_MINUS = 1, // ':-'
OP_IN_MINUS, // '-'
@ -454,7 +454,7 @@ typedef enum e_op_in
OP_IN_COLON, // ':'
OP_IN_SLASH_SLASH, // '//'
OP_IN_SLASH, // '/'
} t_op_in;
};
/// is either a t_parameter_expansion, t_arithmetic_expansion,
/// t_command_substitution or t_command_backticks

View file

@ -1,16 +1,22 @@
typedef enum e_assignement_modifier t_assignement_modifier;
typedef enum e_ast_type t_ast_type;
typedef enum e_op_in t_op_in;
typedef enum e_op_pre t_op_pre;
typedef enum e_redirect_file_op t_redirect_file_op;
typedef enum e_redirect_heredoc_op t_redirect_heredoc_op;
typedef struct s_and_list t_and_list;
typedef struct s_and_or_list t_and_or_list;
typedef struct s_arithmetic_expansion t_arithmetic_expansion;
typedef struct s_assignment t_assignment;
typedef struct s_assignment_list t_assignment_list;
typedef struct s_assignment t_assignment;
typedef struct s_ast_string t_ast_string;
typedef struct s_async_command t_async_command;
typedef struct s_brace_command t_brace_command;
typedef struct s_case_command t_case_command;
typedef struct s_case_item t_case_item;
typedef struct s_command t_command;
typedef struct s_command_backticks t_command_backticks;
typedef struct s_command_substitution t_command_substitution;
typedef struct s_command t_command;
typedef struct s_compound_list t_compound_list;
typedef struct s_elif_clause t_elif_clause;
typedef struct s_else_clause t_else_clause;
@ -39,13 +45,13 @@ typedef union u_async_command_body t_async_command_body;
typedef union u_command_inner t_command_inner;
typedef union u_compound_command t_compound_command;
typedef union u_compound_list_body t_compound_list_body;
typedef union u_expension t_expension;
typedef union u_expension_or_string t_expension_or_string;
typedef union u_expension t_expension;
typedef union u_if_clauses t_if_clauses;
typedef union u_not_body t_not_body;
typedef union u_or_list_body t_or_list_body;
typedef union u_program_body t_program_body;
typedef union u_redirect t_redirect;
typedef union u_redirect_or_assign t_redirect_or_assign;
typedef union u_redirect_or_word t_redirect_or_word;
typedef union u_redirect t_redirect;
typedef union u_sequential_list_body t_sequential_list_body;