9#include "prism/compiler/exported.h"
10#include "prism/compiler/nonnull.h"
22#define PM_NODE_LIST_FOREACH(list, index, node) \
23 for (size_t index = 0; index < (list)->size && ((node) = (list)->nodes[index]); index++)
struct pm_arena_t pm_arena_t
An opaque pointer to an arena that is used for allocations.
Definition arena.h:22
The abstract syntax tree.
pm_node_type
This enum represents every type of node in the Ruby syntax tree.
Definition ast.h:611
uint16_t pm_node_type_t
This is the type of node embedded in the node struct.
Definition ast.h:1076
PRISM_EXPORTED_FUNCTION void pm_node_list_append(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) PRISM_NONNULL(1
Append a node to the end of a node list.
pm_visit_result_t(* pm_visit_callback_t)(const pm_node_t *node, void *data)
A callback that is called for each node visited by pm_visit_node and pm_visit_child_nodes.
Definition node.h:65
PRISM_EXPORTED_FUNCTION bool pm_visit_node(const pm_node_t *node, pm_visit_callback_t visitor, void *data) PRISM_NONNULL(1)
Visit each of the nodes in this subtree using the given visitor callback.
pm_visit_result_t
The value returned by a visitor callback, which determines where the walk goes next.
Definition node.h:49
@ PM_VISIT_SKIP
Continue the walk without visiting this node's children.
Definition node.h:51
@ PM_VISIT_STOP
End the walk without visiting any more nodes.
Definition node.h:57
@ PM_VISIT_DESCEND
Continue the walk by visiting this node's children.
Definition node.h:54
PRISM_EXPORTED_FUNCTION bool pm_visit_child_nodes(const pm_node_t *node, pm_visit_callback_t visitor, void *data) PRISM_NONNULL(1)
Visit the children of the given node with the given callback.
A list of nodes in the source, most often used for lists of children.
Definition ast.h:597
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1095