tc39 / test262-parser-tests

tests designed for ECMA-262 parsers
53 stars 14 forks source link

<LS> and <PS> are valid characters in string literals #26

Closed ascidian closed 3 years ago

ascidian commented 4 years ago

Per specification https://tc39.es/ecma262/#prod-StringLiteral, <LS> and <PS> are valid characters in string literals

The following two tests must pass: fail/647e21f8f157c338.js fail/8af69d8f15295ed2.js

kumavis commented 3 years ago

eval("'\u2028'") executes without error in a quick test on v8 and jsc

kumavis commented 3 years ago

I agree with @ascidian's interpretation of the spec that these characters should be allowed

the spec for DoubleStringCharacter starts with

SourceCharacter but not one of " or \ or LineTerminator

and while LineTerminator includes:

U+000A     LINE FEED (LF)     <LF>
U+000D     CARRIAGE RETURN (CR)     <CR>
U+2028     LINE SEPARATOR     <LS>
U+2029     PARAGRAPH SEPARATOR     <PS> 

the spec continues to explicitly allow

<LS>
<PS>
kumavis commented 3 years ago

here is an example of <LS> in the wild (albeit in json) https://npmfs.com/package/unicode-confusables/0.1.1/data/confusables.json#L160

michaelficarra commented 3 years ago

Fixed by #30.