MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / yaml_parser_load

Function yaml_parser_load

external/libyaml/src/loader.c:86–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84 */
85
86YAML_DECLARE(int)
87yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document)
88{
89 yaml_event_t event;
90
91 assert(parser); /* Non-NULL parser object is expected. */
92 assert(document); /* Non-NULL document object is expected. */
93
94 memset(document, 0, sizeof(yaml_document_t));
95 if (!STACK_INIT(parser, document->nodes, yaml_node_t*))
96 goto error;
97
98 if (!parser->stream_start_produced) {
99 if (!yaml_parser_parse(parser, &event)) goto error;
100 assert(event.type == YAML_STREAM_START_EVENT);
101 /* STREAM-START is expected. */
102 }
103
104 if (parser->stream_end_produced) {
105 return 1;
106 }
107
108 if (!yaml_parser_parse(parser, &event)) goto error;
109 if (event.type == YAML_STREAM_END_EVENT) {
110 return 1;
111 }
112
113 if (!STACK_INIT(parser, parser->aliases, yaml_alias_data_t*))
114 goto error;
115
116 parser->document = document;
117
118 if (!yaml_parser_load_document(parser, &event)) goto error;
119
120 yaml_parser_delete_aliases(parser);
121 parser->document = NULL;
122
123 return 1;
124
125error:
126
127 yaml_parser_delete_aliases(parser);
128 yaml_document_delete(document);
129 parser->document = NULL;
130
131 return 0;
132}
133
134/*
135 * Set composer error.

Callers 2

load_documentMethod · 0.85
yaml.hFile · 0.85

Calls 4

yaml_parser_parseFunction · 0.85
yaml_document_deleteFunction · 0.85

Tested by

no test coverage detected