MiniDevil
As beautiful as a shell
Command parsing: builds command nodes from argument tokens. More...
Include dependency graph for parser_cmd.c:Command parsing: builds command nodes from argument tokens.
Definition in file parser_cmd.c.
Functions | |
| int | count_word_tokens (t_token *tokens) |
| Count consecutive word token groups. More... | |
| static int | fill_args_array (char **args, t_token **tokens, int count) |
| Fill argument array from consecutive word tokens. More... | |
| char ** | collect_args (t_token **tokens, int *argc) |
| Collect consecutive word tokens into an arguments array. More... | |
| t_ast * | parse_simple_command (t_token **tokens) |
| Parse a simple command from consecutive word tokens. More... | |
| int count_word_tokens | ( | t_token * | tokens | ) |
Count consecutive word token groups.
Connected tokens count as 1 group
| tokens | Token list starting position |
Definition at line 25 of file parser_cmd.c.
References t_token::connected, t_token::next, TOKEN_WORD, and t_token::type.
Referenced by collect_args().
Here is the caller graph for this function:
|
static |
Fill argument array from consecutive word tokens.
Concatenates the connected tokens via ft_strjoin and advances the token pointer past all the consumed tokens
| args | Pre allocated array of size count + 1 |
| tokens | Pointer to current token pointer |
| count | Number of word groups to collect |
Definition at line 53 of file parser_cmd.c.
References t_token::next.
Referenced by collect_args().
Here is the caller graph for this function:| char** collect_args | ( | t_token ** | tokens, |
| int * | argc | ||
| ) |
Collect consecutive word tokens into an arguments array.
| tokens | Pointer to current token pointer |
| argc | Number of arguments collected |
Definition at line 88 of file parser_cmd.c.
References count_word_tokens(), and fill_args_array().
Referenced by collect_and_merge_remaining_args(), and parse_simple_command().
Here is the call graph for this function:
Here is the caller graph for this function:Parse a simple command from consecutive word tokens.
Collects the arguments via collect_args() and wraps them in a NODE_COMMAND AST node
| tokens | Pointer to current token pointer |
Definition at line 117 of file parser_cmd.c.
References collect_args(), and create_cmd_node().
Referenced by parse_command().
Here is the call graph for this function:
Here is the caller graph for this function: