#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 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(); return ast_create_void(); } else // TOKEN WORD { current_node = parse_list(); } /* 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; }