feat: toujours les mêmes qui font les pipes. Plus de assert dans ASTs (pour des raisons évidentes de stabilité du code) et nouveaux types (AST_PIPE et AST_NEG), + modifs random dans le parser

This commit is contained in:
Gu://em_ 2026-01-27 00:30:19 +01:00
parent 07e7d83c60
commit 96626d9850
27 changed files with 238 additions and 86 deletions

32
src/utils/ast/ast_neg.c Normal file
View file

@ -0,0 +1,32 @@
#include "ast_neg.h"
#include <stdlib.h>
bool ast_is_neg(struct ast *node)
{
return node != NULL && node->type == AST_REDIR;
}
struct ast_neg *ast_get_neg(struct ast *node)
{
if (ast_is_neg(node))
return node->data;
return NULL;
}
struct ast *ast_create_neg(bool negation, struct ast *child)
{
struct ast_neg *node = malloc(sizeof(struct ast_neg));
if (!node)
return NULL;
return ast_create(AST_NEG, node);
}
void ast_free_neg(struct ast_neg *node)
{
if (!node)
return;
ast_free(&node->child);
free(node);
}