fix: new lexer is linked to everything

This commit is contained in:
Matteo Flebus 2026-01-20 20:32:59 +01:00
parent d5a1ec3ca6
commit 71e58e38b8
6 changed files with 26 additions and 22 deletions

View file

@ -4,6 +4,7 @@
#include "execution/execution.h"
#include "io_backend/io_backend.h"
#include "lexer/lexer.h"
#include "parser/parser.h"
#include "utils/args/args.h"
#include "utils/vars/vars.h"
@ -69,8 +70,11 @@ int main(int argc, char **argv)
free(io_context);
// init lexer context
struct lexer_context *ctx = calloc(1, sizeof(struct lexer_context));
// Retrieve and build first AST
struct ast *command_ast = get_ast();
struct ast *command_ast = get_ast(ctx);
// Main parse-execute loop
while (command_ast != NULL && command_ast->type != AST_END)
@ -81,9 +85,11 @@ int main(int argc, char **argv)
ast_free(&command_ast);
// Retrieve and build next AST
command_ast = get_ast();
command_ast = get_ast(ctx);
}
destroy_lexer_context(&ctx);
ast_free(&command_ast);
if (command_ast == NULL)