ICU-2874 fix parsing of [^-b]
X-SVN-Rev: 11871
This commit is contained in:
parent
4415b1122a
commit
ec2fad40f1
@ -1963,6 +1963,12 @@ void UnicodeSet::_applyPattern(const UnicodeString& pattern,
|
|||||||
isLiteral = TRUE; // Treat leading '-' as a literal
|
isLiteral = TRUE; // Treat leading '-' as a literal
|
||||||
break; // Fall through
|
break; // Fall through
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (c == HYPHEN && invert) {
|
||||||
|
isLiteral = TRUE; // [^-...] starts with literal '-'
|
||||||
|
}
|
||||||
|
break;
|
||||||
// else fall through and parse this character normally
|
// else fall through and parse this character normally
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,6 +793,23 @@ void UnicodeSetTest::TestPropertySet() {
|
|||||||
"[:xdigit:]",
|
"[:xdigit:]",
|
||||||
"09afAF",
|
"09afAF",
|
||||||
"gG!",
|
"gG!",
|
||||||
|
|
||||||
|
// Regex compatibility test
|
||||||
|
"[-b]", // leading '-' is literal
|
||||||
|
"-b",
|
||||||
|
"ac",
|
||||||
|
|
||||||
|
"[^-b]", // leading '-' is literal
|
||||||
|
"ac",
|
||||||
|
"-b",
|
||||||
|
|
||||||
|
"[b-]", // trailing '-' is literal
|
||||||
|
"-b",
|
||||||
|
"ac",
|
||||||
|
|
||||||
|
"[^b-]", // trailing '-' is literal
|
||||||
|
"ac",
|
||||||
|
"-b"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int32_t DATA_LEN = sizeof(DATA)/sizeof(DATA[0]);
|
static const int32_t DATA_LEN = sizeof(DATA)/sizeof(DATA[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user