Updated Grammar

This commit is contained in:
Maieul BOYER 2024-07-01 12:57:51 +02:00
parent 74d642f297
commit 175efe0f2f
No known key found for this signature in database
1246 changed files with 109558 additions and 114993 deletions

View file

@ -41,6 +41,8 @@ enum e_ast_node_kind
AST_STRING = S_AST_NONE | 0x000B,
AST_WORD = S_AST_NONE | 0x000C,
AST_VARIABLE_ASSIGNMENT = S_AST_NONE | 0x000E,
AST_EXTGLOB = S_AST_NONE | 0x001A,
AST_REGEX = S_AST_NONE | 0x001B,
AST_FILE_REDIRECTION = S_AST_REDIRECT | 0x000F,
AST_HEREDOC_REDIRECTION = S_AST_REDIRECT | 0x0010,
@ -84,6 +86,8 @@ union u_ast_node_data {
t_ast_variable_assignment variable_assignment;
t_ast_while while_;
t_ast_word word;
t_ast_extglob extglob;
t_ast_regex regex;
};
struct s_ast_node

View file

@ -18,6 +18,7 @@ typedef enum e_ast_word_kind t_ast_word_kind;
typedef enum e_ast_list_kind t_ast_list_kind;
typedef enum e_ast_expansion_operator t_ast_expansion_operator;
typedef enum e_ast_terminator_kind t_ast_terminator_kind;
typedef enum e_ast_redirection_kind t_ast_redirection_kind;
typedef union u_ast_node_data t_ast_node_data;
@ -33,6 +34,7 @@ typedef struct s_ast_elif t_ast_elif;
typedef struct s_ast_else t_ast_else;
typedef struct s_ast_empty t_ast_empty;
typedef struct s_ast_expansion t_ast_expansion;
typedef struct s_ast_extglob t_ast_extglob;
typedef struct s_ast_file_redirection t_ast_file_redirection;
typedef struct s_ast_for t_ast_for;
typedef struct s_ast_function_definition t_ast_function_definition;
@ -48,6 +50,7 @@ typedef struct s_ast_until t_ast_until;
typedef struct s_ast_variable_assignment t_ast_variable_assignment;
typedef struct s_ast_while t_ast_while;
typedef struct s_ast_word t_ast_word;
typedef struct s_ast_regex t_ast_regex;
/*
t_ast_arithmetic_expansion arithmetic_expansion;

View file

@ -58,6 +58,18 @@ enum e_ast_expansion_operator
E_OP_LARGEST_SUFFIX, // ${var%%pattern}
};
enum e_ast_redirection_kind
{
AST_REDIR_INPUT, // <
AST_REDIR_OUTPUT, // >
AST_REDIR_APPEND, // >>
AST_REDIR_HEREDOC, // <<
AST_REDIR_HEREDOC_INDENT, // <<-
AST_REDIR_DUP_INPUT, // <&
AST_REDIR_DUP_OUTPUT, // >&
AST_REDIR_DUP_ERROR, // &>
};
struct s_ast_empty
{
};
@ -306,6 +318,7 @@ struct s_ast_variable_assignment
struct s_ast_file_redirection
{
t_ast_node output;
t_ast_redirection_kind op;
t_ast_node input;
};
@ -318,6 +331,7 @@ struct s_ast_file_redirection
struct s_ast_heredoc_redirection
{
t_ast_node output;
t_ast_redirection_kind op;
t_ast_node delimiter;
};
@ -357,4 +371,26 @@ struct s_ast_command_substitution
t_ast_node cmd;
};
/// Extended Globbing
/// ```shell
/// !(pattern)
/// ?(pattern)
/// *(pattern)
/// +(pattern)
/// @(pattern)
/// ```
struct s_ast_extglob
{
t_str pattern;
};
/// Regex
/// ```shell
/// ~pattern
/// ```
struct s_ast_regex
{
t_str pattern;
};
#endif /* AST_RAW_STRUCTS_H */