Commits

Kirill Simonov  committed 48a9960

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.

  • Participants
  • Parent commits 9761d16

Comments (0)

Files changed (1)

File src/parser.c

     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 &&
 
     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;
     }