rapidyaml  0.16.0
parseandemitYAML,anddoitfast
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 
11 namespace c4 {
12 namespace yml {
13 
14 class Tree;
15 class NodeRef;
16 template<class EventHandler> class ParseEngine;
17 struct 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  * */
38 using Parser = ParseEngine<EventHandlerTree>;
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 
59 RYML_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. */
65 RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, Tree *t, id_type node_id); /**< (2) like (1) but no filename will be reported */
66 RYML_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. */
72 RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, Tree *t ); /**< (4) like (3) but no filename will be reported */
73 RYML_EXPORT void parse_in_place(Parser *parser, csubstr filename, substr yaml, NodeRef node ); /**< (5) like (1) but the node is given as a NodeRef */
74 RYML_EXPORT void parse_in_place(Parser *parser, substr yaml, NodeRef node ); /**< (6) like (5) but no filename will be reported */
75 RYML_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  */
81 RYML_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.
85 RYML_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.
86 RYML_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
87 RYML_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.
88 RYML_EXPORT void parse_json_in_place(Parser *parser, substr json, Tree *t ); ///< (4) like (3) but no filename will be reported
89 RYML_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
90 RYML_EXPORT void parse_json_in_place(Parser *parser, substr json, NodeRef node ); ///< (6) like (5) but no filename will be reported
91 RYML_EXPORT Tree parse_json_in_place(Parser *parser, csubstr filename, substr json ); ///< (7) create a new tree, and parse JSON into its root node.
92 RYML_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.
117 RYML_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.
118 RYML_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
119 RYML_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.
120 RYML_EXPORT void parse_in_place( substr yaml, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
121 RYML_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
122 RYML_EXPORT void parse_in_place( substr yaml, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
123 RYML_EXPORT Tree parse_in_place(csubstr filename, substr yaml , ParserOptions const& opts={}); ///< (7) create a new tree, and parse YAML into its root node.
124 RYML_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.
127 RYML_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.
128 RYML_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
129 RYML_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.
130 RYML_EXPORT void parse_json_in_place( substr json, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
131 RYML_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
132 RYML_EXPORT void parse_json_in_place( substr json, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
133 RYML_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.
134 RYML_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.
193 RYML_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.
194 RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, Tree *t, id_type node_id); ///< (2) like (1) but no filename will be reported
195 RYML_EXPORT void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *t ); ///< (3) parse YAML into an existing tree, into its root node.
196 RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, Tree *t ); ///< (4) like (3) but no filename will be reported
197 RYML_EXPORT void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, NodeRef node ); ///< (5) like (1) but the node is given as a NodeRef
198 RYML_EXPORT void parse_in_arena(Parser *parser, csubstr yaml, NodeRef node ); ///< (6) like (5) but no filename will be reported
199 RYML_EXPORT Tree parse_in_arena(Parser *parser, csubstr filename, csubstr yaml ); ///< (7) create a new tree, and parse YAML into its root node.
200 RYML_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.
203 RYML_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.
204 RYML_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
205 RYML_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.
206 RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr json, Tree *t ); ///< (4) like (3) but no filename will be reported
207 RYML_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
208 RYML_EXPORT void parse_json_in_arena(Parser *parser, csubstr json, NodeRef node ); ///< (6) like (5) but no filename will be reported
209 RYML_EXPORT Tree parse_json_in_arena(Parser *parser, csubstr filename, csubstr json ); ///< (7) create a new tree, and parse JSON into its root node.
210 RYML_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 */
219 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, Tree *t, id_type node_id);
220 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, Tree *t, id_type node_id);
221 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, Tree *t );
222 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, Tree *t );
223 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, substr yaml, NodeRef node );
224 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(Parser *parser, csubstr filename, substr yaml, NodeRef node );
225 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(Parser *parser, substr yaml );
226 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(Parser *parser, csubstr filename, substr yaml );
227 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, Tree *t, id_type node_id);
228 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, Tree *t, id_type node_id);
229 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, Tree *t );
230 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, Tree *t );
231 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, substr json, NodeRef node );
232 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(Parser *parser, csubstr filename, substr json, NodeRef node );
233 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena(Parser *parser, substr json );
234 RYML_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.
279 RYML_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.
280 RYML_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
281 RYML_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.
282 RYML_EXPORT void parse_in_arena( csubstr yaml, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
283 RYML_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
284 RYML_EXPORT void parse_in_arena( csubstr yaml, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
285 RYML_EXPORT Tree parse_in_arena(csubstr filename, csubstr yaml , ParserOptions const& opts={}); ///< (7) create a new tree, and parse YAML into its root node.
286 RYML_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.
289 RYML_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.
290 RYML_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
291 RYML_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.
292 RYML_EXPORT void parse_json_in_arena( csubstr json, Tree *t , ParserOptions const& opts={}); ///< (4) like (3) but no filename will be reported
293 RYML_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
294 RYML_EXPORT void parse_json_in_arena( csubstr json, NodeRef node , ParserOptions const& opts={}); ///< (6) like (5) but no filename will be reported
295 RYML_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.
296 RYML_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 */
305 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, Tree *t, id_type node_id);
306 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, Tree *t, id_type node_id);
307 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, Tree *t );
308 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, Tree *t );
309 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena( substr yaml, NodeRef node );
310 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_in_arena(csubstr filename, substr yaml, NodeRef node );
311 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena( substr yaml );
312 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_in_arena(csubstr filename, substr yaml );
313 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, Tree *t, id_type node_id);
314 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, Tree *t, id_type node_id);
315 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, Tree *t );
316 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, Tree *t );
317 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena( substr json, NodeRef node );
318 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) void parse_json_in_arena(csubstr filename, substr json, NodeRef node );
319 RYML_DEPRECATED(RYML_DONT_PARSE_SUBSTR_IN_ARENA) Tree parse_json_in_arena( substr json );
320 RYML_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_ */
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
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
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
Common utilities and infrastructure used by ryml.
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
Parser parser
Definition: parse.cpp:117
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
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
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
#define RYML_EXPORT
Definition: export.hpp:18
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