diff options
author | Kirill Simonov <xi@resolvent.net> | 2007-04-17 17:39:54 +0000 |
---|---|---|
committer | Kirill Simonov <xi@resolvent.net> | 2007-04-17 17:39:54 +0000 |
commit | 5e52c31904e21cf7a80a1ebd7a349c59f13e6aed (patch) | |
tree | dae8005b5caa0f2793dc07d62826f4c2e2a0f6c1 | |
parent | dd71484beb4d75c81b1e2c84a752bd04be632e3a (diff) | |
download | libyaml-git-5e52c31904e21cf7a80a1ebd7a349c59f13e6aed.tar.gz |
Fixed a problem when the DOCUMENT-END event is not emitted until the beginning of the next document is available. Fixed #51. Thanks edward(at)sweetbytes.net for the bug report.
-rw-r--r-- | src/parser.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c index bad2fc6..81122f6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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 && @@ -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; } |