Bug 613820: Regexp forwards ref in quantified parens test. (r=dmandelin)

This commit is contained in:
Chris Leary 2011-07-20 10:12:36 -05:00
Родитель 2f32b73162
Коммит b9120f9a8e
4 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -6,5 +6,8 @@ script empty-lookahead.js
script exec.js
script exec-lastIndex-ToInteger.js
script regress-576828.js
script regress-613820-1.js
script regress-613820-2.js
script regress-613820-3.js
silentfail skip-if(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT")) script regress-617935.js
script instance-property-storage-introspection.js

Просмотреть файл

@ -0,0 +1,9 @@
/* Back reference is actually a forwards reference. */
var re = /(\2(a)){2}/;
var str = 'aaa';
var actual = re.exec(str);
var expected = makeExpectedMatch(['aa', 'a', 'a'], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);

Просмотреть файл

@ -0,0 +1,9 @@
/* Resetting of inner capture groups across quantified capturing parens. */
var re = /(?:(f)(o)(o)|(b)(a)(r))*/;
var str = 'foobar';
var actual = re.exec(str);
var expected = makeExpectedMatch(['foobar', undefined, undefined, undefined, 'b', 'a', 'r'], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);

Просмотреть файл

@ -0,0 +1,9 @@
/* Capture group reset to undefined during second iteration, so backreference doesn't see prior result. */
var re = /(?:^(a)|\1(a)|(ab)){2}/;
var str = 'aab';
var actual = re.exec(str);
var expected = makeExpectedMatch(['aa', undefined, 'a', undefined], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);