diff --git a/parser/parser.go b/parser/parser.go index 55db6b96..169d5edc 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -830,6 +830,7 @@ func (p *parser) setSameLineCommentIfExists(ctx *context, node ast.Node) error { } func (p *parser) parseDocument(ctx *context) (*ast.DocumentNode, error) { + p.pathMap = make(map[string]ast.Node) startTk := p.currentToken() p.progress(1) // skip document header token body, err := p.parseToken(ctx, p.currentToken()) diff --git a/parser/parser_test.go b/parser/parser_test.go index 7d0eb107..66ad5e30 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -133,6 +133,13 @@ a: !tag a: b: c +`, + ` +foo: xxx +--- +foo: yyy +--- +foo: zzz `, } for _, src := range sources {