diff options
author | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2007-04-17 17:39:54 +0000 |
---|---|---|
committer | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2007-04-17 17:39:54 +0000 |
commit | 7257620d0ca0fcefeea10d769bd7d56245837a43 (patch) | |
tree | dae8005b5caa0f2793dc07d62826f4c2e2a0f6c1 | |
parent | c26444af2d14ac8b4da1a092421d03375e1613bb (diff) | |
download | libyaml-7257620d0ca0fcefeea10d769bd7d56245837a43.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.
git-svn-id: http://svn.pyyaml.org/libyaml/trunk@250 18f92427-320e-0410-9341-c67f048884a3
-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; } |