Ruby 4.0.7p0 (2026-09-15 revision 229531a6cfbf07e3caef30dbac24a2a3f3fed482)
node.h
Go to the documentation of this file.
1
6#ifndef PRISM_NODE_H
7#define PRISM_NODE_H
8
9#include "prism/defines.h"
10#include "prism/parser.h"
12
17#define PM_NODE_LIST_FOREACH(list, index, node) \
18 for (size_t index = 0; index < (list)->size && ((node) = (list)->nodes[index]); index++)
19
26void pm_node_list_append(pm_node_list_t *list, pm_node_t *node);
27
34void pm_node_list_prepend(pm_node_list_t *list, pm_node_t *node);
35
42void pm_node_list_concat(pm_node_list_t *list, pm_node_list_t *other);
43
49void pm_node_list_free(pm_node_list_t *list);
50
57PRISM_EXPORTED_FUNCTION void pm_node_destroy(pm_parser_t *parser, struct pm_node *node);
58
65PRISM_EXPORTED_FUNCTION const char * pm_node_type_to_str(pm_node_type_t node_type);
66
116PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data);
117
127PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data);
128
129#endif
The parser used to parse Ruby source.
struct pm_parser pm_parser_t
The parser used to parse Ruby source.
Definition parser.h:267
A wrapper around a contiguous block of allocated memory.
Macro definitions used throughout the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:53
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1052