Ruby 4.1.0dev (2026-09-04 revision 4eaa91451d9394c5dbd5ecbb6f5c678b1820a376)
serialize.h
1#ifndef PRISM_INTERNAL_SERIALIZE_H
2#define PRISM_INTERNAL_SERIALIZE_H
3
4#include "prism/internal/encoding.h"
5#include "prism/internal/list.h"
6
7#include "prism/ast.h"
8#include "prism/buffer.h"
9#include "prism/excludes.h"
10#include "prism/parser.h"
11
12/* We optionally support serializing to a binary string. For systems that do not
13 * want or need this functionality, it can be turned off with the
14 * PRISM_EXCLUDE_SERIALIZATION define. */
15#ifndef PRISM_EXCLUDE_SERIALIZATION
16
17/*
18 * Serialize the given list of offsets to the given buffer.
19 */
20void pm_serialize_line_offset_list(pm_line_offset_list_t *list, pm_buffer_t *buffer);
21
22/*
23 * Serialize the given list of comments to the given buffer.
24 */
25void pm_serialize_comment_list(pm_list_t *list, pm_buffer_t *buffer);
26
27/*
28 * Serialize the name of the encoding to the buffer.
29 */
30void pm_serialize_encoding(const pm_encoding_t *encoding, pm_buffer_t *buffer);
31
32/*
33 * Serialize the encoding, metadata, nodes, and constant pool.
34 */
35void pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer);
36
37#endif
38
39#endif
A header file that defines macros to exclude certain features of the prism library.
The parser used to parse Ruby source.
A wrapper around a contiguous block of allocated memory.
A list of offsets of the start of lines in a string.
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1083