25 lines
720 B
C
25 lines
720 B
C
#ifndef _AST_NODE_H_
|
|
#define _AST_NODE_H_
|
|
|
|
#include <fx/ds/string.h>
|
|
#include <ivy/lang/ast.h>
|
|
#include <ivy/lang/lex.h>
|
|
|
|
struct ast_node_type {
|
|
void (*n_to_string)(struct ivy_ast_node *, fx_string *);
|
|
void (*n_collect_children)(
|
|
struct ivy_ast_node *, struct ivy_ast_node_iterator *);
|
|
void (*n_destroy)(struct ivy_ast_node *);
|
|
|
|
size_t n_state_size;
|
|
size_t n_node_size;
|
|
};
|
|
|
|
extern const struct ast_node_type *get_ast_node_type(enum ivy_ast_node_type type);
|
|
extern enum token_expr_type get_token_expr_type(struct ivy_token *tok);
|
|
extern struct ivy_ast_node *ast_node_create(enum ivy_ast_node_type type);
|
|
extern enum ivy_status ast_node_add_child(
|
|
struct ivy_ast_node *parent, struct ivy_ast_node *child);
|
|
|
|
#endif
|