feat(ast): AST_END type implemented
This commit is contained in:
parent
ed42f0b93d
commit
9e56654d31
2 changed files with 36 additions and 0 deletions
16
src/utils/ast/ast_end.c
Normal file
16
src/utils/ast/ast_end.c
Normal 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
20
src/utils/ast/ast_end.h
Normal 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 */
|
||||||
Loading…
Add table
Add a link
Reference in a new issue