#ifndef CCM_NODE_H #define CCM_NODE_H #include "commons.h" #include "vec.h" #define NODE_KIND(G) \ G(NODE_MODULE), \ G(NODE_NUM), G(NODE_OPAR), G(NODE_CPAR), \ G(NODE_POW), G(NODE_ADD), G(NODE_SUB), G(NODE_MUL), \ G(NODE_DIV), G(NODE_MOD), G(NODE_COMMA), G(NODE_TUPLE), \ G(NODE_ASSERT_EQ), G(NODE_ASSERT_NE), G(NODE_BOOL), \ G(NODE_AND), G(NODE_OR), G(NODE_NOT), G(NODE_IN), \ G(NODE_OSQUARE), G(NODE_CSQUARE), G(NODE_INDEX), \ G(NODE_STR) CCM_ENUM_H(NodeKind, NODE_KIND); typedef struct { NodeKind kind; char* value; vec_t children; int line; } node_t; void node_init(node_t* self, NodeKind kind, char const* value, int line); void node_free(node_t* self); void node_push_new_child(node_t* self, node_t* child); size_t node_str(node_t* self, char* buffer, size_t size); #endif