Index: libyaml/trunk/src/parser.c
===================================================================
--- libyaml/trunk/src/parser.c	(revision 243)
+++ libyaml/trunk/src/parser.c	(revision 250)
@@ -353,4 +353,15 @@
     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. */
 
@@ -468,9 +479,7 @@
     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;
     }
