Skip to content

Commit

Permalink
fix unknown secondary tag behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Dec 5, 2024
1 parent 5d22eed commit 8293d5a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
3 changes: 0 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
9 changes: 1 addition & 8 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8293d5a

Please sign in to comment.