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

@ -54,12 +54,12 @@ static bool is_end_of_list(struct token *token)
// === Functions
struct ast *parse_input(void)
struct ast *parse_input(struct lexer_context *ctx)
{
return parse_list();
}
struct ast *parse_list(void)
struct ast *parse_list(struct lexer_context *ctx)
{
struct list *result_list = NULL;
struct ast *current_node = NULL;
@ -95,17 +95,17 @@ struct ast *parse_list(void)
return ast_create_list(result_list);
}
struct ast *parse_and_or(void)
struct ast *parse_and_or(struct lexer_context *ctx)
{
return parse_pipeline();
}
struct ast *parse_pipeline(void)
struct ast *parse_pipeline(struct lexer_context *ctx)
{
return parse_command();
}
struct ast *parse_command(void)
struct ast *parse_command(struct lexer_context *ctx)
{
struct token *token = PEEK_TOKEN();
@ -123,7 +123,7 @@ struct ast *parse_command(void)
}
}
struct ast *parse_simple_command(void)
struct ast *parse_simple_command(struct lexer_context *ctx)
{
struct list *command_elements = NULL;
struct token *token = PEEK_TOKEN();
@ -166,12 +166,12 @@ struct ast *parse_simple_command(void)
return result;
}
struct ast *parse_shell_command(void)
struct ast *parse_shell_command(struct lexer_context *ctx)
{
return parse_if_rule();
}
struct ast *parse_if_rule(void)
struct ast *parse_if_rule(struct lexer_context *ctx)
{
// If keyword
struct token *token = POP_TOKEN();
@ -236,7 +236,7 @@ struct ast *parse_if_rule(void)
return result;
}
struct ast *parse_compound_list(void)
struct ast *parse_compound_list(struct lexer_context *ctx)
{
struct list *result_list = NULL; // ast* list
struct ast *current_cmd = NULL;
@ -291,7 +291,7 @@ struct ast *parse_compound_list(void)
return result;
}
struct ast *parse_else_clause(void)
struct ast *parse_else_clause(struct lexer_context *ctx)
{
struct token *token = PEEK_TOKEN();