From d5db17f715af065ea682fd5c1bd5dbfb3bbcb895 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 15 Dec 2024 00:56:19 +0900 Subject: [PATCH] fix parsing of tab indent in single quote --- scanner/scanner.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scanner/scanner.go b/scanner/scanner.go index 13d2fff..fb068ed 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -250,7 +250,17 @@ func (s *Scanner) scanSingleQuote(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 single-quoted text", + string(ctx.obuf), s.pos(), + ), + ) + } continue } else if c != '\'' { value = append(value, c)