summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c15
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;
}