diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go index 7b678c4b..b7950415 100644 --- a/lexer/lexer_test.go +++ b/lexer/lexer_test.go @@ -38,6 +38,18 @@ func TestTokenize(t *testing.T) { }, }, }, + { + YAML: `"hello\tworld"`, + Tokens: token.Tokens{ + { + Type: token.DoubleQuoteType, + CharacterType: token.CharacterTypeIndicator, + Indicator: token.QuotedScalarIndicator, + Value: "hello\tworld", + Origin: `"hello\tworld"`, + }, + }, + }, { YAML: `0x_1A_2B_3C`, Tokens: token.Tokens{ diff --git a/scanner/scanner.go b/scanner/scanner.go index fbddf7d2..366d18e1 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -345,6 +345,10 @@ func (s *Scanner) scanDoubleQuote(ctx *Context) (*token.Token, error) { progress = 1 ctx.addOriginBuf(nextChar) value = append(value, '\r') + case 't': + progress = 1 + ctx.addOriginBuf(nextChar) + value = append(value, '\t') case 'v': progress = 1 ctx.addOriginBuf(nextChar)