ICU-7446 Note that UREGEX_LITERAL is unimplemented, and return U_REGEX_UNIMPLEMENTED for it.

X-SVN-Rev: 27718
This commit is contained in:
Peter Edberg 2010-02-27 03:40:56 +00:00
parent 5df76eb00a
commit 7eb5ef037e
3 changed files with 11 additions and 5 deletions

View file

@ -281,14 +281,14 @@ RegexPattern::compile(const UnicodeString &regex,
const uint32_t allFlags = UREGEX_CANON_EQ | UREGEX_CASE_INSENSITIVE | UREGEX_COMMENTS |
UREGEX_DOTALL | UREGEX_MULTILINE | UREGEX_UWORD |
UREGEX_ERROR_ON_UNKNOWN_ESCAPES | UREGEX_UNIX_LINES;
UREGEX_ERROR_ON_UNKNOWN_ESCAPES | UREGEX_UNIX_LINES | UREGEX_LITERAL;
if ((flags & ~allFlags) != 0) {
status = U_REGEX_INVALID_FLAG;
return NULL;
}
if ((flags & UREGEX_CANON_EQ) != 0) {
if ((flags & (UREGEX_CANON_EQ | UREGEX_LITERAL)) != 0) {
status = U_REGEX_UNIMPLEMENTED;
return NULL;
}
@ -332,14 +332,14 @@ RegexPattern::compile(UText *regex,
const uint32_t allFlags = UREGEX_CANON_EQ | UREGEX_CASE_INSENSITIVE | UREGEX_COMMENTS |
UREGEX_DOTALL | UREGEX_MULTILINE | UREGEX_UWORD |
UREGEX_ERROR_ON_UNKNOWN_ESCAPES | UREGEX_UNIX_LINES;
UREGEX_ERROR_ON_UNKNOWN_ESCAPES | UREGEX_UNIX_LINES | UREGEX_LITERAL;
if ((flags & ~allFlags) != 0) {
status = U_REGEX_INVALID_FLAG;
return NULL;
}
if ((flags & UREGEX_CANON_EQ) != 0) {
if ((flags & (UREGEX_CANON_EQ | UREGEX_LITERAL)) != 0) {
status = U_REGEX_UNIMPLEMENTED;
return NULL;
}

View file

@ -64,7 +64,7 @@ typedef enum URegexpFlag{
/** If set, treat the entire pattern as a literal string.
* Metacharacters or escape sequences in the input sequence will be given
* no special meaning.
* no special meaning. Not implemented yet as of ICU 4.4.
*
* The flags CASE_INSENSITIVE and UNICODE_CASE retain their impact
* on matching when used in conjunction with this flag.

View file

@ -182,6 +182,12 @@ static void TestRegexCAPI(void) {
TEST_ASSERT(status == U_REGEX_INVALID_FLAG);
uregex_close(re);
/* Open with an unimplemented flag */
status = U_ZERO_ERROR;
re = uregex_open(pat, -1, UREGEX_LITERAL, 0, &status);
TEST_ASSERT(status == U_REGEX_UNIMPLEMENTED);
uregex_close(re);
/* openC with an invalid parameter */
status = U_ZERO_ERROR;
re = uregex_openC(NULL,