Skip to content

Commit

Permalink
Only case-fold Cherokee under unicode flag (matches v8's behavior).
Browse files Browse the repository at this point in the history
  • Loading branch information
dilijev committed Jan 12, 2017
1 parent fbfb953 commit dc3e750
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
8 changes: 4 additions & 4 deletions lib/Parser/CaseInsensitive.cpp
Expand Up @@ -440,9 +440,9 @@ END {
1, MappingSource::UnicodeData, 0x10a0, 0x10c5, 0, 7264, 7264, 7264,
1, MappingSource::UnicodeData, 0x10c7, 0x10c7, 0, 7264, 7264, 7264,
1, MappingSource::UnicodeData, 0x10cd, 0x10cd, 0, 7264, 7264, 7264,
1, MappingSource::UnicodeData, 0x13a0, 0x13ef, 0, 38864, 38864, 38864,
1, MappingSource::UnicodeData, 0x13f0, 0x13f5, 0, 8, 8, 8,
1, MappingSource::UnicodeData, 0x13f8, 0x13fd, -8, 0, 0, 0,
1, MappingSource::CaseFolding, 0x13a0, 0x13ef, 0, 38864, 38864, 38864,
1, MappingSource::CaseFolding, 0x13f0, 0x13f5, 0, 8, 8, 8,
1, MappingSource::CaseFolding, 0x13f8, 0x13fd, -8, 0, 0, 0,
1, MappingSource::UnicodeData, 0x1d79, 0x1d79, 0, 35332, 35332, 35332,
1, MappingSource::UnicodeData, 0x1d7d, 0x1d7d, 0, 3814, 3814, 3814,
2, MappingSource::UnicodeData, 0x1e00, 0x1e5f, -1, 1, 1, 1,
Expand Down Expand Up @@ -565,7 +565,7 @@ END {
1, MappingSource::UnicodeData, 0xa7b3, 0xa7b3, 0, 928, 928, 928,
2, MappingSource::UnicodeData, 0xa7b4, 0xa7b7, -1, 1, 1, 1,
1, MappingSource::UnicodeData, 0xab53, 0xab53, -928, 0, 0, 0,
1, MappingSource::UnicodeData, 0xab70, 0xabbf, -38864, 0, 0, 0,
1, MappingSource::CaseFolding, 0xab70, 0xabbf, -38864, 0, 0, 0,
1, MappingSource::UnicodeData, 0xff21, 0xff3a, 0, 32, 32, 32,
1, MappingSource::UnicodeData, 0xff41, 0xff5a, -32, 0, 0, 0,
1, MappingSource::CaseFolding, 0x10400, 0x10427, 0, 40, 40, 40,
Expand Down
49 changes: 25 additions & 24 deletions test/es6/regex-unicode-CaseInsensitive.js
Expand Up @@ -268,7 +268,7 @@ assertMatches(/\ua69a/i, 0xa69b, '\ua69b');
assertMatches(/\ua69b/i, 0xa69a, '\ua69a');
assertMatches(/\ua69b/i, 0xa69b, '\ua69b');

// New Cherokee uppercase-lowercase mappings
// New Cherokee uppercase-lowercase mappings and case-mapping pairs.
assertMatches(/\u13a0/iu, 0xab70, '\uab70');
assertMatches(/\uab70/iu, 0x13a0, '\u13a0');
assertMatches(/\u13a1/iu, 0xab71, '\uab71');
Expand All @@ -279,17 +279,6 @@ assertMatches(/\uabbe/iu, 0x13ee, '\u13ee');
assertMatches(/\u13ef/iu, 0xabbf, '\uabbf');
assertMatches(/\uabbf/iu, 0x13ef, '\u13ef');

assertMatches(/\u13a0/i, 0xab70, '\uab70');
assertMatches(/\uab70/i, 0x13a0, '\u13a0');
assertMatches(/\u13a1/i, 0xab71, '\uab71');
assertMatches(/\uab71/i, 0x13a1, '\u13a1');
// ...
assertMatches(/\u13ee/i, 0xabbe, '\uabbe');
assertMatches(/\uabbe/i, 0x13ee, '\u13ee');
assertMatches(/\u13ef/i, 0xabbf, '\uabbf');
assertMatches(/\uabbf/i, 0x13ef, '\u13ef');

// New Cherokee case-mapping pairs
assertMatches(/\u13f0/iu, 0x13f8, '\u13f8');
assertMatches(/\u13f8/iu, 0x13f0, '\u13f0');
assertMatches(/\u13f1/iu, 0x13f9, '\u13f9');
Expand All @@ -303,18 +292,30 @@ assertMatches(/\u13fc/iu, 0x13f4, '\u13f4');
assertMatches(/\u13f5/iu, 0x13fd, '\u13fd');
assertMatches(/\u13fd/iu, 0x13f5, '\u13f5');

assertMatches(/\u13f0/i, 0x13f8, '\u13f8');
assertMatches(/\u13f8/i, 0x13f0, '\u13f0');
assertMatches(/\u13f1/i, 0x13f9, '\u13f9');
assertMatches(/\u13f9/i, 0x13f1, '\u13f1');
assertMatches(/\u13f2/i, 0x13fa, '\u13fa');
assertMatches(/\u13fa/i, 0x13f2, '\u13f2');
assertMatches(/\u13f3/i, 0x13fb, '\u13fb');
assertMatches(/\u13fb/i, 0x13f3, '\u13f3');
assertMatches(/\u13f4/i, 0x13fc, '\u13fc');
assertMatches(/\u13fc/i, 0x13f4, '\u13f4');
assertMatches(/\u13f5/i, 0x13fd, '\u13fd');
assertMatches(/\u13fd/i, 0x13f5, '\u13f5');
// REVIEW: Not matching without /u is compat with v8, but not what was expected from the UCD data.
// REVIEW: Need to confirm with someone more familiar with spec in this area.
assertDoesNotMatch(/\u13a0/i, 0xab70, '\uab70');
assertDoesNotMatch(/\uab70/i, 0x13a0, '\u13a0');
assertDoesNotMatch(/\u13a1/i, 0xab71, '\uab71');
assertDoesNotMatch(/\uab71/i, 0x13a1, '\u13a1');
// ...
assertDoesNotMatch(/\u13ee/i, 0xabbe, '\uabbe');
assertDoesNotMatch(/\uabbe/i, 0x13ee, '\u13ee');
assertDoesNotMatch(/\u13ef/i, 0xabbf, '\uabbf');
assertDoesNotMatch(/\uabbf/i, 0x13ef, '\u13ef');

assertDoesNotMatch(/\u13f0/i, 0x13f8, '\u13f8');
assertDoesNotMatch(/\u13f8/i, 0x13f0, '\u13f0');
assertDoesNotMatch(/\u13f1/i, 0x13f9, '\u13f9');
assertDoesNotMatch(/\u13f9/i, 0x13f1, '\u13f1');
assertDoesNotMatch(/\u13f2/i, 0x13fa, '\u13fa');
assertDoesNotMatch(/\u13fa/i, 0x13f2, '\u13f2');
assertDoesNotMatch(/\u13f3/i, 0x13fb, '\u13fb');
assertDoesNotMatch(/\u13fb/i, 0x13f3, '\u13f3');
assertDoesNotMatch(/\u13f4/i, 0x13fc, '\u13fc');
assertDoesNotMatch(/\u13fc/i, 0x13f4, '\u13f4');
assertDoesNotMatch(/\u13f5/i, 0x13fd, '\u13fd');
assertDoesNotMatch(/\u13fd/i, 0x13f5, '\u13f5');

// Latin extensions added in Unicode 7.0
assertMatches(/\ua796/iu, 0xa796, '\ua796');
Expand Down

0 comments on commit dc3e750

Please sign in to comment.