Commit 48f9c161 authored by yangguo's avatar yangguo Committed by Commit bot

[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}
parent ca0dbaec
......@@ -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');
......
......@@ -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);
......
......@@ -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;
......
......@@ -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"));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment