Expand description
Parsing of string tokens into an Abstract Syntax Tree (AST), checking the grammar of patterns is valid. The parser only does the syntactic analysis of the supplied Token vector.
The formatter takes the Abstract Syntax Tree (AST) that was generated by the parser and constructs a string
template for values to be substituted into. The formatter also does the semantic analysis of the grammar. Once a
string template has been constructed, it can be used multiple times by simply supplying new placeholder values when
executing the format() method. Depending on the placeholder type of the pattern, a suitable selection of the
available data types can be used, these include the basic String, integers, unsigned integers and floats. In
addition to these special ICU4X types are supported such as FixedDecimal, Date, Time and DateTime structs.
See pattern strings.asciidoc in docs of pattern for the pattern formatting specification.
§Features
Available features for i18n_pattern crate:
-
compiled_data(Preferred): Enable thecompiled_datafeature oni18n_icu. Allow for the internal data of the various ICU4X components. -
blob: Enable theblobfeature oni18n_icu. Allow for instances ofBlobDataProviderto be used various ICU4X components that supportsBufferProvider. -
fs: Enable thefsfeature oni18n_icu. Allow for instances ofFsDataProviderto be used various ICU4X components that supportsBufferProvider. -
sync: Allow for rust’s concurrency capabilities to be used. Use ofArcandMutexinsteadRcandRefCell. -
log: To provide some logging information.