Skip to content

Commit 4914d1f

Browse files
committed
fix: embed parsing now handles double quote rune
1 parent 23240d0 commit 4914d1f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

go/tools/builders/read.go

+23-1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,28 @@ func (r *importReader) findEmbed(first bool) bool {
198198
case ' ', '\t':
199199
// leave startLine alone
200200

201+
case '\'':
202+
startLine = false
203+
for r.err == nil {
204+
if r.eof {
205+
r.syntaxError()
206+
}
207+
c = r.readByteNoBuf()
208+
if c == '\\' {
209+
_ = r.readByteNoBuf()
210+
if r.err != nil {
211+
r.syntaxError()
212+
return false
213+
}
214+
continue
215+
}
216+
if c == '\'' {
217+
c = r.readByteNoBuf()
218+
goto Reswitch
219+
}
220+
}
221+
goto Reswitch
222+
201223
case '"':
202224
startLine = false
203225
for r.err == nil {
@@ -206,7 +228,7 @@ func (r *importReader) findEmbed(first bool) bool {
206228
}
207229
c = r.readByteNoBuf()
208230
if c == '\\' {
209-
r.readByteNoBuf()
231+
_ = r.readByteNoBuf()
210232
if r.err != nil {
211233
r.syntaxError()
212234
return false

0 commit comments

Comments
 (0)