Skip to content

Commit

Permalink
ICU-22261 Add tech preview implementation for MessageFormat 2.0 to i…
Browse files Browse the repository at this point in the history
…cu4c

Adds an implementation of the draft MessageFormat 2.0 spec, found at
https://github.com/unicode-org/message-format-wg
  • Loading branch information
catamorphism committed Sep 2, 2023
1 parent 869713b commit 7be0121
Show file tree
Hide file tree
Showing 31 changed files with 14,383 additions and 1 deletion.
15 changes: 14 additions & 1 deletion icu4c/source/common/unicode/utypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ typedef enum UErrorCode {

U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */


#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal UErrorCode warning value.
Expand Down Expand Up @@ -568,12 +569,24 @@ typedef enum UErrorCode {
U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */
U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */
U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */

/* MessageFormat 2.0 errors */
U_UNRESOLVED_VARIABLE_ERROR, /** A variable is referred to but not bound by any definition */
U_SYNTAX_ERROR, /** Includes all syntax errors */
U_UNKNOWN_FUNCTION_ERROR, /** An annotation refers to a function not defined by the standard or custom function registry */
U_VARIANT_KEY_MISMATCH_ERROR, /** In a match-construct, one or more variants had a different number of keys from the number of selectors */
U_FORMATTING_ERROR, /** Covers all runtime errors: for example, an internally inconsistent set of options. */
U_NONEXHAUSTIVE_PATTERN_ERROR, /** In a match-construct, the variants do not cover all possible values */
U_DUPLICATE_OPTION_NAME_ERROR, /** In an annotation, the same option name appears more than once */
U_SELECTOR_ERROR, /** A selector function is applied to an operand of the wrong type */
U_MISSING_SELECTOR_ANNOTATION_ERROR, /** A selector expression evaluates to an unannotated operand */

#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal formatting API error code.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
U_FMT_PARSE_ERROR_LIMIT = 0x10114,
U_FMT_PARSE_ERROR_LIMIT = 0x10125,
#endif // U_HIDE_DEPRECATED_API

/*
Expand Down
9 changes: 9 additions & 0 deletions icu4c/source/common/utypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ _uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
"U_FORMAT_INEXACT_ERROR",
"U_NUMBER_ARG_OUTOFBOUNDS_ERROR",
"U_NUMBER_SKELETON_SYNTAX_ERROR",
"U_UNRESOLVED_VARIABLE_ERROR",
"U_SYNTAX_ERROR",
"U_UNKNOWN_FUNCTION_ERROR",
"U_VARIANT_KEY_MISMATCH_ERROR",
"U_FORMATTING_ERROR",
"U_NONEXHAUSTIVE_PATTERN_ERROR",
"U_DUPLICATE_OPTION_NAME_ERROR",
"U_SELECTOR_ERROR",
"U_MISSING_SELECTOR_ANNOTATION_ERROR"
};

static const char * const
Expand Down
Loading

0 comments on commit 7be0121

Please sign in to comment.