mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
757 B
34 lines
757 B
/*
|
|
* Invalid backreferences.
|
|
*/
|
|
|
|
/*===
|
|
SyntaxError
|
|
SyntaxError
|
|
===*/
|
|
|
|
/* E5 Section 15.10.2.9: n > NCapturingParens */
|
|
try {
|
|
eval("/\\1/.exec('foo');");
|
|
print("no exception");
|
|
} catch (e) {
|
|
print(e.name);
|
|
}
|
|
|
|
/* Same error but never executed by regexp engine because an
|
|
* earlier match succeeds. However, because E5 Section 15.10.2.9
|
|
* deals with 'compilation' of an internal [[Match]] algorithm at
|
|
* regexp compilation time, a SyntaxError should happen when the
|
|
* RegExp is created.
|
|
*
|
|
* Note that a RegExp literal such as /\1/ should cause a
|
|
* compile-time syntax error when compiling the global program,
|
|
* so eval is used.
|
|
*/
|
|
try {
|
|
eval("/foo|\\1/.exec('foo');");
|
|
print("no exception");
|
|
} catch (e) {
|
|
print(e.name);
|
|
}
|
|
|
|
|