File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ namespace UnifiedRegex
257
257
258
258
if (codePoint > 0x10FFFF )
259
259
{
260
+ DeferredFailIfUnicode (JSERR_RegExpInvalidEscape);
260
261
return 0 ;
261
262
}
262
263
i++;
Original file line number Diff line number Diff line change 1
1
SyntaxError: Syntax error in regular expression
2
2
SyntaxError: Invalid codepoint value in the escape sequence.
3
3
SyntaxError: Invalid range in character set
4
+ SyntaxError: Invalid regular expression: invalid escape in unicode pattern
4
5
false
5
6
false
6
7
false
Original file line number Diff line number Diff line change 81
81
e . echo ( ) ;
82
82
}
83
83
84
+ try {
85
+ new RegExp ( / \u{10FFFF} / , "u" ) ;
86
+ }
87
+ catch ( e )
88
+ {
89
+ print ( "Unexpected error " + e ) ;
90
+ }
91
+
92
+ try {
93
+ new RegExp ( / \u{110000} / , "u" ) ;
94
+ }
95
+ catch ( e )
96
+ {
97
+ print ( e ) ;
98
+ }
99
+
84
100
// Shouldn't throw From here onwards.
85
101
eval ( 'var test = "\\u{0000}"' ) ;
86
102
@@ -169,11 +185,11 @@ invalidStrings.forEach(function (str){
169
185
/ a \u { } b / u. test ( "au\{\}b" ) . echo ( ) ;
170
186
/ a \u{1} b / u. test ( "a\u0001b" ) . echo ( ) ;
171
187
/ a \u { 1 .1 } b / u. test ( "au\{1.1\}b" ) . echo ( ) ;
172
- / a \u{110000} b / u . test ( "a" + ( Array ( 110001 ) . join ( 'u' ) ) + "b" ) . echo ( ) ;
173
- / a \u{11FFFF} b / u . test ( "au\{11FFFF\}b" ) . echo ( ) ;
188
+ / a \u{110000} b / . test ( "a" + ( Array ( 110001 ) . join ( 'u' ) ) + "b" ) . echo ( ) ;
189
+ / a \u{11FFFF} b / . test ( "au\{11FFFF\}b" ) . echo ( ) ;
174
190
/ a \u{10FFFF} b / . test ( "a\uDBFF\uDFFFb" ) . echo ( ) ;
175
191
176
- / a \u { 1000000 } b / u . test ( "au\{1000000\}b" ) . echo ( ) ;
192
+ / a \u { 1000000 } b / . test ( "au\{1000000\}b" ) . echo ( ) ;
177
193
/ a \u { 1 .1 } b / u. test ( "a\u0001b" ) . echo ( ) ;
178
194
/ a \u{1} b / u. test ( "a\\ub" ) . echo ( ) ;
179
195
/ a \u{1} b / u. test ( "aub" ) . echo ( ) ;
You can’t perform that action at this time.
0 commit comments