36 lines
648 B
C
36 lines
648 B
C
|
#ifndef MK_NODE_H
|
||
|
#define MK_NODE_H
|
||
|
|
||
|
#include "commons.h"
|
||
|
#include "token.h"
|
||
|
#include "vec.h"
|
||
|
#include "str.h"
|
||
|
|
||
|
#define NODE_KIND(G) \
|
||
|
G(NODE_ROOT), \
|
||
|
G(NODE_INT), G(NODE_FLOAT), G(NODE_BOOL), \
|
||
|
G(NODE_STRING), G(NODE_SYMBOL)
|
||
|
|
||
|
MK_ENUM_H(NodeKind, NODE_KIND);
|
||
|
|
||
|
struct node
|
||
|
{
|
||
|
NodeKind kind;
|
||
|
struct token* token;
|
||
|
struct vec children;
|
||
|
int line;
|
||
|
};
|
||
|
|
||
|
void node_init(struct node* self,
|
||
|
NodeKind kind,
|
||
|
struct token* token,
|
||
|
int line);
|
||
|
|
||
|
void node_free(struct node* self);
|
||
|
|
||
|
void node_str(struct node* self, struct str* str);
|
||
|
|
||
|
void node_add_new_child(struct node* self, struct node* child);
|
||
|
|
||
|
#endif
|