[regexp] allow loose matching for property names.

As described in unicode database file PropertyValueAliases.txt

R=littledan@chromium.org
BUG=v8:4743
LOG=N

Review URL: https://codereview.chromium.org/1776953002

Cr-Commit-Position: refs/heads/master@{#34638}
This commit is contained in:
yangguo 2016-03-09 11:05:02 -08:00 committed by Commit bot
parent ca0dbaece0
commit 48f9c16184
4 changed files with 9 additions and 8 deletions

View File

@ -43,10 +43,6 @@ inline bool IsAlphaNumeric(uc32 c) {
return IsInRange(AsciiAlphaToLower(c), 'a', 'z') || IsDecimalDigit(c);
}
inline bool IsAlpha(uc32 c) {
return IsInRange(AsciiAlphaToLower(c), 'a', 'z');
}
inline bool IsDecimalDigit(uc32 c) {
// ECMA-262, 3rd, 7.8.3 (p 16)
return IsInRange(c, '0', '9');

View File

@ -18,7 +18,6 @@ inline bool IsCarriageReturn(uc32 c);
inline bool IsLineFeed(uc32 c);
inline bool IsAsciiIdentifier(uc32 c);
inline bool IsAlphaNumeric(uc32 c);
inline bool IsAlpha(uc32 c);
inline bool IsDecimalDigit(uc32 c);
inline bool IsHexDigit(uc32 c);
inline bool IsOctalDigit(uc32 c);

View File

@ -840,11 +840,11 @@ ZoneList<CharacterRange>* RegExpParser::ParsePropertyClass() {
#ifdef V8_I18N_SUPPORT
ZoneList<char> property_name(0, zone());
if (current() == '{') {
for (Advance(); IsAlpha(current()); Advance()) {
for (Advance(); current() != '}'; Advance()) {
if (!has_next()) return nullptr;
property_name.Add(static_cast<char>(current()), zone());
}
if (current() != '}') return nullptr;
} else if (IsAlpha(current())) {
} else if (current() != kEndMarker) {
property_name.Add(static_cast<char>(current()), zone());
} else {
return nullptr;

View File

@ -62,3 +62,9 @@ assertTrue(/\pL/u.test("\u1FAB"));
assertFalse(/\PL/u.test("\u1FAB"));
assertFalse(/\p{L}/u.test("\uA6EE"));
assertTrue(/\P{L}/u.test("\uA6EE"));
assertTrue(/\p{Lowercase_Letter}/u.test("a"));
assertTrue(/\p{LowercaseLetter}/u.test("a"));
assertTrue(/\p{Lowercaseletter}/u.test("a"));
assertTrue(/\p{lowercase letter}/u.test("a"));
assertTrue(/\p{lowercase letter}/u.test("a"));