Function yaml_parser_parse


#include <include/yaml.h>

int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)


Parse the input stream and produce the next parsing event.

Call the function subsequently to produce a sequence of events corresponding to the input stream. The initial event has the type YAML_STREAM_START_EVENT while the ending event has the type YAML_STREAM_END_EVENT.

An application is responsible for freeing any buffers associated with the produced event object using the yaml_event_delete() function.

An application must not alternate the calls of yaml_parser_parse() with the calls of yaml_parser_scan() or yaml_parser_load(). Doing this will break the parser.


[ in,out ] parser - A parser object.

[ out ] event - An empty event object.

1 if the function succeeded, 0 on error.
Get the next event.

Public API declarations.

Get the next event.

Mentioned in


Lines 169-189 in src/parser.c. Line 1432 in include/yaml.h.

yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
    assert(parser);     /* Non-NULL parser object is expected. */
    assert(event);      /* Non-NULL event object is expected. */

    /* Erase the event object. */

    memset(event, 0, sizeof(yaml_event_t));

    /* No events after the end of the stream or error. */

    if (parser->stream_end_produced || parser->error ||
            parser->state == YAML_PARSE_END_STATE) {
        return 1;

    /* Generate the next event. */

    return yaml_parser_state_machine(parser, event);

Add Discussion as Guest

Log in