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) { ...@@ -43,10 +43,6 @@ inline bool IsAlphaNumeric(uc32 c) {
return IsInRange(AsciiAlphaToLower(c), 'a', 'z') || IsDecimalDigit(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) { inline bool IsDecimalDigit(uc32 c) {
// ECMA-262, 3rd, 7.8.3 (p 16) // ECMA-262, 3rd, 7.8.3 (p 16)
return IsInRange(c, '0', '9'); return IsInRange(c, '0', '9');
......
...@@ -18,7 +18,6 @@ inline bool IsCarriageReturn(uc32 c); ...@@ -18,7 +18,6 @@ inline bool IsCarriageReturn(uc32 c);
inline bool IsLineFeed(uc32 c); inline bool IsLineFeed(uc32 c);
inline bool IsAsciiIdentifier(uc32 c); inline bool IsAsciiIdentifier(uc32 c);
inline bool IsAlphaNumeric(uc32 c); inline bool IsAlphaNumeric(uc32 c);
inline bool IsAlpha(uc32 c);
inline bool IsDecimalDigit(uc32 c); inline bool IsDecimalDigit(uc32 c);
inline bool IsHexDigit(uc32 c); inline bool IsHexDigit(uc32 c);
inline bool IsOctalDigit(uc32 c); inline bool IsOctalDigit(uc32 c);
......
...@@ -840,11 +840,11 @@ ZoneList<CharacterRange>* RegExpParser::ParsePropertyClass() { ...@@ -840,11 +840,11 @@ ZoneList<CharacterRange>* RegExpParser::ParsePropertyClass() {
#ifdef V8_I18N_SUPPORT #ifdef V8_I18N_SUPPORT
ZoneList<char> property_name(0, zone()); ZoneList<char> property_name(0, zone());
if (current() == '{') { if (current() == '{') {
for (Advance(); IsAlpha(current()); Advance()) { for (Advance(); current() != '}'; Advance()) {
if (!has_next()) return nullptr;
property_name.Add(static_cast<char>(current()), zone()); property_name.Add(static_cast<char>(current()), zone());
} }
if (current() != '}') return nullptr; } else if (current() != kEndMarker) {
} else if (IsAlpha(current())) {
property_name.Add(static_cast<char>(current()), zone()); property_name.Add(static_cast<char>(current()), zone());
} else { } else {
return nullptr; return nullptr;
......
...@@ -62,3 +62,9 @@ assertTrue(/\pL/u.test("\u1FAB")); ...@@ -62,3 +62,9 @@ assertTrue(/\pL/u.test("\u1FAB"));
assertFalse(/\PL/u.test("\u1FAB")); assertFalse(/\PL/u.test("\u1FAB"));
assertFalse(/\p{L}/u.test("\uA6EE")); assertFalse(/\p{L}/u.test("\uA6EE"));
assertTrue(/\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