feat(parser): adapted to new lexer without static var

This commit is contained in:
Matteo Flebus 2026-01-20 19:54:29 +01:00
parent f1955f0532
commit c3ab2585e1
4 changed files with 30 additions and 30 deletions

View file

@ -17,22 +17,23 @@
struct ast *get_ast()
{
struct lexer_context *ctx = calloc(1, sizeof(struct lexer_context));
struct token *token = PEEK_TOKEN();
struct ast *res;
if (token->type == TOKEN_EOF)
{
token = pop_token();
token = pop_token(ctx);
return ast_create_end();
}
else if (token->type == TOKEN_NEWLINE)
{
token = pop_token();
token = pop_token(ctx);
return ast_create_void();
}
else // TOKEN WORD
{
res = parse_list();
res = parse_list(ctx);
}
/*
@ -43,6 +44,7 @@ struct ast *get_ast()
return NULL;
}
*/
destroy_lexer_context(&ctx);
return res;
}