Fix RegExp white-space character class to match BOMs.

R=rossberg@chromium.org
TEST=test262/S15.10.2.12_A?_T1,mjsunit/regexp

Review URL: https://chromiumcodereview.appspot.com/9426032

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10770 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2012-02-20 17:50:53 +00:00
parent 85069cd105
commit 417a01accf
4 changed files with 29 additions and 22 deletions

View File

@ -3597,22 +3597,20 @@ void RegExpEngine::DotPrint(const char* label,
// -------------------------------------------------------------------
// Tree to graph conversion
static const int kSpaceRangeCount = 20;
static const int kSpaceRangeAsciiCount = 4;
static const uc16 kSpaceRanges[kSpaceRangeCount] = { 0x0009, 0x000D, 0x0020,
0x0020, 0x00A0, 0x00A0, 0x1680, 0x1680, 0x180E, 0x180E, 0x2000, 0x200A,
0x2028, 0x2029, 0x202F, 0x202F, 0x205F, 0x205F, 0x3000, 0x3000 };
static const uc16 kSpaceRanges[] = { 0x0009, 0x000D, 0x0020, 0x0020, 0x00A0,
0x00A0, 0x1680, 0x1680, 0x180E, 0x180E, 0x2000, 0x200A, 0x2028, 0x2029,
0x202F, 0x202F, 0x205F, 0x205F, 0x3000, 0x3000, 0xFEFF, 0xFEFF };
static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges);
static const int kWordRangeCount = 8;
static const uc16 kWordRanges[kWordRangeCount] = { '0', '9', 'A', 'Z', '_',
'_', 'a', 'z' };
static const uc16 kWordRanges[] = { '0', '9', 'A', 'Z', '_', '_', 'a', 'z' };
static const int kWordRangeCount = ARRAY_SIZE(kWordRanges);
static const int kDigitRangeCount = 2;
static const uc16 kDigitRanges[kDigitRangeCount] = { '0', '9' };
static const uc16 kDigitRanges[] = { '0', '9' };
static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges);
static const int kLineTerminatorRangeCount = 6;
static const uc16 kLineTerminatorRanges[kLineTerminatorRangeCount] = { 0x000A,
0x000A, 0x000D, 0x000D, 0x2028, 0x2029 };
static const uc16 kLineTerminatorRanges[] = { 0x000A, 0x000A, 0x000D, 0x000D,
0x2028, 0x2029 };
static const int kLineTerminatorRangeCount = ARRAY_SIZE(kLineTerminatorRanges);
RegExpNode* RegExpAtom::ToNode(RegExpCompiler* compiler,
RegExpNode* on_success) {

View File

@ -127,6 +127,17 @@ assertTrue(re.test("$"));
assertTrue(/^[Z-\c-e]*$/.test("Z[\\cde"));
// Test that we handle \s and \S correctly on special Unicode characters.
re = /\s/;
assertTrue(re.test("\u2028"));
assertTrue(re.test("\u2029"));
assertTrue(re.test("\uFEFF"));
re = /\S/;
assertFalse(re.test("\u2028"));
assertFalse(re.test("\u2029"));
assertFalse(re.test("\uFEFF"));
// Test that we handle \s and \S correctly inside some bizarre
// character classes.
re = /[\s-:]/;

View File

@ -125,11 +125,13 @@ S15.5.2_D2: PASS || FAIL_OK
S15.5.4.11_D1.1_T1: PASS || FAIL_OK
S15.5.4.11_D1.1_T3: PASS || FAIL_OK
S12.6.4_D1: PASS || FAIL_OK
S15.5.4.14_A1_T6: PASS || FAIL_OK
S15.5.4.14_A1_T7: PASS || FAIL_OK
S15.5.4.14_A1_T8: PASS || FAIL_OK
S15.5.4.14_A1_T9: PASS || FAIL_OK
S15.5.4.14_A2_T7: PASS || FAIL_OK
S15.5.4.14_A1_T6: FAIL_OK
S15.5.4.14_A1_T7: FAIL_OK
S15.5.4.14_A1_T8: FAIL_OK
S15.5.4.14_A1_T9: FAIL_OK
S15.5.4.14_A2_T7: FAIL_OK
S15.10.2.12_A1_T1: FAIL_OK
S15.10.2.12_A2_T1: FAIL_OK
# We allow function declarations within statements
S12.6.2_A13_T1: FAIL_OK

View File

@ -56,10 +56,6 @@ S10.4.2.1_A1: FAIL
15.2.3.7-6-a-284: FAIL
15.2.3.7-6-a-285: FAIL
# Unanalyzed failures:
S15.10.2.12_A1_T1: FAIL
S15.10.2.12_A2_T1: FAIL
##################### DELIBERATE INCOMPATIBILITIES #####################
# We deliberately treat arguments to parseInt() with a leading zero as