Prism Ruby parser
Loading...
Searching...
No Matches
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
16#include "prism/compiler/exported.h"
17#include "prism/compiler/nonnull.h"
18
19#include "prism/buffer.h"
20#include "prism/errors_format.h"
21#include "prism/parser.h"
22#include "prism/source.h"
23#include "prism/stream.h"
24
32PRISM_EXPORTED_FUNCTION void pm_serialize(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) PRISM_NONNULL(1, 2, 3);
33
42PRISM_EXPORTED_FUNCTION void pm_serialize_parse(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
43
52PRISM_EXPORTED_FUNCTION void pm_serialize_parse_stream(pm_buffer_t *buffer, pm_source_t *source, const char *data) PRISM_NONNULL(1, 2);
53
62PRISM_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);
63
72PRISM_EXPORTED_FUNCTION void pm_serialize_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1, 2);
73
83PRISM_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);
84
93PRISM_EXPORTED_FUNCTION bool pm_serialize_parse_success_p(const uint8_t *source, size_t size, const char *data) PRISM_NONNULL(1);
94
111PRISM_EXPORTED_FUNCTION int8_t pm_serialize_parse_errors_format(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data, pm_errors_format_type_t format_type) PRISM_NONNULL(1, 2);
112
113#endif
114
115#endif
A wrapper around a contiguous block of allocated memory.
struct pm_buffer_t pm_buffer_t
A wrapper around a contiguous block of allocated memory.
Definition buffer.h:18
A function for formatting the errors in a parser into a buffer.
pm_errors_format_type_t
The type of formatting to use when formatting errors.
Definition errors_format.h:18
A header file that defines macros to exclude certain features of the prism library.
The parser used to parse Ruby source.
struct pm_parser_t pm_parser_t
The parser used to parse Ruby source.
Definition parser.h:22
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.
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 int8_t pm_serialize_parse_errors_format(pm_buffer_t *buffer, const uint8_t *source, size_t size, const char *data, pm_errors_format_type_t format_type) PRISM_NONNULL(1
Parse the given source and format any errors that are encountered into the given buffer using the giv...
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,...
struct pm_source_t pm_source_t
An opaque type representing source code being parsed.
Definition source.h:21
Functions for parsing streams.
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1073