Skip to content

Commit

Permalink
fix parsing of tab indent in double-quote
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Dec 14, 2024
1 parent 9c4ec6e commit 0b9a668
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,17 @@ func (s *Scanner) scanDoubleQuote(ctx *Context) (*token.Token, error) {
}
}
continue
} else if isFirstLineChar && (c == ' ' || c == '\t') {
} else if isFirstLineChar && c == ' ' {
continue
} else if isFirstLineChar && c == '\t' {
if s.lastDelimColumn >= s.column {
return nil, ErrInvalidToken(
token.Invalid(
"tab character cannot be used for indentation in double-quoted text",
string(ctx.obuf), s.pos(),
),
)
}
continue
} else if c == '\\' {
isFirstLineChar = false
Expand Down
1 change: 0 additions & 1 deletion yaml_test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ var failureTestNames = []string{
"spec-example-9-6-stream",
"spec-example-9-6-stream-1-3",
"tabs-in-various-contexts/003",
"tabs-that-look-like-indentation/01",
"tabs-that-look-like-indentation/04",
"tag-shorthand-used-in-documents-but-only-defined-in-the-first",
"trailing-line-of-spaces/01", // last '\n' character is needed ?
Expand Down

0 comments on commit 0b9a668

Please sign in to comment.