Add se_istravesable
This commit is contained in:
parent
7ed5367f20
commit
6fae121463
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
#include "syntax.h"
|
#include "syntax.h"
|
||||||
|
|
||||||
|
bool se_istraversable(struct SyntaxElement* syntaxtree) {
|
||||||
|
return syntaxtree->type == TREE && syntaxtree->content != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct SyntaxElement* se_create(void) {
|
struct SyntaxElement* se_create(void) {
|
||||||
struct SyntaxElement* syntaxelement = malloc(sizeof(struct SyntaxElement));
|
struct SyntaxElement* syntaxelement = malloc(sizeof(struct SyntaxElement));
|
||||||
syntaxelement->type = NONE;
|
syntaxelement->type = NONE;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#ifndef SYNTAX_H
|
#ifndef SYNTAX_H
|
||||||
#define SYNTAX_H
|
#define SYNTAX_H
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
enum SyntaxElementType {
|
enum SyntaxElementType {
|
||||||
TREE,
|
TREE,
|
||||||
TOKEN,
|
TOKEN,
|
||||||
@ -16,6 +18,7 @@ struct SyntaxElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void se_clean(struct SyntaxElement* syntaxtree);
|
void se_clean(struct SyntaxElement* syntaxtree);
|
||||||
|
bool se_istraversable(struct SyntaxElement* syntaxtree);
|
||||||
struct SyntaxElement* se_create(void);
|
struct SyntaxElement* se_create(void);
|
||||||
struct SyntaxElement* se_init(void);
|
struct SyntaxElement* se_init(void);
|
||||||
struct SyntaxElement* se_bottom(struct SyntaxElement* syntaxelement);
|
struct SyntaxElement* se_bottom(struct SyntaxElement* syntaxelement);
|
||||||
|
Loading…
Reference in New Issue
Block a user