17 #define PM_NODE_LIST_FOREACH(list, index, node) \
18 for (size_t index = 0; index < (list)->size && ((node) = (list)->nodes[index]); index++)
uint16_t pm_node_type_t
This is the type of node embedded in the node struct.
The parser used to parse Ruby source.
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.
PRISM_EXPORTED_FUNCTION const char * pm_node_type_to_str(pm_node_type_t node_type)
Returns a string representation of the given node type.
PRISM_EXPORTED_FUNCTION void pm_node_destroy(pm_parser_t *parser, struct pm_node *node)
Deallocate a node and all of its children.
PRISM_EXPORTED_FUNCTION void pm_visit_node(const pm_node_t *node, bool(*visitor)(const pm_node_t *node, void *data), void *data)
Visit each of the nodes in this subtree using the given visitor callback.
void pm_node_list_free(pm_node_list_t *list)
Free the internal memory associated with the given node list.
PRISM_EXPORTED_FUNCTION void pm_visit_child_nodes(const pm_node_t *node, bool(*visitor)(const pm_node_t *node, void *data), void *data)
Visit the children of the given node with the given callback.
void pm_node_list_prepend(pm_node_list_t *list, pm_node_t *node)
Prepend a new node onto the beginning of the node list.
void pm_node_list_concat(pm_node_list_t *list, pm_node_list_t *other)
Concatenate the given node list onto the end of the other node list.
void pm_node_list_append(pm_node_list_t *list, pm_node_t *node)
Append a new node onto the end of the node list.
A list of nodes in the source, most often used for lists of children.
This is the base structure that represents a node in the syntax tree.
This struct represents the overall parser.