Ruby 4.1.0dev (2026-04-17 revision 9c682d3d562a3754a636ca40075dbce59d23a14e)
node.h
Go to the documentation of this file.
1
6#ifndef PRISM_NODE_H
7#define PRISM_NODE_H
8
11
12#include "prism/ast.h"
13
18#define PM_NODE_LIST_FOREACH(list, index, node) \
19 for (size_t index = 0; index < (list)->size && ((node) = (list)->nodes[index]); index++)
20
27PRISM_EXPORTED_FUNCTION const char * pm_node_type(pm_node_type_t node_type);
28
81PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1);
82
92PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1);
93
94#endif
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition exported.h:20
#define PRISM_NONNULL(...)
Mark the parameters of a function as non-null.
Definition nonnull.h:13
PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool(*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1)
Visit the children of the given node with the given callback.
Definition node.c:420
PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool(*visitor)(const pm_node_t *node, void *data), void *data) PRISM_NONNULL(1)
Visit each of the nodes in this subtree using the given visitor callback.
Definition node.c:410
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1065