@@ -769,6 +769,9 @@ func parseStringLiteral1(literal string, length int, unicode bool) (unistring.St
var size int
value, size = utf8.DecodeRuneInString(str)
str = str[size:] // \ + <character>
+ if value == '\u2028' || value == '\u2029' {
+ continue
+ }
} else {
str = str[2:] // \<character>
switch chr {
@@ -101,6 +101,9 @@ func TestParserErr(t *testing.T) {
is(parser.slice(stmt.From, stmt.To), "break; ")
}
+ s := string([]byte{0x22, 0x25, 0x21, 0x63, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3d, 0x25, 0x63, 0x25, 0x9c, 0x29, 0x25, 0x21, 0x5c, 0x28, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3d, 0x5c, 0xe2, 0x80, 0xa9, 0x29, 0x78, 0x39, 0x63, 0x22})
+ test(s, `(anonymous): Line 1:16 Invalid UTF-8 character`)
+
test("{", "(anonymous): Line 1:2 Unexpected end of input")
test("}", "(anonymous): Line 1:1 Unexpected token }")
@@ -871,6 +874,8 @@ func TestParser(t *testing.T) {
2
debugger
`, nil)
+ test("'ё\\\u2029'", nil)
})