ast: add lots of ast node definitions

This commit is contained in:
2026-05-12 22:59:29 +01:00
parent 1ea3471f0d
commit 83189d4d9b
13 changed files with 366 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#include "../parse/token.h"
#include "ast.h"
static enum bshell_status collect_children(
struct ast_node *node,
struct ast_iterator *it)
{
struct array_ast_node *array = (struct array_ast_node *)node;
fx_queue_entry *cur = fx_queue_first(&array->n_items);
while (cur) {
struct ast_node *child
= fx_unbox(struct ast_node, cur, n_entry);
ast_iterator_enqueue(it, child);
cur = fx_queue_next(cur);
}
return BSHELL_SUCCESS;
}
struct ast_node_definition array_ast_node = {
.def_id = AST_ARRAY,
.def_node_size = sizeof(struct array_ast_node),
.def_collect_children = collect_children,
};