Commit 4620e294 authored by yangguo's avatar yangguo Committed by Commit bot

[regexp] disallow regexp property class shorthand syntax for single char.

R=littledan@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2044803003
Cr-Commit-Position: refs/heads/master@{#36778}
parent 68e77d2f
......@@ -912,7 +912,6 @@ bool LookupPropertyValueName(UProperty property,
bool RegExpParser::ParsePropertyClass(ZoneList<CharacterRange>* result) {
// Parse the property class as follows:
// - \pN with a single-character N is equivalent to \p{N}
// - In \p{name}, 'name' is interpreted
// - either as a general category property value name.
// - or as a binary property name.
......@@ -935,9 +934,6 @@ bool RegExpParser::ParsePropertyClass(ZoneList<CharacterRange>* result) {
}
second_part.Add(0); // null-terminate string.
}
} else if (current() != kEndMarker) {
// Parse \pN, where N is a single-character property name value.
first_part.Add(static_cast<char>(current()));
} else {
return false;
}
......
......@@ -15,7 +15,7 @@ assertThrows("/\\p{InCyrillic_Supplementary}/u");
assertThrows("/\\p{InCyrillicSupplementary}/u");
assertThrows("/\\p{InCyrillic_supplementary}/u");
assertDoesNotThrow("/\\pC/u");
assertDoesNotThrow("/\\p{C}/u");
assertDoesNotThrow("/\\p{Other}/u");
assertDoesNotThrow("/\\p{Cc}/u");
assertDoesNotThrow("/\\p{Control}/u");
......
......@@ -9,9 +9,13 @@ assertThrows("/\\p{garbage}/u");
assertThrows("/\\p{}/u");
assertThrows("/\\p{/u");
assertThrows("/\\p}/u");
assertThrows("/\p{Math}/u");
assertThrows("/\p{Bidi_M}/u");
assertThrows("/\p{Hex}/u");
assertThrows("/\\pL/u");
assertThrows("/\\P/u");
assertThrows("/\\P{garbage}/u");
assertThrows("/\\P{}/u");
assertThrows("/\\P{/u");
assertThrows("/\\P}/u");
assertThrows("/\\PL/u");
assertTrue(/\p{Ll}/u.test("a"));
assertFalse(/\P{Ll}/u.test("a"));
......@@ -54,12 +58,6 @@ assertFalse(/\P{Sm}/u.test("+"));
assertTrue(/\p{Sm}/u.test("\u{1D6C1}"));
assertFalse(/\P{Sm}/u.test("\u{1D6C1}"));
assertTrue(/\pL/u.test("a"));
assertFalse(/\PL/u.test("a"));
assertFalse(/\pL/u.test("1"));
assertTrue(/\PL/u.test("1"));
assertTrue(/\pL/u.test("\u1FAB"));
assertFalse(/\PL/u.test("\u1FAB"));
assertFalse(/\p{L}/u.test("\uA6EE"));
assertTrue(/\P{L}/u.test("\uA6EE"));
......
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