lang: ast: define ast_node_type for some fundamental expression components
This commit is contained in:
28
lang/ast/msg.c
Normal file
28
lang/ast/msg.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_msg_node *msg = (struct ivy_ast_msg_node *)node;
|
||||
|
||||
if (msg->n_recipient) {
|
||||
ast_node_iterator_enqueue_node(iterator, node, msg->n_recipient);
|
||||
}
|
||||
|
||||
if (msg->n_sel) {
|
||||
ast_node_iterator_enqueue_node(iterator, node, msg->n_sel);
|
||||
}
|
||||
|
||||
b_queue_iterator it = {0};
|
||||
b_queue_foreach (&it, &msg->n_arg) {
|
||||
struct ivy_ast_node *arg = b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, arg);
|
||||
}
|
||||
}
|
||||
|
||||
struct ast_node_type msg_node_ops = {
|
||||
.n_collect_children = collect_children,
|
||||
.n_state_size = sizeof(struct parser_state),
|
||||
.n_node_size = sizeof(struct ivy_ast_msg_node),
|
||||
};
|
||||
Reference in New Issue
Block a user