Add se_istravesable

This commit is contained in:
bʰedoh₂ swé 2024-06-04 00:06:51 +05:00
parent 7ed5367f20
commit 6fae121463
2 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,10 @@
#include "syntax.h"
bool se_istraversable(struct SyntaxElement* syntaxtree) {
return syntaxtree->type == TREE && syntaxtree->content != NULL;
}
struct SyntaxElement* se_create(void) {
struct SyntaxElement* syntaxelement = malloc(sizeof(struct SyntaxElement));
syntaxelement->type = NONE;

View File

@ -1,5 +1,7 @@
#ifndef SYNTAX_H
#define SYNTAX_H
#include <stdbool.h>
enum SyntaxElementType {
TREE,
TOKEN,
@ -16,6 +18,7 @@ struct SyntaxElement {
};
void se_clean(struct SyntaxElement* syntaxtree);
bool se_istraversable(struct SyntaxElement* syntaxtree);
struct SyntaxElement* se_create(void);
struct SyntaxElement* se_init(void);
struct SyntaxElement* se_bottom(struct SyntaxElement* syntaxelement);