mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
notes: new architecture for cmdgroup
This commit is contained in:
parent
d8dd1613c8
commit
0f0d3ea0bd
1 changed files with 73 additions and 6 deletions
79
NOTES.md
79
NOTES.md
|
|
@ -208,26 +208,93 @@ not remain in effect after the subshell completes.
|
|||
The exit status of this construct is the exit status of LIST.
|
||||
|
||||
```c
|
||||
struct s_cmdgroup;
|
||||
typedef enum e_cmdgroup_item_type
|
||||
{
|
||||
TYPE_INVALID,
|
||||
TYPE_CMDGROUP,
|
||||
TYPE_PIPELINE,
|
||||
} t_cmdgroup_item_type;
|
||||
|
||||
typedef struct s_cmdgroup_item
|
||||
typedef struct s_cmdlist_item
|
||||
{
|
||||
enum e_cmdgroup_item_type type;
|
||||
union u_cmdgroup_item_inner
|
||||
{
|
||||
t_cmdgroup *cmdgroup;
|
||||
struct s_cmdlist *cmdlist;
|
||||
struct s_pipeline *pipeline;
|
||||
} inner;
|
||||
} t_cmdgroup_item;
|
||||
|
||||
typedef s_cmdlist
|
||||
{
|
||||
struct s_cmdlist_item *cmds;
|
||||
int num_cmds;
|
||||
struct s_operators *operators;
|
||||
} t_cmdlist;
|
||||
|
||||
typedef struct s_cmdgroup
|
||||
{
|
||||
int item_num;
|
||||
struct s_cmdgroup_item *items;
|
||||
struct s_redirects *redirections;
|
||||
struct s_cmdlist item;
|
||||
struct s_redirection_list *redirections;
|
||||
} t_cmdgroup;
|
||||
```
|
||||
|
||||
```c
|
||||
// (cmd1) && (cmd2)
|
||||
|
||||
t_cmdgroup
|
||||
{
|
||||
item = t_cmdlist
|
||||
{
|
||||
cmds = [
|
||||
t_cmdlist_item
|
||||
{
|
||||
type = TYPE_CMDGROUP
|
||||
inner = t_cmdgroup
|
||||
{
|
||||
item = t_cmdlist
|
||||
{
|
||||
cmds = [
|
||||
t_cmdlist_item
|
||||
{
|
||||
type = TYPE_PIPELINE
|
||||
inner = t_pipeline "cmd1"
|
||||
}
|
||||
]
|
||||
num_cmds = 1
|
||||
operators = [OP_END]
|
||||
}
|
||||
redirections = NULL
|
||||
}
|
||||
}
|
||||
t_cmdlist_item
|
||||
{
|
||||
type = TYPE_CMDGROUP
|
||||
inner = t_cmdgroup
|
||||
{
|
||||
item = t_cmdlist
|
||||
{
|
||||
cmds = [
|
||||
t_cmdlist_item
|
||||
{
|
||||
type = TYPE_PIPELINE
|
||||
inner = t_pipeline "cmd2"
|
||||
}
|
||||
]
|
||||
num_cmds = 1
|
||||
operators = [OP_END]
|
||||
}
|
||||
redirections = NULL
|
||||
}
|
||||
}
|
||||
]
|
||||
num_cmd = 2
|
||||
operators = [OP_AND, OP_END]
|
||||
}
|
||||
redirections = NULL
|
||||
}
|
||||
```
|
||||
|
||||
### Shell Expansion
|
||||
|
||||
cf. 3.5 Shell Expansions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue