#include "parser.h" #include #include #include #include #include #include "lexer/lexer.h" #include "utils/lists/lists.h" #include "parser/parsing_utils.h" // === Static functions // ... // === Functions struct ast *get_ast() { // struct list *result_list = NULL; // struct ast *current_node = NULL; struct token *token = PEEK_TOKEN(); if (token->type == TOKEN_EOF) { token = pop_token(); // TODO // return ast END. } else if (token->type == TOKEN_NEWLINE) { token = pop_token(); // TODO // return ast EMPTY. } else // TOKEN WORD { // TODO // call parse_list current_node = parse_simple_command(); result_list = list_append(result_list, current_node); } /* if (token == NULL) { puts("Internal error: cannot get the following token"); puts("Hint: EOF might be missing"); return NULL; } */ struct ast *result = ast_create_list(result_list); return result; } // TODO struct ast *get_ast_str(char *command) { (void)command; return NULL; }