Ruby 4.1.0dev (2026-05-16 revision 30bb8246d45e7178134b23c0c4495ed866a8e27b)
serialize.h
Go to the documentation of this file.
1
6#ifndef PRISM_SERIALIZE_H
7#define PRISM_SERIALIZE_H
8
9#include "prism/excludes.h"
10
11/* We optionally support serializing to a binary string. For systems that do not
12 * want or need this functionality, it can be turned off with the
13 * PRISM_EXCLUDE_SERIALIZATION define. */
14#ifndef PRISM_EXCLUDE_SERIALIZATION
15
18
19#include "prism/buffer.h"
20#include "prism/parser.h"
21#include "prism/source.h"
22#include "prism/stream.h"
23
32
41PRISM_EXPORTED_FUNCTION void pm_serialize_parse(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
42
52
61PRISM_EXPORTED_FUNCTION void pm_serialize_parse_comments(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
62
71PRISM_EXPORTED_FUNCTION void pm_serialize_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
72
82PRISM_EXPORTED_FUNCTION void pm_serialize_parse_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
83
92PRISM_EXPORTED_FUNCTION bool pm_serialize_parse_success_p(const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1);
93
94#endif
95
96#endif
A header file that defines macros to exclude certain features of the prism library.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition exported.h:20
The parser used to parse Ruby source.
A wrapper around a contiguous block of allocated memory.
#define PRISM_NONNULL(...)
Mark the parameters of a function as non-null.
Definition nonnull.h:13
PRISM_EXPORTED_FUNCTION void pm_serialize(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) PRISM_NONNULL(1
Serialize the AST represented by the given node to the given buffer.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION bool pm_serialize_parse_success_p(const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1)
Parse the source and return true if it parses without errors or warnings.
Definition serialize.c:2264
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_serialize_parse_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1
Parse and serialize both the AST and the tokens represented by the given source to the given buffer.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_serialize_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1
Lex the given source and serialize to the given buffer.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_serialize_parse_comments(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1
Parse and serialize the comments in the given source to the given buffer.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_serialize_parse(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1
Parse the given source to the AST and dump the AST to the given buffer.
PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, pm_source_t *source, const char *data) PRISM_NONNULL(1
Parse and serialize the AST represented by the given source into the given buffer.
An opaque type representing the source code being parsed, regardless of origin (constant memory,...
Functions for parsing streams.
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1065