#include "ast_neg.h" #include bool ast_is_neg(struct ast *node) { return node != NULL && node->type == AST_NEG; } 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; node->negation = negation; node->child = child; return ast_create(AST_NEG, node); } void ast_free_neg(struct ast_neg *node) { if (!node) return; ast_free(&node->child); free(node); }