Prism Ruby parser
Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
1
6#ifndef PRISM_NODE_H
7#define PRISM_NODE_H
8
9#include "prism/compiler/exported.h"
10#include "prism/compiler/nonnull.h"
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
The abstract syntax tree.
pm_node_type
This enum represents every type of node in the Ruby syntax tree.
Definition ast.h:586
uint16_t pm_node_type_t
This is the type of node embedded in the node struct.
Definition ast.h:1051
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.
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.
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1070