feat(ast): AST_END type implemented

This commit is contained in:
Matteo Flebus 2026-01-16 20:19:12 +01:00
parent ed42f0b93d
commit 9e56654d31
2 changed files with 36 additions and 0 deletions

16
src/utils/ast/ast_end.c Normal file
View file

@ -0,0 +1,16 @@
#include "utils/ast/ast_end.h"
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
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);
}

20
src/utils/ast/ast_end.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef AST_END_H
#define AST_END_H
#include <stdbool.h>
#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 */