// Used for parameterizing options parsing code // over the two builders that use it (Operator and Markup) template <class T> class OptionAdder { private:
T& builder; public:
OptionAdder(T& b) : builder(b) {} void addOption(const UnicodeString& k, Operand&& r, UErrorCode& s) {
builder.addOption(k, std::move(r), s);
}
};
// Used for parameterizing attributes parsing code // over the two builders that use it (Expression and Markup) // Unfortunately the same OptionAdder class can't just be reused, // becaues duplicate options are forbidden while duplicate attributes are not template <class T> class AttributeAdder { private:
T& builder; public:
AttributeAdder(T& b) : builder(b) {} void addAttribute(const UnicodeString& k, Operand&& r, UErrorCode& s) {
builder.addAttribute(k, std::move(r), s);
}
};
// Parser class (private) class Parser : public UMemory { public: virtual ~Parser(); private: friendclass MessageFormatter;
void parse(UParseError&, UErrorCode&);
/* Use an internal "parse error" structure to make it easier to translate absolute offsets to line offsets. This is translated back to a `UParseError` at the end of parsing.
*/ typedefstruct MessageParseError { // The line on which the error occurred
uint32_t line; // The offset, relative to the erroneous line, on which the error occurred
uint32_t offset; // The total number of characters seen before advancing to the current line. It has a value of 0 if line == 0. // It includes newline characters, because the index does too.
uint32_t lengthBeforeCurrentLine;
// This parser doesn't yet use the last two fields.
UChar preContext[U_PARSE_CONTEXT_LEN];
UChar postContext[U_PARSE_CONTEXT_LEN];
} MessageParseError;
// The input string const UnicodeString &source; // The current position within the input string -- counting in UChar32
uint32_t index; // Represents the current line (and when an error is indicated), // character offset within the line of the parse error
MessageParseError parseError;
// The structure to use for recording errors
StaticErrors& errors;
// Normalized version of the input string (optional whitespace removed)
UnicodeString& normalizedInput;
// The parent builder
MFDataModel::Builder &dataModel;
}; // class Parser
} // namespace message2
U_NAMESPACE_END
#endif/* #if !UCONFIG_NO_MF2 */
#endif/* #if !UCONFIG_NO_FORMATTING */
#endif/* U_SHOW_CPLUSPLUS_API */
#endif// MESSAGEFORMAT_PARSER_H
#endif// U_HIDE_DEPRECATED_API // eof
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.