fix: ast_redir and ast_assignment accorded for every part

This commit is contained in:
matteo 2026-01-29 18:46:11 +01:00
parent e0032dd991
commit 98d18eef7d
8 changed files with 39 additions and 22 deletions

View file

@ -6,8 +6,8 @@
#include <stdlib.h>
#include <string.h>
#include "grammar_basic.h"
#include "grammar.h"
#include "grammar_basic.h"
static enum ast_redir_type redir_tok_to_ast_type(enum token_type tok_type)
{
@ -71,7 +71,7 @@ struct ast *parse_prefix(struct lexer_context *ctx)
if (token->type == TOKEN_ASSIGNMENT_WORD)
{
token = POP_TOKEN();
return ast_create_assignment_word(token->data);
return ast_create_assignment(token->data);
}
else if (is_first(*token, RULE_REDIRECTION))
return parse_redirection(ctx);

View file

@ -198,7 +198,7 @@ struct ast *parse_simple_command(struct lexer_context *ctx)
{
return err_simple_command(command_elements, redirections);
}
if (prefix->type == AST_ASSIGNEMENT)
if (prefix->type == AST_ASSIGNMENT)
{
assignments = list_append(assignments, prefix);
}