This commit is contained in:
Maieul BOYER 2024-05-29 16:41:40 +02:00
parent d16b39091a
commit ff1670e264
No known key found for this signature in database
15 changed files with 435 additions and 243 deletions

View file

@ -15,7 +15,6 @@
#include "ast/forward.h"
#include "me/types.h"
#include <iso646.h>
/// @brief Node types enumeration
/// @details This enumeration is used to identify the type of a node
@ -36,6 +35,7 @@ enum e_ast_type
TY_COMMAND_BACKTICKS,
TY_COMMAND_SUBSTITUTION,
TY_COMPOUND_LIST,
TY_DOUBLE_QUOTE_STRING,
TY_ELIF_CLAUSE,
TY_ELSE_CLAUSE,
TY_FOR_COMMAND,
@ -200,9 +200,9 @@ struct s_not
struct s_pipe_list
{
t_ast_type type;
t_command *cmds;
t_usize cmds_len;
t_ast_type type;
t_ast_node **cmds;
t_usize cmds_len;
};
union u_command_inner {
@ -433,7 +433,7 @@ struct s_assignment
struct s_ast_string
{
t_ast_type type;
t_str *value;
t_str value;
};
struct s_name
@ -490,6 +490,14 @@ union u_expension {
t_arithmetic_expansion *arithmetic_expansion;
t_command_substitution *command_substitution;
t_command_backticks *command_backticks;
t_double_quote_string *double_quote_string;
};
struct s_double_quote_string
{
t_ast_type type;
t_expension_or_string *parts;
t_usize parts_len;
};
struct s_parameter_expansion
@ -498,7 +506,7 @@ struct s_parameter_expansion
t_op_in op_pre;
t_ast_string *param;
t_op_in op_in;
t_ast_string *_Nullable word;
t_word *_Nullable word;
};
struct s_arithmetic_expansion
@ -536,6 +544,7 @@ union u_ast_node {
t_command_backticks command_backticks;
t_command_substitution command_substitution;
t_compound_list compound_list;
t_double_quote_string double_quote_string;
t_elif_clause elif_clause;
t_else_clause else_clause;
t_for_command for_command;

View file

@ -36,6 +36,7 @@ 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_double_quote_string t_double_quote_string;
typedef struct s_elif_clause t_elif_clause;
typedef struct s_else_clause t_else_clause;
typedef struct s_for_command t_for_command;
@ -55,7 +56,7 @@ 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 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;

View file

@ -13,6 +13,7 @@
#ifndef FROM_PROGRAM_C
#define FROM_PROGRAM_C
#include "forward.h"
#include "me/types.h"
#include "app/node.h"
@ -90,6 +91,11 @@ t_command *build_command(t_node *node, t_usize size);
/// @note can be null in case of error
t_compound_list *build_compound_list(t_node *node, t_usize size);
/// @param node a pointer to an array of `t_node` of size `size`
/// @param size the size of the nodes
/// @note can be null in case of error
t_double_quote_string *build_double_quote_string(t_node *node, t_usize size);
/// @param node a pointer to an array of `t_node` of size `size`
/// @param size the size of the nodes
/// @note can be null in case of error
@ -190,7 +196,6 @@ t_while_command *build_while_command(t_node *node, t_usize size);
/// @note can be null in case of error
t_word *build_word(t_node *node, t_usize size);
/// @param node a pointer to an array of `t_node` of size `size`
/// @param size the size of the nodes
/// @note can be null in case of error