Ruby 3.3.7p123 (2025-01-15 revision be31f993d7fa0219d85f7b3c694d454da4ecc10b)
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
struct pm_node_list pm_node_list_t
A list of nodes in the source, most often used for lists of children.
struct pm_node pm_node_t
This is the base structure that represents a node in the syntax tree.
The parser used to parse Ruby source.
struct pm_parser pm_parser_t
The parser used to parse Ruby source.
Definition parser.h:259
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
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1061