MiniDevil
As beautiful as a shell
AST node creation: allocates command, pipe & redirection nodes. More...
Include dependency graph for ast.c:AST node creation: allocates command, pipe & redirection nodes.
Definition in file ast.c.
Functions | |
| t_ast * | create_cmd_node (char **args, int argc) |
| Create a NODE_COMMAND AST node. More... | |
| t_ast * | create_pipe_node (t_ast *left, t_ast *right) |
| Create a pipe AST node connecting 2 subtrees. More... | |
| t_ast * | create_redir_node (t_node_type type, char *file, t_ast *cmd, int quoted) |
| Create a redirection AST node. More... | |
| t_ast* create_cmd_node | ( | char ** | args, |
| int | argc | ||
| ) |
Create a NODE_COMMAND AST node.
| args | Argument array (NULL terminated) |
| argc | Argument count |
Definition at line 23 of file ast.c.
References t_cmd_node::argc, t_cmd_node::args, t_ast_data::cmd, t_ast::data, NODE_COMMAND, and t_ast::type.
Referenced by parse_simple_command().
Here is the caller graph for this function:Create a pipe AST node connecting 2 subtrees.
| left | Left child (command before the pipe) |
| right | Right child (command after the pipe) |
Definition at line 43 of file ast.c.
References t_ast_data::binary, t_ast::data, free_ast(), t_binary_node::left, NODE_PIPE, t_binary_node::right, and t_ast::type.
Referenced by parse_pipeline().
Here is the call graph for this function:
Here is the caller graph for this function:| t_ast* create_redir_node | ( | t_node_type | type, |
| char * | file, | ||
| t_ast * | cmd, | ||
| int | quoted | ||
| ) |
Create a redirection AST node.
Initializes heredoc_fd to -1 (not used)
| type | Redirection type |
| file | Filename or heredoc delimiter |
| cmd | Command subtree that this redirection wraps |
| quoted | 1 if heredoc delimiter was quoted |
Definition at line 71 of file ast.c.
References t_redir_node::cmd, t_ast::data, t_redir_node::file, t_redir_node::heredoc_fd, t_redir_node::quote, t_ast_data::redir, t_redir_node::redir_type, and t_ast::type.
Referenced by parse_one_redirection().
Here is the caller graph for this function: