42sh/src/parser/parsing_utils.c

36 lines
723 B
C
Raw Normal View History

struct ast *parse_simple_command(void)
{
struct list *cmd_elements = NULL;
char *token = pop_token();
if (token == NULL) // just in case ?
{
puts("Internal error: cannot get the following token");
return NULL;
}
while (token != NULL && !isterminator(token[0]))
{
cmd_elements = list_append(cmd_elements, token);
token = pop_token();
}
if (token == NULL)
{
puts("Internal error: cannot get the following token");
return NULL;
}
struct ast *result = ast_create_cmd(cmd_elements);
return result;
}
struct ast *parse_if_rule(void)
{
return NULL;
}
struct ast *parse_shell_command(void)
{
return parse_if_rule();
}