From 98743e56c462a6b461ed0c10dd988c2d944a7ec9 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Mon, 10 Nov 2003 18:08:54 +0000 Subject: [PATCH] ICU-2438 fix locale test failures X-SVN-Rev: 13653 --- icu4c/source/data/locales/root.txt | 7 +++++++ icu4c/source/tools/genrb/parse.c | 28 +++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/icu4c/source/data/locales/root.txt b/icu4c/source/data/locales/root.txt index a996eafd76..2729da2a57 100644 --- a/icu4c/source/data/locales/root.txt +++ b/icu4c/source/data/locales/root.txt @@ -60,9 +60,16 @@ root { Version { "0.0" } Sequence { "" } } + // placeholder for phonebook + phonebook:alias { "root/collations/standard" } + traditional:alias { "root/collations/standard" } + default { "standard" } } + // For backwards compatibility + CollationElements:alias { "root/collations/standard" } + // Here are empty collation rules just for the consistency. UCA is used instead... 01/16/2001 by weiv //CollationElements { //Version { "0.0" } diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.c index 084e1ba8f3..cde3bc098c 100644 --- a/icu4c/source/tools/genrb/parse.c +++ b/icu4c/source/tools/genrb/parse.c @@ -750,7 +750,7 @@ parseCollationElements(char *tag, uint32_t startline, UBool newCollation, UError struct UString *tokenValue; struct UString comment; enum ETokenType token; - char subtag[1024]; + char subtag[1024], typeKeyword[1024]; uint32_t line; result = table_open(bundle, tag, NULL, status); @@ -812,11 +812,33 @@ parseCollationElements(char *tag, uint32_t startline, UBool newCollation, UError table_add(result, member, line, status); } else - { - token = getToken(&tokenValue, &comment, &line, status); + { + token = peekToken(0, &tokenValue, &line, &comment, status); + /* this probably needs to be refactored or recursively use the parser */ + /* first we assume that our collation table won't have the explicit type */ + /* then, we cannot handle aliases */ if(token == TOK_OPEN_BRACE) { + token = getToken(&tokenValue, &comment, &line, status); collationRes = table_open(bundle, subtag, NULL, status); table_add(result, addCollation(collationRes, startline, status), startline, status); + } else if(token == TOK_COLON) { /* right now, we'll just try to see if we have aliases */ + /* we could have a table too */ + token = peekToken(1, &tokenValue, &line, &comment, status); + u_UCharsToChars(tokenValue->fChars, typeKeyword, u_strlen(tokenValue->fChars) + 1); + if(uprv_strcmp(typeKeyword, "alias") == 0) { + member = parseResource(subtag, NULL, status); + + if (U_FAILURE(*status)) + { + table_close(result, status); + return NULL; + } + + table_add(result, member, line, status); + } else { + *status = U_INVALID_FORMAT_ERROR; + return NULL; + } } else { *status = U_INVALID_FORMAT_ERROR; return NULL;