rapidyaml 0.16.0
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
parse.hpp
Go to the documentation of this file.
1#ifndef C4_YML_PARSE_HPP_
2#define C4_YML_PARSE_HPP_
3
4#ifndef C4_YML_COMMON_HPP_
5#include "c4/yml/common.hpp"
6#endif
7#ifndef C4_YML_PARSE_OPTIONS_HPP_
9#endif
10
11namespace c4 {
12namespace yml {
13
14class Tree;
15class NodeRef;
16template<class EventHandler> class ParseEngine;
17struct EventHandlerTree;
19
20
21/** @addtogroup doc_parse
22 * @{ */
23
24/** This is the main ryml parser, where the parser events are handled
25 * to create a ryml tree (see @ref doc_event_handlers).
26 *
27 * @warning This class cannot parse YAML which has container
28 * keys. This is not a limitation of the @ref ParseEngine itself, but of the
29 * @ref EventHandlerTree, which is present because the @ref Tree does
30 * not accept containers as keys. However, the @ref ParseEngine *can*
31 * parse container keys; consult its documentation for more details.
32 *
33 * @see @ref ParserOptions
34 * @see @ref ParseEngine
35 * @see @ref EventHandlerTree
36 * @see @ref doc_event_handlers
37 * */
39
40
41//-----------------------------------------------------------------------------
42
43/** @addtogroup doc_parse_in_place__with_existing_parser
44 *
45 * @brief parse a mutable YAML source buffer (re)using an existing
46 * parser. Scalars requiring filtering are mutated in place (except in
47 * the rare cases where the filtered scalar is longer than the
48 * original scalar, or where filtering was disabled before the
49 * call). These overloads accept an existing parser object, and
50 * provide the opportunity to use special parser options.
51 *
52 * @see ParserOptions
53 *
54 * @{
55 */
56
57// this is vertically aligned to highlight the parameter differences.
58
59RYML_EXPORT void parse_in_place(Parser *parser, csubstr filename, substr yaml, Tree *t, id_type node_id); /**< (1) parse YAML into an existing tree node.
60 *
61 * The filename will be used in any error messages
62 * arising during the parse. The callbacks in the
63 * tree are kept, and used to allocate
64 * the tree members, if any allocation is required. */
65RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, Tree *t, id_type node_id); /**< (2) like (1) but no filename will be reported */
66RYML_EXPORT void parse_in_place(Parser *parser, csubstr filename, substr yaml, Tree *t ); /**< (3) parse YAML into the root node of an existing tree.
67 *
68 * The filename will be used in any error messages
69 * arising during the parse. The callbacks in the
70 * tree are kept, and used to allocate
71 * the tree members, if any allocation is required. */
72RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, Tree *t ); /**< (4) like (3) but no filename will be reported */
73RYML_EXPORT void parse_in_place(Parser *parser, csubstr filename, substr yaml, NodeRef node ); /**< (5) like (1) but the node is given as a NodeRef */
74RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, NodeRef node ); /**< (6) like (5) but no filename will be reported */
75RYML_EXPORT Tree parse_in_place(Parser *parser, csubstr filename, substr yaml ); /**< (7) create a new tree, and parse YAML into its root node.
76 *
77 * The filename will be used in any error messages
78 * arising during the parse. The tree is created with
79 * the callbacks currently in the parser.
80 */
81RYML_EXPORT Tree parse_in_place(Parser *parser, substr yaml ); /**< (8) like (7) but no filename will be reported */
82
83
84// this is vertically aligned to highlight the parameter differences.
85RYML_EXPORT void parse_json_in_place(Parser *parser, csubstr filename, substr json, Tree *t, id_type node_id); ///< (1) parse JSON into an existing tree node. The filename will be used in any error messages arising during the parse.
86RYML_EXPORT void parse_json_in_place(Parser *parser, substr json, Tree *t, id_type node_id); ///< (2) like (1) but no filename will be reported
87RYML_EXPORT void parse_json_in_place(Parser *parser, csubstr filename, substr json, Tree *t ); ///< (3) parse JSON into an existing tree, into its root node.
88RYML_EXPORT void parse_json_in_place(Parser *parser, substr json, Tree *t ); ///< (4) like (3) but no filename will be reported
89RYML_EXPORT void parse_json_in_place(Parser *parser, csubstr filename, substr json, NodeRef node ); ///< (5) like (1) but the node is given as a NodeRef
90RYML_EXPORT void parse_json_in_place(Parser *parser, substr json, NodeRef node ); ///< (6) like (5) but no filename will be reported
91RYML_EXPORT Tree parse_json_in_place(Parser *parser, csubstr filename, substr json ); ///< (7) create a new tree, and parse JSON into its root node.
92RYML_EXPORT Tree parse_json_in_place(Parser *parser, substr json ); ///< (8) like (7) but no filename will be reported
93
94/** @} */
95
96
97//-----------------------------------------------------------------------------
98
99/** @addtogroup doc_parse_in_place___with_temporary_parser Parse in place with temporary parser
100 *
101 * @brief parse a mutable YAML source buffer. Scalars requiring
102 * filtering are mutated in place (except in the rare cases where the
103 * filtered scalar is longer than the original scalar).
104 *
105 * @note These freestanding functions use a temporary parser object,
106 * and are convenience functions to enable the user to easily parse
107 * YAML without the need to explicitly instantiate a parser and event
108 * handler. Note that some properties (notably node locations in the
109 * original source code) are only available through the parser
110 * class. If you need access to any of these properties, use
111 * the appropriate overload from @ref doc_parse_in_place__with_existing_parser
112 *
113 * @{
114 */
115
116// this is vertically aligned to highlight the parameter differences.
117RYML_EXPORT void parse_in_place(csubstr filename, substr yaml, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (1) parse YAML into an existing tree node. The filename will be used in any error messages arising during the parse.
118RYML_EXPORT void parse_in_place( substr yaml, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (2) like (1) but no filename will be reported
119RYML_EXPORT void parse_in_place(csubstr filename, substr yaml, Tree *t , ParserOptions const& opts={}); ///< (3) parse YAML into an existing tree, into its root node.
120RYML_EXPORT void parse_in_place( substr yaml, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
121RYML_EXPORT void parse_in_place(csubstr filename, substr yaml, NodeRef node , ParserOptions const& opts={}); ///< (5) like (1) but the node is given as a NodeRef
122RYML_EXPORT void parse_in_place( substr yaml, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
123RYML_EXPORT Tree parse_in_place(csubstr filename, substr yaml , ParserOptions const& opts={}); ///< (7) create a new tree, and parse YAML into its root node.
124RYML_EXPORT Tree parse_in_place( substr yaml , ParserOptions const& opts={}); ///< (8) like (7) but no filename will be reported
125
126// this is vertically aligned to highlight the parameter differences.
127RYML_EXPORT void parse_json_in_place(csubstr filename, substr json, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (1) parse JSON into an existing tree node. The filename will be used in any error messages arising during the parse.
128RYML_EXPORT void parse_json_in_place( substr json, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (2) like (1) but no filename will be reported
129RYML_EXPORT void parse_json_in_place(csubstr filename, substr json, Tree *t , ParserOptions const& opts={}); ///< (3) parse JSON into an existing tree, into its root node.
130RYML_EXPORT void parse_json_in_place( substr json, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
131RYML_EXPORT void parse_json_in_place(csubstr filename, substr json, NodeRef node , ParserOptions const& opts={}); ///< (5) like (1) but the node is given as a NodeRef
132RYML_EXPORT void parse_json_in_place( substr json, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
133RYML_EXPORT Tree parse_json_in_place(csubstr filename, substr json , ParserOptions const& opts={}); ///< (7) create a new tree, and parse JSON into its root node.
134RYML_EXPORT Tree parse_json_in_place( substr json , ParserOptions const& opts={}); ///< (8) like (7) but no filename will be reported
135
136/** @} */
137
138
139//-----------------------------------------------------------------------------
140
141
142/** @addtogroup doc_parse_in_arena__with_existing_parser Parse in arena with existing parser
143 *
144 * @brief parse a read-only (immutable) YAML source buffer. This is
145 * achieved by first copying the contents of the buffer to the tree's
146 * arena, and then calling @ref parse_in_arena() . All the resulting
147 * scalars will be filtered in the arena. These overloads accept an
148 * existing parser object, and provide the opportunity to use special
149 * parser options.
150 *
151 * @see ParserOptions
152 *
153 *
154 * @note These freestanding functions use a temporary parser object,
155 * and are convenience functions to easily parse YAML without the need
156 * to instantiate a separate parser. Note that some properties
157 * (notably node locations in the original source code) are only
158 * available through the parser class. If you need access to any of
159 * these properties, use the appropriate overload from @ref
160 * doc_parse_in_arena__with_existing_parser
161 *
162 * @warning overloads receiving a substr YAML buffer are intentionally
163 * left undefined, such that calling parse_in_arena() with a substr
164 * will cause a linker error. This is to prevent an accidental copy of
165 * the source buffer to the tree's arena, because substr (which is
166 * mutable) is implicitly convertible to csubstr (which is
167 * immutable). If you really intend to parse a mutable buffer in the
168 * tree's arena, convert it first to immutable by assigning the substr
169 * to a csubstr prior to calling parse_in_arena(). This is not needed
170 * for parse_in_place() because csubstr is not implicitly convertible
171 * to substr. To be clear:
172 * ```c++
173 * substr mutable_buffer = ...;
174 * parser.parse_in_arena(mutable_buffer); // linker error
175 *
176 * csubstr immutable_buffer = mutable_buffer; // convert first to csubstr
177 * parser.parse_in_arena(immutable_buffer); // ok
178 * ```
179 *
180 * @{
181 */
182/** @cond dev */
183#define RYML_DONT_PARSE_SUBSTR_IN_ARENA "" \
184 "Do not pass a (mutable) substr to parse_in_arena(); " \
185 "if you have a substr, it should be parsed in place. " \
186 "Consider using parse_in_place() instead, or convert " \
187 "the buffer to csubstr prior to calling. This function " \
188 " is deliberately left undefined, so that calling it " \
189 "will cause a linker error."
190/** @endcond */
191
192// this is vertically aligned to highlight the parameter differences.
193RYML_EXPORT void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *t, id_type node_id); ///< (1) parse YAML into an existing tree node. The filename will be used in any error messages arising during the parse.
194RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, Tree *t, id_type node_id); ///< (2) like (1) but no filename will be reported
195RYML_EXPORT void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *t ); ///< (3) parse YAML into an existing tree, into its root node.
196RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, Tree *t ); ///< (4) like (3) but no filename will be reported
197RYML_EXPORT void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, NodeRef node ); ///< (5) like (1) but the node is given as a NodeRef
198RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, NodeRef node ); ///< (6) like (5) but no filename will be reported
199RYML_EXPORT Tree parse_in_arena(Parser *parser, csubstr filename, csubstr yaml ); ///< (7) create a new tree, and parse YAML into its root node.
200RYML_EXPORT Tree parse_in_arena(Parser *parser, csubstr yaml ); ///< (8) like (7) but no filename will be reported
201
202// this is vertically aligned to highlight the parameter differences.
203RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr filename, csubstr json, Tree *t, id_type node_id); ///< (1) parse JSON into an existing tree node. The filename will be used in any error messages arising during the parse.
204RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr json, Tree *t, id_type node_id); ///< (2) like (1) but no filename will be reported
205RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr filename, csubstr json, Tree *t ); ///< (3) parse JSON into an existing tree, into its root node.
206RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr json, Tree *t ); ///< (4) like (3) but no filename will be reported
207RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr filename, csubstr json, NodeRef node ); ///< (5) like (1) but the node is given as a NodeRef
208RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr json, NodeRef node ); ///< (6) like (5) but no filename will be reported
209RYML_EXPORT Tree parse_json_in_arena(Parser *parser, csubstr filename, csubstr json ); ///< (7) create a new tree, and parse JSON into its root node.
210RYML_EXPORT Tree parse_json_in_arena(Parser *parser, csubstr json ); ///< (8) like (7) but no filename will be reported
211
212/* READ THE DEPRECATION NOTE!
213 *
214 * All of the functions below are intentionally left undefined, to
215 * prevent them being used.
216 *
217 */
218/** @cond dev */
219RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, Tree *t, id_type node_id);
220RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, Tree *t, id_type node_id);
221RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, Tree *t );
222RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, Tree *t );
223RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, NodeRef node );
224RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, NodeRef node );
225RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(Parser *parser, substr yaml );
226RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(Parser *parser, csubstr filename, substr yaml );
227RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, Tree *t, id_type node_id);
228RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, Tree *t, id_type node_id);
229RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, Tree *t );
230RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, Tree *t );
231RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, NodeRef node );
232RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, NodeRef node );
233RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena(Parser *parser, substr json );
234RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena(Parser *parser, csubstr filename, substr json );
235/** @endcond */
236
237/** @} */
238
239
240//-----------------------------------------------------------------------------
241
242
243/** @addtogroup doc_parse_in_arena__with_temporary_parser Parse in arena with temporary parser
244 *
245 * @brief parse a read-only (immutable) YAML source buffer. This is
246 * achieved by first copying the contents of the buffer to the tree's
247 * arena, and then calling @ref parse_in_arena() .
248 *
249 * @note These freestanding functions use a temporary parser object,
250 * and are convenience functions to easily one-off parse YAML without
251 * the need to instantiate a separate parser. Note that some
252 * properties (notably node locations in the original source code) are
253 * only available through the parser class. If you need access to any
254 * of these properties, use the appropriate overload from @ref
255 * doc_parse_in_arena__with_existing_parser
256 *
257 * @warning overloads receiving a substr YAML buffer are intentionally
258 * left undefined, such that calling parse_in_arena() with a substr
259 * will cause a linker error. This is to prevent an accidental copy of
260 * the source buffer to the tree's arena, because substr (which is
261 * mutable) is implicitly convertible to csubstr (which is
262 * immutable). If you really intend to parse a mutable buffer in the
263 * tree's arena, convert it first to immutable by assigning the substr
264 * to a csubstr prior to calling parse_in_arena(). This is not needed
265 * for parse_in_place() because csubstr is not implicitly convertible
266 * to substr. To be clear:
267 * ```c++
268 * substr mutable_buffer = ...;
269 * parser.parse_in_arena(mutable_buffer); // linker error
270 *
271 * csubstr immutable_buffer = mutable_buffer; // convert first to csubstr
272 * parser.parse_in_arena(immutable_buffer); // ok now
273 * ```
274 *
275 * @{
276 */
277
278// this is vertically aligned to highlight the parameter differences.
279RYML_EXPORT void parse_in_arena(csubstr filename, csubstr yaml, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (1) parse YAML into an existing tree node. The filename will be used in any error messages arising during the parse.
280RYML_EXPORT void parse_in_arena( csubstr yaml, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (2) like (1) but no filename will be reported
281RYML_EXPORT void parse_in_arena(csubstr filename, csubstr yaml, Tree *t , ParserOptions const& opts={}); ///< (3) parse YAML into an existing tree, into its root node.
282RYML_EXPORT void parse_in_arena( csubstr yaml, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
283RYML_EXPORT void parse_in_arena(csubstr filename, csubstr yaml, NodeRef node , ParserOptions const& opts={}); ///< (5) like (1) but the node is given as a NodeRef
284RYML_EXPORT void parse_in_arena( csubstr yaml, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
285RYML_EXPORT Tree parse_in_arena(csubstr filename, csubstr yaml , ParserOptions const& opts={}); ///< (7) create a new tree, and parse YAML into its root node.
286RYML_EXPORT Tree parse_in_arena( csubstr yaml , ParserOptions const& opts={}); ///< (8) like (7) but no filename will be reported
287
288// this is vertically aligned to highlight the parameter differences.
289RYML_EXPORT void parse_json_in_arena(csubstr filename, csubstr json, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (1) parse JSON into an existing tree node. The filename will be used in any error messages arising during the parse.
290RYML_EXPORT void parse_json_in_arena( csubstr json, Tree *t, id_type node_id, ParserOptions const& opts={}); ///< (2) like (1) but no filename will be reported
291RYML_EXPORT void parse_json_in_arena(csubstr filename, csubstr json, Tree *t , ParserOptions const& opts={}); ///< (3) parse JSON into an existing tree, into its root node.
292RYML_EXPORT void parse_json_in_arena( csubstr json, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
293RYML_EXPORT void parse_json_in_arena(csubstr filename, csubstr json, NodeRef node , ParserOptions const& opts={}); ///< (5) like (1) but the node is given as a NodeRef
294RYML_EXPORT void parse_json_in_arena( csubstr json, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
295RYML_EXPORT Tree parse_json_in_arena(csubstr filename, csubstr json , ParserOptions const& opts={}); ///< (7) create a new tree, and parse JSON into its root node.
296RYML_EXPORT Tree parse_json_in_arena( csubstr json , ParserOptions const& opts={}); ///< (8) like (7) but no filename will be reported
297
298
299/* READ THE DEPRECATION NOTE!
300 *
301 * All of the functions below are intentionally left undefined, to
302 * prevent them being used.
303 */
304/** @cond dev */
305RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, Tree *t, id_type node_id);
306RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, Tree *t, id_type node_id);
307RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, Tree *t );
308RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, Tree *t );
309RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, NodeRef node );
310RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, NodeRef node );
311RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena( substr yaml );
312RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(csubstr filename, substr yaml );
313RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, Tree *t, id_type node_id);
314RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, Tree *t, id_type node_id);
315RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, Tree *t );
316RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, Tree *t );
317RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, NodeRef node );
318RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, NodeRef node );
319RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena( substr json );
320RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena(csubstr filename, substr json );
321/** @endcond */
322
323/** @} */
324/** @} */
325
326} // namespace yml
327} // namespace c4
328
329#endif /* C4_YML_PARSE_HPP_ */
A reference to a node in an existing yaml tree, offering a more convenient API than the index-based A...
Definition node.hpp:1063
This is the main driver of parsing logic: it scans the YAML or JSON source for tokens,...
Common utilities and infrastructure used by ryml.
#define RYML_EXPORT
Definition export.hpp:18
void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *tree, id_type node_id)
(1) parse YAML into an existing tree node. The filename will be used in any error messages arising du...
Definition parse.cpp:209
void parse_json_in_arena(Parser *parser, csubstr filename, csubstr json, Tree *tree, id_type node_id)
(1) parse JSON into an existing tree node. The filename will be used in any error messages arising du...
Definition parse.cpp:231
void parse_json_in_place(Parser *parser, csubstr filename, substr json, Tree *tree, id_type node_id)
(1) parse JSON into an existing tree node. The filename will be used in any error messages arising du...
Definition parse.cpp:187
void parse_in_place(Parser *parser, csubstr filename, substr yaml, Tree *tree, id_type node_id)
(1) parse YAML into an existing tree node.
Definition parse.cpp:165
ParseEngine< EventHandlerTree > Parser
This is the main ryml parser, where the parser events are handled to create a ryml tree (see Event Ha...
Definition fwd.hpp:19
id_type estimate_tree_capacity(csubstr src)
Quickly inspect the source to estimate the number of nodes the resulting tree is likely to have.
Definition parse.cpp:254
basic_substring< char > substr
a mutable string view
Definition substr.hpp:2355
basic_substring< const char > csubstr
an immutable string view
Definition substr.hpp:2356
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
Definition common.hpp:124
The event handler to create a ryml Tree.
Options to give to the ParseEngine to control its behavior.