Ruby 3.3.2p78 (2024-05-30 revision e5a195edf62fe1bf7146a191da13fa1c4fecbd71)
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"
11
19
27
33typedef struct {
35 size_t memsize;
36
38 size_t node_count;
40
48
56
57#endif
uint16_t pm_node_type_t
This is the type of node embedded in the node struct.
Definition ast.h:1023
The parser used to parse Ruby source.
Macro definitions used throughout the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:32
PRISM_EXPORTED_FUNCTION void pm_node_destroy(pm_parser_t *parser, struct pm_node *node)
Deallocate a node and all of its children.
Definition node.c:61
PRISM_EXPORTED_FUNCTION void pm_node_memsize(pm_node_t *node, pm_memsize_t *memsize)
Calculates the memory footprint of a given node.
Definition node.c:2480
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.
Definition node.c:2489
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.
Definition node.c:30
This struct stores the information gathered by the pm_node_memsize function.
Definition node.h:33
size_t memsize
The total memory footprint of the node and all of its children.
Definition node.h:35
size_t node_count
The number of children the node has.
Definition node.h:38
A list of nodes in the source, most often used for lists of children.
Definition ast.h:556
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1061
This struct represents the overall parser.
Definition parser.h:489