Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plain-url-in-flow-mapping #580

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix plain-url-in-flow-mapping
goccy committed Dec 9, 2024
commit 7a84d32d537dc6b19c5b345116989051e121d198
4 changes: 4 additions & 0 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
@@ -940,6 +940,10 @@ func (s *Scanner) scanMapDelim(ctx *Context) (bool, error) {
if s.startedFlowMapNum <= 0 && nc != ' ' && nc != '\t' && !s.isNewLineChar(nc) && !ctx.isNextEOS() {
return false, nil
}
if s.startedFlowMapNum > 0 && nc == '/' {
// like http://
return false, nil
}

if strings.HasPrefix(strings.TrimPrefix(string(ctx.obuf), " "), "\t") && !strings.HasPrefix(string(ctx.buf), "\t") {
invalidTk := token.Invalid("tab character cannot use as a map key directly", string(ctx.obuf), s.pos())
1 change: 0 additions & 1 deletion yaml_test_suite_test.go
Original file line number Diff line number Diff line change
@@ -51,7 +51,6 @@ var failureTestNames = []string{
"nested-implicit-complex-keys", // no json.
"node-anchor-not-indented", // pass yamlv3.
"plain-dashes-in-flow-sequence",
"plain-url-in-flow-mapping", // pass yamlv3.
"question-mark-edge-cases/00", // no json.
"question-mark-edge-cases/01", // no json.
"scalar-value-with-two-anchors", // pass yamlv3.