MiniDevil
As beautiful as a shell
AST node creation and destruction prototypes. More...
#include "structs.h"
Include dependency graph for ast.h:
This graph shows which files directly or indirectly include this file:AST node creation and destruction prototypes.
Definition in file ast.h.
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 quote) |
| Create a redirection AST node. More... | |
| void | free_ast (t_ast *node) |
| Recursively free an entire AST tree. 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:| void free_ast | ( | t_ast * | node | ) |
Recursively free an entire AST tree.
| node | Root of tree to free |
Definition at line 46 of file ast_utils.c.
References t_cmd_node::args, t_ast_data::binary, t_redir_node::cmd, t_ast_data::cmd, t_ast::data, t_redir_node::file, free_args(), t_redir_node::heredoc_fd, t_binary_node::left, NODE_COMMAND, NODE_PIPE, NODE_REDIR_HEREDOC, NODE_REDIR_IN, t_ast_data::redir, t_binary_node::right, and t_ast::type.
Referenced by child_execute(), create_pipe_node(), exec_left_pipe_child(), exec_right_pipe_child(), parse_one_redirection(), parse_pipeline(), process_input(), and process_ui_input().
Here is the call graph for this function:
Here is the caller graph for this function: