#include "node.h" #include #include #include static void to_string(struct ivy_ast_node *node, fx_string *str) { struct ivy_ast_unit_package_node *unit_package = (struct ivy_ast_unit_package_node *)node; fx_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type)); fx_string_append_cstr(str, " ("); int i = 0; fx_queue_entry *entry = fx_queue_first(&unit_package->n_ident); while (entry) { struct ivy_token *tok = fx_unbox(struct ivy_token, entry, t_entry); if (i > 0) { fx_string_append_cstr(str, "."); } fx_string_append_cstr(str, tok->t_str); i++; entry = fx_queue_next(entry); } fx_string_append_cstr(str, ")"); } struct ast_node_type unit_package_node_ops = { .n_to_string = to_string, .n_node_size = sizeof(struct ivy_ast_unit_package_node), };