@@ -242,6 +242,14 @@ func scanMultilineBasicString(b []byte) ([]byte, bool, []byte, error) {
|
|||||||
}
|
}
|
||||||
escaped = true
|
escaped = true
|
||||||
i++ // skip the next character
|
i++ // skip the next character
|
||||||
|
case '\r':
|
||||||
|
if len(b) < i+2 {
|
||||||
|
return nil, escaped, nil, newDecodeError(b[len(b):], `need a \n after \r`)
|
||||||
|
}
|
||||||
|
if b[i+1] != '\n' {
|
||||||
|
return nil, escaped, nil, newDecodeError(b[i:i+2], `need a \n after \r`)
|
||||||
|
}
|
||||||
|
i++ // skip the \n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2590,6 +2590,14 @@ world'`,
|
|||||||
desc: `carriage return inside basic string`,
|
desc: `carriage return inside basic string`,
|
||||||
data: "A = \"\r\"",
|
data: "A = \"\r\"",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
desc: `carriage return inside basic multiline string`,
|
||||||
|
data: "a=\"\"\"\r\"\"\"",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc: `carriage return at the trail of basic multiline string`,
|
||||||
|
data: "a=\"\"\"\r",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
desc: `carriage return inside literal string`,
|
desc: `carriage return inside literal string`,
|
||||||
data: "A = '\r'",
|
data: "A = '\r'",
|
||||||
|
|||||||
Reference in New Issue
Block a user