diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js index ab314ff581..c3259250e6 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for digit class escape \d with flags ug + Compare range for digit class escape \d with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -57,16 +57,16 @@ const re = /\d/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js index 230ceb7cce..63902cf76e 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for digit class escape \d+ with flags ug + Compare range for digit class escape \d+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -57,16 +57,16 @@ const re = /\d+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js index 9401e9a1d6..fe930f650d 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for digit class escape \d+ with flags g + Compare range for digit class escape \d+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -57,16 +57,16 @@ const re = /\d+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js index 6968fb0a93..1d95fd4740 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for digit class escape \d with flags g + Compare range for digit class escape \d with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -57,16 +57,16 @@ const re = /\d/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js index e634524ab3..7b3b98b4fc 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-digit class escape \D with flags ug + Compare range for non-digit class escape \D with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -60,16 +60,16 @@ const re = /\D/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js index 6cde639a1b..56791800cd 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-digit class escape \D+ with flags ug + Compare range for non-digit class escape \D+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -60,16 +60,16 @@ const re = /\D+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js index 94a8d83129..249d5598e3 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-digit class escape \D+ with flags g + Compare range for non-digit class escape \D+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -60,16 +60,16 @@ const re = /\D+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js index 305a95235e..94b0bb98a9 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-digit class escape \D with flags g + Compare range for non-digit class escape \D with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -60,16 +60,16 @@ const re = /\D/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js index 2880d6b5bd..35cd6a9748 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-whitespace class escape \S with flags ug + Compare range for non-whitespace class escape \S with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -69,16 +69,16 @@ const re = /\S/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js index ba49812bd7..a296c4f34c 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-whitespace class escape \S+ with flags ug + Compare range for non-whitespace class escape \S+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -69,16 +69,16 @@ const re = /\S+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js index 13078ae813..0865bce22a 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-whitespace class escape \S+ with flags g + Compare range for non-whitespace class escape \S+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -69,16 +69,16 @@ const re = /\S+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js index 74c1093384..09a6a556d4 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-whitespace class escape \S with flags g + Compare range for non-whitespace class escape \S with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -69,16 +69,16 @@ const re = /\S/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js index 3b0c7e4db3..60560ef61b 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-word class escape \W with flags ug + Compare range for non-word class escape \W with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -62,16 +62,16 @@ const re = /\W/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js index 1b4a6f7009..2cca79f8a2 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-word class escape \W+ with flags ug + Compare range for non-word class escape \W+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -62,16 +62,16 @@ const re = /\W+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js index 893efc8fe4..598d0e8c05 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-word class escape \W+ with flags g + Compare range for non-word class escape \W+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -62,16 +62,16 @@ const re = /\W+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js index 358db870d5..1b6d6b238f 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for non-word class escape \W with flags g + Compare range for non-word class escape \W with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -62,16 +62,16 @@ const re = /\W/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js index a04b7a6daf..531a50c5f9 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for whitespace class escape \s with flags ug + Compare range for whitespace class escape \s with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -67,16 +67,16 @@ const re = /\s/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js index 42c80fc5fe..a46c7b8502 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for whitespace class escape \s+ with flags ug + Compare range for whitespace class escape \s+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -67,16 +67,16 @@ const re = /\s+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js index a62c2864b9..e9cdeed505 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for whitespace class escape \s+ with flags g + Compare range for whitespace class escape \s+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -67,16 +67,16 @@ const re = /\s+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js index 42c8b93e3b..b9e1dcd5f4 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for whitespace class escape \s with flags g + Compare range for whitespace class escape \s with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -67,16 +67,16 @@ const re = /\s/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js index 0c271591d0..1cedbcc304 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for word class escape \w with flags ug + Compare range for word class escape \w with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -59,16 +59,16 @@ const re = /\w/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js index 26f035fabb..2959480dc3 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for word class escape \w+ with flags ug + Compare range for word class escape \w+ with flags ug info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -59,16 +59,16 @@ const re = /\w+/ug; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js index d8d3692c34..5a756fd9cd 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for word class escape \w+ with flags g + Compare range for word class escape \w+ with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -59,16 +59,16 @@ const re = /\w+/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js index d7950ae9d5..da4db67850 100644 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js @@ -4,42 +4,42 @@ /*--- esid: prod-CharacterClassEscape description: > - Compare range for word class escape \w with flags g + Compare range for word class escape \w with flags g info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] @@ -59,16 +59,16 @@ const re = /\w/g; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); diff --git a/tools/regexp-generator/header.mjs b/tools/regexp-generator/header.mjs index 26fbe8ec25..33f342492e 100644 --- a/tools/regexp-generator/header.mjs +++ b/tools/regexp-generator/header.mjs @@ -1,50 +1,50 @@ export default description => { - let header = `// Copyright (C) 2018 Leo Balter. All rights reserved. + let header = `// Copyright (C) 2018 Leo Balter. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: prod-CharacterClassEscape description: > - ${description} + ${description} info: | - This is a generated test. Please check out - https://github.com/tc39/test262/tree/main/tools/regexp-generator/ - for any changes. + This is a generated test. Please check out + https://github.com/tc39/test262/tree/main/tools/regexp-generator/ + for any changes. - CharacterClassEscape[UnicodeMode] :: - d - D - s - S - w - W - [+UnicodeMode] p{ UnicodePropertyValueExpression } - [+UnicodeMode] P{ UnicodePropertyValueExpression } + CharacterClassEscape[UnicodeMode] :: + d + D + s + S + w + W + [+UnicodeMode] p{ UnicodePropertyValueExpression } + [+UnicodeMode] P{ UnicodePropertyValueExpression } - 22.2.2.9 Runtime Semantics: CompileToCharSet + 22.2.2.9 Runtime Semantics: CompileToCharSet - CharacterClassEscape :: d - 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, - 4, 5, 6, 7, 8, and 9. - CharacterClassEscape :: D - 1. Let S be the CharSet returned by CharacterClassEscape :: d. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: s - 1. Return the CharSet containing all characters corresponding to a code - point on the right-hand side of the WhiteSpace or LineTerminator - productions. - CharacterClassEscape :: S - 1. Let S be the CharSet returned by CharacterClassEscape :: s. - 2. Return CharacterComplement(rer, S). - CharacterClassEscape :: w - 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). - CharacterClassEscape :: W - 1. Let S be the CharSet returned by CharacterClassEscape :: w. - 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: d + 1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4, + 5, 6, 7, 8, and 9. + CharacterClassEscape :: D + 1. Let S be the CharSet returned by CharacterClassEscape :: d. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: s + 1. Return the CharSet containing all characters corresponding to a code + point on the right-hand side of the WhiteSpace or LineTerminator + productions. + CharacterClassEscape :: S + 1. Let S be the CharSet returned by CharacterClassEscape :: s. + 2. Return CharacterComplement(rer, S). + CharacterClassEscape :: w + 1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)). + CharacterClassEscape :: W + 1. Let S be the CharSet returned by CharacterClassEscape :: w. + 2. Return CharacterComplement(rer, S). features: [String.fromCodePoint] includes: [regExpUtils.js] flags: [generated] ---*/\n`; - return header; + return header; }; diff --git a/tools/regexp-generator/index.mjs b/tools/regexp-generator/index.mjs index 47a0aa20cd..877c087b4d 100644 --- a/tools/regexp-generator/index.mjs +++ b/tools/regexp-generator/index.mjs @@ -8,81 +8,81 @@ import slugify from 'slugify'; import header from './header.mjs'; const patterns = { - 'whitespace class escape': '\\s', - 'non-whitespace class escape': '\\S', - 'word class escape': '\\w', - 'non-word class escape': '\\W', - 'digit class escape': '\\d', - 'non-digit class escape': '\\D', + 'whitespace class escape': '\\s', + 'non-whitespace class escape': '\\S', + 'word class escape': '\\w', + 'non-word class escape': '\\W', + 'digit class escape': '\\d', + 'non-digit class escape': '\\D', }; // Pretty-printing code adapted from unicode-property-escapes-tests. // https://github.com/mathiasbynens/unicode-property-escapes-tests/blob/60f2dbec2b2a840ee67aa04dbd3449bb90fd2999/regenerate.js function toHex(codePoint) { - return '0x' + ('00000' + codePoint.toString(16).toUpperCase()).slice(-6); + return '0x' + ('00000' + codePoint.toString(16).toUpperCase()).slice(-6); }; function toTestData(reg) { - const data = reg.data; - // Iterate over the data per `(start, end)` pair. - let index = 0; - const length = data.length; - const loneCodePoints = []; - const ranges = []; - while (index < length) { - let start = data[index]; - let end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. - if (start == end) { - loneCodePoints.push(start); - } else { - ranges.push([start, end]); - } - index += 2; + const data = reg.data; + // Iterate over the data per `(start, end)` pair. + let index = 0; + const length = data.length; + const loneCodePoints = []; + const ranges = []; + while (index < length) { + let start = data[index]; + let end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive. + if (start == end) { + loneCodePoints.push(start); + } else { + ranges.push([start, end]); } - return [ loneCodePoints, ranges ]; + index += 2; + } + return [ loneCodePoints, ranges ]; } function prettyPrint([ loneCodePoints, ranges ]) { - const indent = ' '; - loneCodePoints = loneCodePoints.map((codePoint) => toHex(codePoint)); - ranges = ranges.map( - (range) => `[${ toHex(range[0]) }, ${ toHex(range[1]) }]` - ); - const loneCodePointsOutput = loneCodePoints.length ? - loneCodePoints.length === 1 ? `[${loneCodePoints[0]}]` : - `[\n${indent}${indent}${ loneCodePoints.join(`,\n${indent}${indent}`) },\n${indent}]` : - `[]`; - const rangesOutput = ranges.length ? - `[\n${indent}${indent}${ ranges.join(`,\n${indent}${indent}`) },\n${indent}]` : - `[]`; - return `{\n${indent}loneCodePoints: ${ loneCodePointsOutput },\n${indent}ranges: ${ rangesOutput },\n}`; + const indent = ' '; + loneCodePoints = loneCodePoints.map((codePoint) => toHex(codePoint)); + ranges = ranges.map( + (range) => `[${ toHex(range[0]) }, ${ toHex(range[1]) }]` + ); + const loneCodePointsOutput = loneCodePoints.length ? + loneCodePoints.length === 1 ? `[${loneCodePoints[0]}]` : + `[\n${indent}${indent}${ loneCodePoints.join(`,\n${indent}${indent}`) },\n${indent}]` : + `[]`; + const rangesOutput = ranges.length ? + `[\n${indent}${indent}${ ranges.join(`,\n${indent}${indent}`) },\n${indent}]` : + `[]`; + return `{\n${indent}loneCodePoints: ${ loneCodePointsOutput },\n${indent}ranges: ${ rangesOutput },\n}`; } const LOW_SURROGATES = regenerate().addRange(0xDC00, 0xDFFF); function buildString(escapeChar, flags) { - const isUnicode = flags.includes('u'); - let escapeData = ESCAPE_SETS[isUnicode ? 'UNICODE' : 'REGULAR'].get(escapeChar); + const isUnicode = flags.includes('u'); + let escapeData = ESCAPE_SETS[isUnicode ? 'UNICODE' : 'REGULAR'].get(escapeChar); - const lowSurrogates = escapeData.clone().intersection(LOW_SURROGATES); - if (lowSurrogates.data.length === 0) { - return prettyPrint(toTestData(escapeData)); - } - const rest = escapeData.clone().remove(LOW_SURROGATES); - const [ lowLoneCodePoints, lowRanges ] = toTestData(lowSurrogates); - const [ loneCodePoints, ranges ] = toTestData(rest); - loneCodePoints.unshift(...lowLoneCodePoints); - ranges.unshift(...lowRanges); - return prettyPrint([ loneCodePoints, ranges ]); + const lowSurrogates = escapeData.clone().intersection(LOW_SURROGATES); + if (lowSurrogates.data.length === 0) { + return prettyPrint(toTestData(escapeData)); + } + const rest = escapeData.clone().remove(LOW_SURROGATES); + const [ lowLoneCodePoints, lowRanges ] = toTestData(lowSurrogates); + const [ loneCodePoints, ranges ] = toTestData(rest); + loneCodePoints.unshift(...lowLoneCodePoints); + ranges.unshift(...lowRanges); + return prettyPrint([ loneCodePoints, ranges ]); } function buildContent(desc, pattern, flags) { - let string = buildString(pattern[1], flags); + let string = buildString(pattern[1], flags); - let content = header(`Compare range for ${desc} ${pattern} with flags ${flags}`); + let content = header(`Compare range for ${desc} ${pattern} with flags ${flags}`); - content += ` + content += ` const str = buildString(${string}); const re = /${pattern}/${flags}; @@ -90,18 +90,18 @@ const re = /${pattern}/${flags}; const errors = []; if (!re.test(str)) { - // Error, let's find out where - for (const char of str) { - if (!re.test(char)) { - errors.push('0x' + char.codePointAt(0).toString(16)); - } + // Error, let's find out where + for (const char of str) { + if (!re.test(char)) { + errors.push('0x' + char.codePointAt(0).toString(16)); } + } } assert.sameValue( - errors.length, - 0, - 'Expected matching code points, but received: ' + errors.join(',') + errors.length, + 0, + 'Expected matching code points, but received: ' + errors.join(',') ); `; @@ -109,45 +109,45 @@ assert.sameValue( } function writeFile(desc, content, suffix = '') { - const outPath = '../../test/built-ins/RegExp/CharacterClassEscapes'; - const filename = `${outPath}/character-class-${slugify(filenamify(desc.toLowerCase()))}${suffix}.js`; - fs.writeFileSync(filename, content); + const outPath = '../../test/built-ins/RegExp/CharacterClassEscapes'; + const filename = `${outPath}/character-class-${slugify(filenamify(desc.toLowerCase()))}${suffix}.js`; + fs.writeFileSync(filename, content); } // No additions for (const [desc, escape] of Object.entries(patterns)) { - [ - { - quantifier: '', - flags: '', - }, - { - quantifier: '+', - flags: '', - suffix: '-plus-quantifier', - }, - { - quantifier: '', - flags: 'u', - suffix: '-flags-u', - }, - { - quantifier: '+', - flags: 'u', - suffix: '-plus-quantifier-flags-u', - }, - ].forEach(({quantifier, flags, suffix}) => { - flags += 'g'; + [ + { + quantifier: '', + flags: '', + }, + { + quantifier: '+', + flags: '', + suffix: '-plus-quantifier', + }, + { + quantifier: '', + flags: 'u', + suffix: '-flags-u', + }, + { + quantifier: '+', + flags: 'u', + suffix: '-plus-quantifier-flags-u', + }, + ].forEach(({quantifier, flags, suffix}) => { + flags += 'g'; - const pattern = `${escape}${quantifier}`; - const range = rewritePattern(pattern, flags, { - unicodeFlag: flags.includes('u') ? 'transform' : false, - }); - - console.log(`${pattern} => ${range}, flags: ${flags}`); - - const content = buildContent(desc, pattern, flags); - - writeFile(desc, content, suffix); + const pattern = `${escape}${quantifier}`; + const range = rewritePattern(pattern, flags, { + unicodeFlag: flags.includes('u') ? 'transform' : false, }); + + console.log(`${pattern} => ${range}, flags: ${flags}`); + + const content = buildContent(desc, pattern, flags); + + writeFile(desc, content, suffix); + }); }