From 4914d1f145ca08b8c33da93a90bb63c64ae8e3a1 Mon Sep 17 00:00:00 2001 From: Andy Scott Date: Thu, 24 Aug 2023 09:48:59 -0700 Subject: [PATCH] fix: embed parsing now handles double quote rune --- go/tools/builders/read.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/go/tools/builders/read.go b/go/tools/builders/read.go index b03c02bf25..4de61946f7 100644 --- a/go/tools/builders/read.go +++ b/go/tools/builders/read.go @@ -198,6 +198,28 @@ func (r *importReader) findEmbed(first bool) bool { case ' ', '\t': // leave startLine alone + case '\'': + startLine = false + for r.err == nil { + if r.eof { + r.syntaxError() + } + c = r.readByteNoBuf() + if c == '\\' { + _ = r.readByteNoBuf() + if r.err != nil { + r.syntaxError() + return false + } + continue + } + if c == '\'' { + c = r.readByteNoBuf() + goto Reswitch + } + } + goto Reswitch + case '"': startLine = false for r.err == nil { @@ -206,7 +228,7 @@ func (r *importReader) findEmbed(first bool) bool { } c = r.readByteNoBuf() if c == '\\' { - r.readByteNoBuf() + _ = r.readByteNoBuf() if r.err != nil { r.syntaxError() return false