From 8293d5a014ee2e186233e36e9d30afde76dea35a Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 5 Dec 2024 20:41:35 +0900 Subject: [PATCH] fix unknown secondary tag behavior --- parser/parser.go | 3 --- parser/parser_test.go | 9 +-------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index dee4e25..46a1c7d 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -880,9 +880,6 @@ func (p *parser) parseTagValue(ctx *context, tagRawTk *token.Token, tk *Token) ( } return p.parseSequence(ctx) } - if strings.HasPrefix(tagRawTk.Value, "!!") { - return nil, errors.ErrSyntax(fmt.Sprintf("unknown secondary tag name %q specified", tagRawTk.Value), tagRawTk) - } return p.parseToken(ctx, tk) } diff --git a/parser/parser_test.go b/parser/parser_test.go index 8d1db7b..c82adb7 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -70,6 +70,7 @@ func TestParser(t *testing.T) { "%YAML 1.2\n---\n", "a: !!binary gIGC\n", "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", + "v: !!foo 1", "v:\n- A\n- |-\n B\n C\n", "v:\n- A\n- >-\n B\n C\n", "v: |-\n 0\n", @@ -1029,14 +1030,6 @@ func TestSyntaxError(t *testing.T) { source string expect string }{ - { - `v: !!int64 2`, - ` -[1:4] unknown secondary tag name "!!int64" specified -> 1 | v: !!int64 2 - ^ -`, - }, { ` a: