Skip to content

Commit

Permalink
Fixed a problem when the DOCUMENT-END event is not emitted until the …
Browse files Browse the repository at this point in the history
…beginning of the next document is available. Fixed #51.  Thanks edward(at)sweetbytes.net for the bug report.
  • Loading branch information
xitology committed Apr 17, 2007
1 parent dd71484 commit 5e52c31
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,17 @@ yaml_parser_parse_document_start(yaml_parser_t *parser, yaml_event_t *event,
token = PEEK_TOKEN(parser);
if (!token) return 0;

/* Parse extra document end indicators. */

if (!implicit)
{
while (token->type == YAML_DOCUMENT_END_TOKEN) {
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
}
}

/* Parse an implicit document. */

if (implicit && token->type != YAML_VERSION_DIRECTIVE_TOKEN &&
Expand Down Expand Up @@ -467,11 +478,9 @@ yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event)

start_mark = end_mark = token->start_mark;

while (token->type == YAML_DOCUMENT_END_TOKEN) {
if (token->type == YAML_DOCUMENT_END_TOKEN) {
end_mark = token->end_mark;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
implicit = 0;
}

Expand Down

0 comments on commit 5e52c31

Please sign in to comment.