lang: ast: replace ast node print callback with to_string
This commit is contained in:
@@ -142,11 +142,11 @@ static enum ivy_status add_child(
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static void print(struct ivy_ast_node *node)
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
{
|
||||
struct ivy_ast_class_node *c = (struct ivy_ast_class_node *)node;
|
||||
|
||||
printf("%s(%s)\n", ivy_ast_node_type_to_string(node->n_type),
|
||||
b_string_append_cstrf(str, "%s (%s)", ivy_ast_node_type_to_string(node->n_type),
|
||||
c->n_ident->t_str);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ static void collect_children(
|
||||
|
||||
struct ast_node_type class_node_ops = {
|
||||
.n_add_child = add_child,
|
||||
.n_print = print,
|
||||
.n_to_string = to_string,
|
||||
.n_init_state = init_state,
|
||||
.n_collect_children = collect_children,
|
||||
.n_state_size = sizeof(struct class_parser_state),
|
||||
|
||||
Reference in New Issue
Block a user