rapidyaml  0.7.1
parse and emit YAML, and do it fast
Parse in place with existing parser

parse a mutable YAML source buffer. More...

Functions

void c4::yml::parse_in_place (Parser *parser, csubstr filename, substr yaml, Tree *t, id_type node_id)
 (1) parse YAML into an existing tree node. More...
 
void c4::yml::parse_in_place (Parser *parser, substr yaml, Tree *t, id_type node_id)
 (2) like (1) but no filename will be reported More...
 
void c4::yml::parse_in_place (Parser *parser, csubstr filename, substr yaml, Tree *t)
 (3) parse YAML into an existing tree, into its root node. More...
 
void c4::yml::parse_in_place (Parser *parser, substr yaml, Tree *t)
 (4) like (3) but no filename will be reported More...
 
void c4::yml::parse_in_place (Parser *parser, csubstr filename, substr yaml, NodeRef node)
 (5) like (1) but the node is given as a NodeRef More...
 
void c4::yml::parse_in_place (Parser *parser, substr yaml, NodeRef node)
 (6) like (5) but no filename will be reported More...
 
Tree c4::yml::parse_in_place (Parser *parser, csubstr filename, substr yaml)
 (7) create a new tree, and parse YAML into its root node. More...
 
Tree c4::yml::parse_in_place (Parser *parser, substr yaml)
 (8) like (7) but no filename will be reported More...
 
void c4::yml::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. More...
 
void c4::yml::parse_json_in_place (Parser *parser, substr json, Tree *t, id_type node_id)
 (2) like (1) but no filename will be reported More...
 
void c4::yml::parse_json_in_place (Parser *parser, csubstr filename, substr json, Tree *t)
 (3) parse JSON into an existing tree, into its root node. More...
 
void c4::yml::parse_json_in_place (Parser *parser, substr json, Tree *t)
 (4) like (3) but no filename will be reported More...
 
void c4::yml::parse_json_in_place (Parser *parser, csubstr filename, substr json, NodeRef node)
 (5) like (1) but the node is given as a NodeRef More...
 
void c4::yml::parse_json_in_place (Parser *parser, substr json, NodeRef node)
 (6) like (5) but no filename will be reported More...
 
Tree c4::yml::parse_json_in_place (Parser *parser, csubstr filename, substr json)
 (7) create a new tree, and parse JSON into its root node. More...
 
Tree c4::yml::parse_json_in_place (Parser *parser, substr json)
 (8) like (7) but no filename will be reported More...
 

Detailed Description

parse a mutable YAML source buffer.

Scalars requiring filtering are mutated in place (except in the rare cases where the filtered scalar is longer than the original scalar, or where filtering was disabled before the call). These overloads accept an existing parser object, and provide the opportunity to use special parser options.

See also
ParserOptions

Function Documentation

◆ parse_in_place() [1/8]

void c4::yml::parse_in_place ( Parser parser,
csubstr  filename,
substr  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. The callbacks in the
                                                                    tree are kept, and used to allocate
                                                                    the tree members, if any allocation is required. 

Definition at line 37 of file parse.cpp.

38 {
39  _reset_tree_handler(parser, t, node_id);
40  parser->parse_in_place_ev(filename, yaml);
41 }

References c4::yml::ParseEngine< EventHandler >::parse_in_place_ev().

Referenced by c4::yml::parse_in_arena(), c4::yml::parse_in_place(), sample::sample_docs(), sample::sample_lightning_overview(), sample::sample_parse_file(), sample::sample_parse_in_place(), sample::sample_quick_overview(), sample::sample_std_types(), and sample::sample_tree_arena().

◆ parse_in_place() [2/8]

void c4::yml::parse_in_place ( Parser parser,
substr  yaml,
Tree t,
id_type  node_id 
)

(2) like (1) but no filename will be reported

Definition at line 51 of file parse.cpp.

51 { parse_in_place(parser, {}, yaml, t, node_id); }
Tree parse_in_place(substr yaml)
(8) like (7) but no filename will be reported
Definition: parse.cpp:67

References c4::yml::parse_in_place().

◆ parse_in_place() [3/8]

void c4::yml::parse_in_place ( Parser parser,
csubstr  filename,
substr  yaml,
Tree t 
)

(3) parse YAML into an existing tree, into its root node.

                                                     The filename will be used in any error messages
                                                     arising during the parse. The callbacks in the
                                                     tree are kept, and used to allocate
                                                     the tree members, if any allocation is required. 

Definition at line 52 of file parse.cpp.

52 { RYML_CHECK(t); parse_in_place(parser, filename, yaml, t, t->root_id()); }

References c4::yml::parse_in_place(), and c4::yml::Tree::root_id().

◆ parse_in_place() [4/8]

void c4::yml::parse_in_place ( Parser parser,
substr  yaml,
Tree t 
)

(4) like (3) but no filename will be reported

Definition at line 53 of file parse.cpp.

53 { RYML_CHECK(t); parse_in_place(parser, {} , yaml, t, t->root_id()); }

References c4::yml::parse_in_place(), and c4::yml::Tree::root_id().

◆ parse_in_place() [5/8]

void c4::yml::parse_in_place ( Parser parser,
csubstr  filename,
substr  yaml,
NodeRef  node 
)

(5) like (1) but the node is given as a NodeRef

Definition at line 54 of file parse.cpp.

54 { RYML_CHECK(!node.invalid()); parse_in_place(parser, filename, yaml, node.tree(), node.id()); }

References c4::yml::NodeRef::id(), c4::yml::NodeRef::invalid(), c4::yml::parse_in_place(), and c4::yml::NodeRef::tree().

◆ parse_in_place() [6/8]

void c4::yml::parse_in_place ( Parser parser,
substr  yaml,
NodeRef  node 
)

(6) like (5) but no filename will be reported

Definition at line 55 of file parse.cpp.

55 { RYML_CHECK(!node.invalid()); parse_in_place(parser, {} , yaml, node.tree(), node.id()); }

References c4::yml::NodeRef::id(), c4::yml::NodeRef::invalid(), c4::yml::parse_in_place(), and c4::yml::NodeRef::tree().

◆ parse_in_place() [7/8]

Tree c4::yml::parse_in_place ( Parser parser,
csubstr  filename,
substr  yaml 
)

(7) create a new tree, and parse YAML into its root node.

                                              The filename will be used in any error messages
                                              arising during the parse. The tree is created with
                                              the callbacks currently in the parser.

Definition at line 56 of file parse.cpp.

56 { RYML_CHECK(parser); RYML_CHECK(parser->m_evt_handler); Tree tree(parser->callbacks()); parse_in_place(parser, filename, yaml, &tree, tree.root_id()); return tree; }

References c4::yml::ParseEngine< EventHandler >::callbacks(), c4::yml::parse_in_place(), and c4::yml::Tree::root_id().

◆ parse_in_place() [8/8]

Tree c4::yml::parse_in_place ( Parser parser,
substr  yaml 
)

(8) like (7) but no filename will be reported

Definition at line 57 of file parse.cpp.

57 { RYML_CHECK(parser); RYML_CHECK(parser->m_evt_handler); Tree tree(parser->callbacks()); parse_in_place(parser, {} , yaml, &tree, tree.root_id()); return tree; }

References c4::yml::ParseEngine< EventHandler >::callbacks(), c4::yml::parse_in_place(), and c4::yml::Tree::root_id().

◆ parse_json_in_place() [1/8]

void c4::yml::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.

Definition at line 43 of file parse.cpp.

44 {
45  _reset_tree_handler(parser, t, node_id);
46  parser->parse_json_in_place_ev(filename, json);
47 }

References c4::yml::ParseEngine< EventHandler >::parse_json_in_place_ev().

Referenced by c4::yml::parse_json_in_arena(), and c4::yml::parse_json_in_place().

◆ parse_json_in_place() [2/8]

void c4::yml::parse_json_in_place ( Parser parser,
substr  json,
Tree t,
id_type  node_id 
)

(2) like (1) but no filename will be reported

Definition at line 71 of file parse.cpp.

71 { parse_json_in_place(parser, {}, json, t, node_id); }
Tree parse_json_in_place(substr json)
(8) like (7) but no filename will be reported
Definition: parse.cpp:87

References c4::yml::parse_json_in_place().

◆ parse_json_in_place() [3/8]

void c4::yml::parse_json_in_place ( Parser parser,
csubstr  filename,
substr  json,
Tree t 
)

(3) parse JSON into an existing tree, into its root node.

Definition at line 72 of file parse.cpp.

72 { RYML_CHECK(t); parse_json_in_place(parser, filename, json, t, t->root_id()); }

References c4::yml::parse_json_in_place(), and c4::yml::Tree::root_id().

◆ parse_json_in_place() [4/8]

void c4::yml::parse_json_in_place ( Parser parser,
substr  json,
Tree t 
)

(4) like (3) but no filename will be reported

Definition at line 73 of file parse.cpp.

73 { RYML_CHECK(t); parse_json_in_place(parser, {} , json, t, t->root_id()); }

References c4::yml::parse_json_in_place(), and c4::yml::Tree::root_id().

◆ parse_json_in_place() [5/8]

void c4::yml::parse_json_in_place ( Parser parser,
csubstr  filename,
substr  json,
NodeRef  node 
)

(5) like (1) but the node is given as a NodeRef

Definition at line 74 of file parse.cpp.

74 { RYML_CHECK(!node.invalid()); parse_json_in_place(parser, filename, json, node.tree(), node.id()); }

References c4::yml::NodeRef::id(), c4::yml::NodeRef::invalid(), c4::yml::parse_json_in_place(), and c4::yml::NodeRef::tree().

◆ parse_json_in_place() [6/8]

void c4::yml::parse_json_in_place ( Parser parser,
substr  json,
NodeRef  node 
)

(6) like (5) but no filename will be reported

Definition at line 75 of file parse.cpp.

75 { RYML_CHECK(!node.invalid()); parse_json_in_place(parser, {} , json, node.tree(), node.id()); }

References c4::yml::NodeRef::id(), c4::yml::NodeRef::invalid(), c4::yml::parse_json_in_place(), and c4::yml::NodeRef::tree().

◆ parse_json_in_place() [7/8]

Tree c4::yml::parse_json_in_place ( Parser parser,
csubstr  filename,
substr  json 
)

(7) create a new tree, and parse JSON into its root node.

Definition at line 76 of file parse.cpp.

76 { RYML_CHECK(parser); RYML_CHECK(parser->m_evt_handler); Tree tree(parser->callbacks()); parse_json_in_place(parser, filename, json, &tree, tree.root_id()); return tree; }

References c4::yml::ParseEngine< EventHandler >::callbacks(), c4::yml::parse_json_in_place(), and c4::yml::Tree::root_id().

◆ parse_json_in_place() [8/8]

Tree c4::yml::parse_json_in_place ( Parser parser,
substr  json 
)

(8) like (7) but no filename will be reported

Definition at line 77 of file parse.cpp.

77 { RYML_CHECK(parser); RYML_CHECK(parser->m_evt_handler); Tree tree(parser->callbacks()); parse_json_in_place(parser, {} , json, &tree, tree.root_id()); return tree; }

References c4::yml::ParseEngine< EventHandler >::callbacks(), c4::yml::parse_json_in_place(), and c4::yml::Tree::root_id().