fix(parser): rename cmd => command
This commit is contained in:
parent
89ff5f4b1e
commit
eb5f57cbaa
1 changed files with 7 additions and 7 deletions
|
|
@ -53,16 +53,16 @@ static bool isterminator(struct token *token)
|
||||||
*/
|
*/
|
||||||
struct ast *parse_simple_command(void)
|
struct ast *parse_simple_command(void)
|
||||||
{
|
{
|
||||||
struct list *cmd_elements = NULL;
|
struct list *command_elements = NULL;
|
||||||
struct token *token = POP_TOKEN();
|
struct token *token = POP_TOKEN();
|
||||||
|
|
||||||
while (!isterminator(token))
|
while (!isterminator(token))
|
||||||
{
|
{
|
||||||
cmd_elements = list_append(cmd_elements, token->data);
|
command_elements = list_append(command_elements, token->data);
|
||||||
token = POP_TOKEN();
|
token = POP_TOKEN();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast *result = ast_create_cmd(cmd_elements);
|
struct ast *result = ast_create_command(command_elements);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ struct ast *parse_if_rule(void)
|
||||||
struct ast *parse_compound_list(void)
|
struct ast *parse_compound_list(void)
|
||||||
{
|
{
|
||||||
struct list *result_list = NULL; // ast* list
|
struct list *result_list = NULL; // ast* list
|
||||||
struct list *cmd_elements = NULL; // token* list
|
struct list *command_elements = NULL; // token* list
|
||||||
struct token *token = PEEK_TOKEN();
|
struct token *token = PEEK_TOKEN();
|
||||||
|
|
||||||
while (token->type != TOKEN_THEN || token->type != TOKEN_ELIF
|
while (token->type != TOKEN_THEN || token->type != TOKEN_ELIF
|
||||||
|
|
@ -127,9 +127,9 @@ struct ast *parse_compound_list(void)
|
||||||
if (token->type == TOKEN_SEMICOLON || token->type == TOKEN_NEWLINE)
|
if (token->type == TOKEN_SEMICOLON || token->type == TOKEN_NEWLINE)
|
||||||
{
|
{
|
||||||
// Stage (-> next command)
|
// Stage (-> next command)
|
||||||
struct ast *command = ast_create_cmd(cmd_elements);
|
struct ast *command = ast_create_command(command_elements);
|
||||||
result_list = list_append(result_list, command);
|
result_list = list_append(result_list, command);
|
||||||
cmd_elements = NULL;
|
command_elements = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token->type == TOKEN_EOF)
|
if (token->type == TOKEN_EOF)
|
||||||
|
|
@ -139,7 +139,7 @@ struct ast *parse_compound_list(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_elements = list_append(cmd_elements, token->data);
|
command_elements = list_append(command_elements, token->data);
|
||||||
token = POP_TOKEN();
|
token = POP_TOKEN();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue