#include "parser.h" #include #include #include #include #include #include "lexer/lexer.h" #include "parser/parsing_utils.h" #include "utils/lists/lists.h" // === Static functions // ... // === Functions struct ast *get_ast(struct lexer_context *ctx) { struct token *token = PEEK_TOKEN(); struct ast *res; if (token->type == TOKEN_EOF) { token = pop_token(ctx); return ast_create_end(); } else if (token->type == TOKEN_NEWLINE) { token = pop_token(ctx); return ast_create_void(); } else // TOKEN WORD { res = parse_list(ctx); } /* if (token == NULL) { puts("Internal error: cannot get the following token"); puts("Hint: EOF might be missing"); return NULL; } */ return res; } // TODO struct ast *get_ast_str(char *command) { (void)command; return NULL; }