From 9e56654d313973c6bbe0f3154d7371de66bf0093 Mon Sep 17 00:00:00 2001 From: Matteo Flebus Date: Fri, 16 Jan 2026 20:19:12 +0100 Subject: [PATCH] feat(ast): AST_END type implemented --- src/utils/ast/ast_end.c | 16 ++++++++++++++++ src/utils/ast/ast_end.h | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/utils/ast/ast_end.c create mode 100644 src/utils/ast/ast_end.h diff --git a/src/utils/ast/ast_end.c b/src/utils/ast/ast_end.c new file mode 100644 index 0000000..b2db692 --- /dev/null +++ b/src/utils/ast/ast_end.c @@ -0,0 +1,16 @@ +#include "utils/ast/ast_end.h" + +#include +#include +#include + +bool ast_is_end(struct ast *node) +{ + assert(node != NULL); + return node->type == AST_END; +} + +struct ast *ast_create_end(end) +{ + return ast_create(AST_END, NULL); +} diff --git a/src/utils/ast/ast_end.h b/src/utils/ast/ast_end.h new file mode 100644 index 0000000..e4e16c8 --- /dev/null +++ b/src/utils/ast/ast_end.h @@ -0,0 +1,20 @@ +#ifndef AST_END_H +#define AST_END_H + +#include + +#include "utils/lists/lists.h" +#include "utils/ast/ast_base.h" + +/** + * Checks if the given AST node is of type AST_END. + */ +bool ast_is_end(struct ast *node); + +/** + * Creates a new AST node representing the end of input. + * WARNING: data will be a NULL pointer + */ +struct ast *ast_create_end(end); + +#endif /* ! AST_END_H */