Index: src/regexp/regexp-parser.cc |
diff --git a/src/regexp/regexp-parser.cc b/src/regexp/regexp-parser.cc |
index fd3123f674e3ca74986b945809cd7e439c09dc34..9739b348ce78906c9b4ee4905682fe8b87bd0899 100644 |
--- a/src/regexp/regexp-parser.cc |
+++ b/src/regexp/regexp-parser.cc |
@@ -1082,13 +1082,19 @@ bool IsExactPropertyValueAlias(const char* property_value_name, |
bool LookupPropertyValueName(UProperty property, |
const char* property_value_name, bool negate, |
ZoneList<CharacterRange>* result, Zone* zone) { |
+ UProperty property_for_lookup = property; |
+ if (property_for_lookup == UCHAR_SCRIPT_EXTENSIONS) { |
+ // For the property Script_Extensions, we have to do the property value |
+ // name lookup as if the property is Script. |
jungshik at Google
2016/11/17 22:27:49
Filed http://bugs.icu-project.org/trac/ticket/1285
Yang
2016/11/18 06:07:13
Thanks.
|
+ property_for_lookup = UCHAR_SCRIPT; |
+ } |
int32_t property_value = |
- u_getPropertyValueEnum(property, property_value_name); |
+ u_getPropertyValueEnum(property_for_lookup, property_value_name); |
if (property_value == UCHAR_INVALID_CODE) return false; |
// We require the property name to match exactly to one of the property value |
// aliases. However, u_getPropertyValueEnum uses loose matching. |
- if (!IsExactPropertyValueAlias(property_value_name, property, |
+ if (!IsExactPropertyValueAlias(property_value_name, property_for_lookup, |
property_value)) { |
return false; |
} |
@@ -1196,9 +1202,14 @@ bool RegExpParser::ParsePropertyClass(ZoneList<CharacterRange>* result, |
const char* property_name = first_part.ToConstVector().start(); |
const char* value_name = second_part.ToConstVector().start(); |
UProperty property = u_getPropertyEnum(property_name); |
- if (property < UCHAR_INT_START) return false; |
- if (property >= UCHAR_INT_LIMIT) return false; |
if (!IsExactPropertyAlias(property_name, property)) return false; |
+ if (property == UCHAR_GENERAL_CATEGORY) { |
+ // We want to allow aggregate value names such as "Letter". |
+ property = UCHAR_GENERAL_CATEGORY_MASK; |
+ } else if (property != UCHAR_SCRIPT && |
+ property != UCHAR_SCRIPT_EXTENSIONS) { |
+ return false; |
+ } |
return LookupPropertyValueName(property, value_name, negate, result, |
zone()); |
} |