AST structures in boys
This commit is contained in:
parent
a4476eb47d
commit
1fae8e40be
2 changed files with 122 additions and 98 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/25 19:30:30 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/26 17:25:10 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/26 17:55:39 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,15 +21,40 @@
|
|||
enum e_ast_type
|
||||
{
|
||||
TY_EMPTY = 0,
|
||||
TY_PROGRAM,
|
||||
TY_COMPOUND_LIST,
|
||||
TY_SEQUENTIAL_LIST,
|
||||
TY_ASYNC_COMMAND,
|
||||
TY_AND_LIST,
|
||||
TY_OR_LIST,
|
||||
TY_AND_OR_LIST,
|
||||
TY_ARITHMETIC_EXPANSION,
|
||||
TY_ASSIGNMENT,
|
||||
TY_ASSIGNMENT_LIST,
|
||||
TY_AST_STRING,
|
||||
TY_ASYNC_COMMAND,
|
||||
TY_BRACE_COMMAND,
|
||||
TY_CASE_COMMAND,
|
||||
TY_CASE_ITEM,
|
||||
TY_COMMAND,
|
||||
TY_COMMAND_BACKTICKS,
|
||||
TY_COMMAND_SUBSTITUTION,
|
||||
TY_COMPOUND_LIST,
|
||||
TY_ELIF_CLAUSE,
|
||||
TY_ELSE_CLAUSE,
|
||||
TY_FOR_COMMAND,
|
||||
TY_FUNCTION_DEFINITION,
|
||||
TY_IF_CLAUSE,
|
||||
TY_IF_COMMAND,
|
||||
TY_NAME,
|
||||
TY_NOT,
|
||||
TY_PIPE_LIST
|
||||
TY_OR_LIST,
|
||||
TY_PARAMETER_EXPANSION,
|
||||
TY_PIPE_LIST,
|
||||
TY_PROGRAM,
|
||||
TY_REDIRECT_FILE,
|
||||
TY_REDIRECT_HEREDOC,
|
||||
TY_SEQUENTIAL_LIST,
|
||||
TY_SIMPLE_COMMAND,
|
||||
TY_SUBSHELL_COMMAND,
|
||||
TY_UNTIL_COMMAND,
|
||||
TY_WHILE_COMMAND,
|
||||
TY_WORD,
|
||||
};
|
||||
|
||||
/// Can be either a t_sequential_list, t_async_command, t_and_or_list, t_not,
|
||||
|
|
@ -365,13 +390,13 @@ union u_redirect {
|
|||
|
||||
enum e_redirect_file_op
|
||||
{
|
||||
RO_INPUT, // <
|
||||
RO_OUTPUT, // >
|
||||
RO_APPEND, // >>
|
||||
RO_DUP_INPUT, // <&
|
||||
RO_DUP_OUTPUT, // >&
|
||||
RO_CLOBBER, // >|
|
||||
RO_INPUT_OUPUT, // <>
|
||||
RF_INPUT, // <
|
||||
RF_OUTPUT, // >
|
||||
RF_APPEND, // >>
|
||||
RF_DUP_INPUT, // <&
|
||||
RF_DUP_OUTPUT, // >&
|
||||
RF_CLOBBER, // >|
|
||||
RF_INPUT_OUPUT, // <>
|
||||
};
|
||||
|
||||
struct s_redirect_file
|
||||
|
|
@ -495,42 +520,41 @@ struct s_command_backticks
|
|||
};
|
||||
|
||||
union u_ast_node {
|
||||
t_ast_type type;
|
||||
t_assignment_list assignment_list;
|
||||
t_expension expension;
|
||||
t_program_body program_body;
|
||||
t_sequential_list_body sequential_list_body;
|
||||
t_async_command_body async_command_body;
|
||||
t_and_list_body and_list_body;
|
||||
t_or_list_body or_list_body;
|
||||
t_and_or_list_body and_or_list_body;
|
||||
t_not_body not_body;
|
||||
t_command_inner command_inner;
|
||||
t_compound_list_body compound_list_body;
|
||||
t_program program;
|
||||
t_compound_list compound_list;
|
||||
t_sequential_list sequential_list;
|
||||
t_async_command async_command;
|
||||
t_ast_type ast_type;
|
||||
t_and_list and_list;
|
||||
t_or_list or_list;
|
||||
t_and_or_list and_or_list;
|
||||
t_not not_;
|
||||
t_arithmetic_expansion arithmetic_expansion;
|
||||
t_assignment assignment;
|
||||
t_assignment_list assignment_list;
|
||||
t_ast_string ast_string;
|
||||
t_async_command async_command;
|
||||
t_brace_command brace_command;
|
||||
t_case_command case_command;
|
||||
t_case_item case_item;
|
||||
t_command command;
|
||||
t_pipe_list pipe_list;
|
||||
t_simple_command simple_command;
|
||||
t_compound_command compound_command;
|
||||
t_command_backticks command_backticks;
|
||||
t_command_substitution command_substitution;
|
||||
t_compound_list compound_list;
|
||||
t_elif_clause elif_clause;
|
||||
t_else_clause else_clause;
|
||||
t_for_command for_command;
|
||||
t_function_definition function_definition;
|
||||
t_redirect redirect;
|
||||
t_if_clause if_clause;
|
||||
t_if_command if_command;
|
||||
t_name name;
|
||||
t_not not_;
|
||||
t_or_list or_list;
|
||||
t_parameter_expansion parameter_expansion;
|
||||
t_pipe_list pipe_list;
|
||||
t_program program;
|
||||
t_redirect_file redirect_file;
|
||||
t_redirect_heredoc redirect_heredoc;
|
||||
t_assignment assignment;
|
||||
t_ast_string ast_string;
|
||||
t_name name;
|
||||
t_sequential_list sequential_list;
|
||||
t_simple_command simple_command;
|
||||
t_subshell_command subshell_command;
|
||||
t_until_command until_command;
|
||||
t_while_command while_command;
|
||||
t_word word;
|
||||
t_parameter_expansion parameter_expansion;
|
||||
t_arithmetic_expansion arithmetic_expansion;
|
||||
t_command_substitution command_substitution;
|
||||
t_command_backticks command_backticks;
|
||||
};
|
||||
|
||||
#endif /* AST_H */
|
||||
|
|
|
|||
|
|
@ -1,57 +1,57 @@
|
|||
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 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_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_backticks t_command_backticks;
|
||||
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_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;
|
||||
typedef struct s_for_command t_for_command;
|
||||
typedef struct s_function_definition t_function_definition;
|
||||
typedef struct s_if_clause t_if_clause;
|
||||
typedef struct s_if_command t_if_command;
|
||||
typedef struct s_name t_name;
|
||||
typedef struct s_not t_not;
|
||||
typedef struct s_or_list t_or_list;
|
||||
typedef struct s_parameter_expansion t_parameter_expansion;
|
||||
typedef struct s_pipe_list t_pipe_list;
|
||||
typedef struct s_program t_program;
|
||||
typedef struct s_redirect_file t_redirect_file;
|
||||
typedef struct s_redirect_heredoc t_redirect_heredoc;
|
||||
typedef struct s_sequential_list t_sequential_list;
|
||||
typedef struct s_simple_command t_simple_command;
|
||||
typedef struct s_subshell_command t_subshell_command;
|
||||
typedef struct s_until_command t_until_command;
|
||||
typedef struct s_while_command t_while_command;
|
||||
typedef struct s_word t_word;
|
||||
typedef union u_and_list_body t_and_list_body;
|
||||
typedef union u_and_or_list_body t_and_or_list_body;
|
||||
typedef union u_ast_node t_ast_node;
|
||||
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_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_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;
|
||||
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;
|
||||
typedef struct s_for_command t_for_command;
|
||||
typedef struct s_function_definition t_function_definition;
|
||||
typedef struct s_if_clause t_if_clause;
|
||||
typedef struct s_if_command t_if_command;
|
||||
typedef struct s_name t_name;
|
||||
typedef struct s_not t_not;
|
||||
typedef struct s_or_list t_or_list;
|
||||
typedef struct s_parameter_expansion t_parameter_expansion;
|
||||
typedef struct s_pipe_list t_pipe_list;
|
||||
typedef struct s_program t_program;
|
||||
typedef struct s_redirect_file t_redirect_file;
|
||||
typedef struct s_redirect_heredoc t_redirect_heredoc;
|
||||
typedef struct s_sequential_list t_sequential_list;
|
||||
typedef struct s_simple_command t_simple_command;
|
||||
typedef struct s_subshell_command t_subshell_command;
|
||||
typedef struct s_until_command t_until_command;
|
||||
typedef struct s_while_command t_while_command;
|
||||
typedef struct s_word t_word;
|
||||
typedef union u_and_list_body t_and_list_body;
|
||||
typedef union u_and_or_list_body t_and_or_list_body;
|
||||
typedef union u_ast_node t_ast_node;
|
||||
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_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_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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue