1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others. 2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html 3*0e209d39SAndroid Build Coastguard Worker /* 4*0e209d39SAndroid Build Coastguard Worker ********************************************************************** 5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 1999-2011, International Business Machines Corporation 6*0e209d39SAndroid Build Coastguard Worker * and others. All Rights Reserved. 7*0e209d39SAndroid Build Coastguard Worker ********************************************************************** 8*0e209d39SAndroid Build Coastguard Worker * Date Name Description 9*0e209d39SAndroid Build Coastguard Worker * 11/17/99 aliu Creation. 10*0e209d39SAndroid Build Coastguard Worker ********************************************************************** 11*0e209d39SAndroid Build Coastguard Worker */ 12*0e209d39SAndroid Build Coastguard Worker #ifndef RBT_PARS_H 13*0e209d39SAndroid Build Coastguard Worker #define RBT_PARS_H 14*0e209d39SAndroid Build Coastguard Worker 15*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h" 16*0e209d39SAndroid Build Coastguard Worker 17*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_TRANSLITERATION 18*0e209d39SAndroid Build Coastguard Worker #ifdef __cplusplus 19*0e209d39SAndroid Build Coastguard Worker 20*0e209d39SAndroid Build Coastguard Worker #include "unicode/uobject.h" 21*0e209d39SAndroid Build Coastguard Worker #include "unicode/parseerr.h" 22*0e209d39SAndroid Build Coastguard Worker #include "unicode/unorm.h" 23*0e209d39SAndroid Build Coastguard Worker #include "rbt.h" 24*0e209d39SAndroid Build Coastguard Worker #include "hash.h" 25*0e209d39SAndroid Build Coastguard Worker #include "uvector.h" 26*0e209d39SAndroid Build Coastguard Worker 27*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN 28*0e209d39SAndroid Build Coastguard Worker 29*0e209d39SAndroid Build Coastguard Worker class TransliterationRuleData; 30*0e209d39SAndroid Build Coastguard Worker class UnicodeFunctor; 31*0e209d39SAndroid Build Coastguard Worker class ParseData; 32*0e209d39SAndroid Build Coastguard Worker class RuleHalf; 33*0e209d39SAndroid Build Coastguard Worker class ParsePosition; 34*0e209d39SAndroid Build Coastguard Worker class StringMatcher; 35*0e209d39SAndroid Build Coastguard Worker 36*0e209d39SAndroid Build Coastguard Worker class TransliteratorParser : public UMemory { 37*0e209d39SAndroid Build Coastguard Worker 38*0e209d39SAndroid Build Coastguard Worker public: 39*0e209d39SAndroid Build Coastguard Worker 40*0e209d39SAndroid Build Coastguard Worker /** 41*0e209d39SAndroid Build Coastguard Worker * A Vector of TransliterationRuleData objects, one for each discrete group 42*0e209d39SAndroid Build Coastguard Worker * of rules in the rule set 43*0e209d39SAndroid Build Coastguard Worker */ 44*0e209d39SAndroid Build Coastguard Worker UVector dataVector; 45*0e209d39SAndroid Build Coastguard Worker 46*0e209d39SAndroid Build Coastguard Worker /** 47*0e209d39SAndroid Build Coastguard Worker * PUBLIC data member. 48*0e209d39SAndroid Build Coastguard Worker * A Vector of UnicodeStrings containing all of the ID blocks in the rule set 49*0e209d39SAndroid Build Coastguard Worker */ 50*0e209d39SAndroid Build Coastguard Worker UVector idBlockVector; 51*0e209d39SAndroid Build Coastguard Worker 52*0e209d39SAndroid Build Coastguard Worker /** 53*0e209d39SAndroid Build Coastguard Worker * PUBLIC data member containing the parsed compound filter, if any. 54*0e209d39SAndroid Build Coastguard Worker */ 55*0e209d39SAndroid Build Coastguard Worker UnicodeSet* compoundFilter; 56*0e209d39SAndroid Build Coastguard Worker 57*0e209d39SAndroid Build Coastguard Worker private: 58*0e209d39SAndroid Build Coastguard Worker 59*0e209d39SAndroid Build Coastguard Worker /** 60*0e209d39SAndroid Build Coastguard Worker * The current data object for which we are parsing rules 61*0e209d39SAndroid Build Coastguard Worker */ 62*0e209d39SAndroid Build Coastguard Worker TransliterationRuleData* curData; 63*0e209d39SAndroid Build Coastguard Worker 64*0e209d39SAndroid Build Coastguard Worker UTransDirection direction; 65*0e209d39SAndroid Build Coastguard Worker 66*0e209d39SAndroid Build Coastguard Worker /** 67*0e209d39SAndroid Build Coastguard Worker * Parse error information. 68*0e209d39SAndroid Build Coastguard Worker */ 69*0e209d39SAndroid Build Coastguard Worker UParseError parseError; 70*0e209d39SAndroid Build Coastguard Worker 71*0e209d39SAndroid Build Coastguard Worker /** 72*0e209d39SAndroid Build Coastguard Worker * Temporary symbol table used during parsing. 73*0e209d39SAndroid Build Coastguard Worker */ 74*0e209d39SAndroid Build Coastguard Worker ParseData* parseData; 75*0e209d39SAndroid Build Coastguard Worker 76*0e209d39SAndroid Build Coastguard Worker /** 77*0e209d39SAndroid Build Coastguard Worker * Temporary vector of matcher variables. When parsing is complete, this 78*0e209d39SAndroid Build Coastguard Worker * is copied into the array data.variables. As with data.variables, 79*0e209d39SAndroid Build Coastguard Worker * element 0 corresponds to character data.variablesBase. 80*0e209d39SAndroid Build Coastguard Worker */ 81*0e209d39SAndroid Build Coastguard Worker UVector variablesVector; 82*0e209d39SAndroid Build Coastguard Worker 83*0e209d39SAndroid Build Coastguard Worker /** 84*0e209d39SAndroid Build Coastguard Worker * Temporary table of variable names. When parsing is complete, this is 85*0e209d39SAndroid Build Coastguard Worker * copied into data.variableNames. 86*0e209d39SAndroid Build Coastguard Worker */ 87*0e209d39SAndroid Build Coastguard Worker Hashtable variableNames; 88*0e209d39SAndroid Build Coastguard Worker 89*0e209d39SAndroid Build Coastguard Worker /** 90*0e209d39SAndroid Build Coastguard Worker * String of standins for segments. Used during the parsing of a single 91*0e209d39SAndroid Build Coastguard Worker * rule. segmentStandins.charAt(0) is the standin for "$1" and corresponds 92*0e209d39SAndroid Build Coastguard Worker * to StringMatcher object segmentObjects.elementAt(0), etc. 93*0e209d39SAndroid Build Coastguard Worker */ 94*0e209d39SAndroid Build Coastguard Worker UnicodeString segmentStandins; 95*0e209d39SAndroid Build Coastguard Worker 96*0e209d39SAndroid Build Coastguard Worker /** 97*0e209d39SAndroid Build Coastguard Worker * Vector of StringMatcher objects for segments. Used during the 98*0e209d39SAndroid Build Coastguard Worker * parsing of a single rule. 99*0e209d39SAndroid Build Coastguard Worker * segmentStandins.charAt(0) is the standin for "$1" and corresponds 100*0e209d39SAndroid Build Coastguard Worker * to StringMatcher object segmentObjects.elementAt(0), etc. 101*0e209d39SAndroid Build Coastguard Worker */ 102*0e209d39SAndroid Build Coastguard Worker UVector segmentObjects; 103*0e209d39SAndroid Build Coastguard Worker 104*0e209d39SAndroid Build Coastguard Worker /** 105*0e209d39SAndroid Build Coastguard Worker * The next available stand-in for variables. This starts at some point in 106*0e209d39SAndroid Build Coastguard Worker * the private use area (discovered dynamically) and increments up toward 107*0e209d39SAndroid Build Coastguard Worker * <code>variableLimit</code>. At any point during parsing, available 108*0e209d39SAndroid Build Coastguard Worker * variables are <code>variableNext..variableLimit-1</code>. 109*0e209d39SAndroid Build Coastguard Worker */ 110*0e209d39SAndroid Build Coastguard Worker char16_t variableNext; 111*0e209d39SAndroid Build Coastguard Worker 112*0e209d39SAndroid Build Coastguard Worker /** 113*0e209d39SAndroid Build Coastguard Worker * The last available stand-in for variables. This is discovered 114*0e209d39SAndroid Build Coastguard Worker * dynamically. At any point during parsing, available variables are 115*0e209d39SAndroid Build Coastguard Worker * <code>variableNext..variableLimit-1</code>. 116*0e209d39SAndroid Build Coastguard Worker */ 117*0e209d39SAndroid Build Coastguard Worker char16_t variableLimit; 118*0e209d39SAndroid Build Coastguard Worker 119*0e209d39SAndroid Build Coastguard Worker /** 120*0e209d39SAndroid Build Coastguard Worker * When we encounter an undefined variable, we do not immediately signal 121*0e209d39SAndroid Build Coastguard Worker * an error, in case we are defining this variable, e.g., "$a = [a-z];". 122*0e209d39SAndroid Build Coastguard Worker * Instead, we save the name of the undefined variable, and substitute 123*0e209d39SAndroid Build Coastguard Worker * in the placeholder char variableLimit - 1, and decrement 124*0e209d39SAndroid Build Coastguard Worker * variableLimit. 125*0e209d39SAndroid Build Coastguard Worker */ 126*0e209d39SAndroid Build Coastguard Worker UnicodeString undefinedVariableName; 127*0e209d39SAndroid Build Coastguard Worker 128*0e209d39SAndroid Build Coastguard Worker /** 129*0e209d39SAndroid Build Coastguard Worker * The stand-in character for the 'dot' set, represented by '.' in 130*0e209d39SAndroid Build Coastguard Worker * patterns. This is allocated the first time it is needed, and 131*0e209d39SAndroid Build Coastguard Worker * reused thereafter. 132*0e209d39SAndroid Build Coastguard Worker */ 133*0e209d39SAndroid Build Coastguard Worker char16_t dotStandIn; 134*0e209d39SAndroid Build Coastguard Worker 135*0e209d39SAndroid Build Coastguard Worker public: 136*0e209d39SAndroid Build Coastguard Worker 137*0e209d39SAndroid Build Coastguard Worker /** 138*0e209d39SAndroid Build Coastguard Worker * Constructor. 139*0e209d39SAndroid Build Coastguard Worker */ 140*0e209d39SAndroid Build Coastguard Worker TransliteratorParser(UErrorCode &statusReturn); 141*0e209d39SAndroid Build Coastguard Worker 142*0e209d39SAndroid Build Coastguard Worker /** 143*0e209d39SAndroid Build Coastguard Worker * Destructor. 144*0e209d39SAndroid Build Coastguard Worker */ 145*0e209d39SAndroid Build Coastguard Worker ~TransliteratorParser(); 146*0e209d39SAndroid Build Coastguard Worker 147*0e209d39SAndroid Build Coastguard Worker /** 148*0e209d39SAndroid Build Coastguard Worker * Parse the given string as a sequence of rules, separated by newline 149*0e209d39SAndroid Build Coastguard Worker * characters ('\n'), and cause this object to implement those rules. Any 150*0e209d39SAndroid Build Coastguard Worker * previous rules are discarded. Typically this method is called exactly 151*0e209d39SAndroid Build Coastguard Worker * once after construction. 152*0e209d39SAndroid Build Coastguard Worker * 153*0e209d39SAndroid Build Coastguard Worker * Parse the given rules, in the given direction. After this call 154*0e209d39SAndroid Build Coastguard Worker * returns, query the public data members for results. The caller 155*0e209d39SAndroid Build Coastguard Worker * owns the 'data' and 'compoundFilter' data members after this 156*0e209d39SAndroid Build Coastguard Worker * call returns. 157*0e209d39SAndroid Build Coastguard Worker * @param rules rules, separated by ';' 158*0e209d39SAndroid Build Coastguard Worker * @param direction either FORWARD or REVERSE. 159*0e209d39SAndroid Build Coastguard Worker * @param pe Struct to receive information on position 160*0e209d39SAndroid Build Coastguard Worker * of error if an error is encountered 161*0e209d39SAndroid Build Coastguard Worker * @param ec Output param set to success/failure code. 162*0e209d39SAndroid Build Coastguard Worker */ 163*0e209d39SAndroid Build Coastguard Worker void parse(const UnicodeString& rules, 164*0e209d39SAndroid Build Coastguard Worker UTransDirection direction, 165*0e209d39SAndroid Build Coastguard Worker UParseError& pe, 166*0e209d39SAndroid Build Coastguard Worker UErrorCode& ec); 167*0e209d39SAndroid Build Coastguard Worker 168*0e209d39SAndroid Build Coastguard Worker /** 169*0e209d39SAndroid Build Coastguard Worker * Return the compound filter parsed by parse(). Caller owns result. 170*0e209d39SAndroid Build Coastguard Worker * @return the compound filter parsed by parse(). 171*0e209d39SAndroid Build Coastguard Worker */ 172*0e209d39SAndroid Build Coastguard Worker UnicodeSet* orphanCompoundFilter(); 173*0e209d39SAndroid Build Coastguard Worker 174*0e209d39SAndroid Build Coastguard Worker private: 175*0e209d39SAndroid Build Coastguard Worker 176*0e209d39SAndroid Build Coastguard Worker /** 177*0e209d39SAndroid Build Coastguard Worker * Return a representation of this transliterator as source rules. 178*0e209d39SAndroid Build Coastguard Worker * @param rules Output param to receive the rules. 179*0e209d39SAndroid Build Coastguard Worker * @param direction either FORWARD or REVERSE. 180*0e209d39SAndroid Build Coastguard Worker */ 181*0e209d39SAndroid Build Coastguard Worker void parseRules(const UnicodeString& rules, 182*0e209d39SAndroid Build Coastguard Worker UTransDirection direction, 183*0e209d39SAndroid Build Coastguard Worker UErrorCode& status); 184*0e209d39SAndroid Build Coastguard Worker 185*0e209d39SAndroid Build Coastguard Worker /** 186*0e209d39SAndroid Build Coastguard Worker * MAIN PARSER. Parse the next rule in the given rule string, starting 187*0e209d39SAndroid Build Coastguard Worker * at pos. Return the index after the last character parsed. Do not 188*0e209d39SAndroid Build Coastguard Worker * parse characters at or after limit. 189*0e209d39SAndroid Build Coastguard Worker * 190*0e209d39SAndroid Build Coastguard Worker * Important: The character at pos must be a non-whitespace character 191*0e209d39SAndroid Build Coastguard Worker * that is not the comment character. 192*0e209d39SAndroid Build Coastguard Worker * 193*0e209d39SAndroid Build Coastguard Worker * This method handles quoting, escaping, and whitespace removal. It 194*0e209d39SAndroid Build Coastguard Worker * parses the end-of-rule character. It recognizes context and cursor 195*0e209d39SAndroid Build Coastguard Worker * indicators. Once it does a lexical breakdown of the rule at pos, it 196*0e209d39SAndroid Build Coastguard Worker * creates a rule object and adds it to our rule list. 197*0e209d39SAndroid Build Coastguard Worker * @param rules Output param to receive the rules. 198*0e209d39SAndroid Build Coastguard Worker * @param pos the starting position. 199*0e209d39SAndroid Build Coastguard Worker * @param limit pointer past the last character of the rule. 200*0e209d39SAndroid Build Coastguard Worker * @return the index after the last character parsed. 201*0e209d39SAndroid Build Coastguard Worker */ 202*0e209d39SAndroid Build Coastguard Worker int32_t parseRule(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status); 203*0e209d39SAndroid Build Coastguard Worker 204*0e209d39SAndroid Build Coastguard Worker /** 205*0e209d39SAndroid Build Coastguard Worker * Set the variable range to [start, end] (inclusive). 206*0e209d39SAndroid Build Coastguard Worker * @param start the start value of the range. 207*0e209d39SAndroid Build Coastguard Worker * @param end the end value of the range. 208*0e209d39SAndroid Build Coastguard Worker */ 209*0e209d39SAndroid Build Coastguard Worker void setVariableRange(int32_t start, int32_t end, UErrorCode& status); 210*0e209d39SAndroid Build Coastguard Worker 211*0e209d39SAndroid Build Coastguard Worker /** 212*0e209d39SAndroid Build Coastguard Worker * Assert that the given character is NOT within the variable range. 213*0e209d39SAndroid Build Coastguard Worker * If it is, return false. This is necessary to ensure that the 214*0e209d39SAndroid Build Coastguard Worker * variable range does not overlap characters used in a rule. 215*0e209d39SAndroid Build Coastguard Worker * @param ch the given character. 216*0e209d39SAndroid Build Coastguard Worker * @return True, if the given character is NOT within the variable range. 217*0e209d39SAndroid Build Coastguard Worker */ 218*0e209d39SAndroid Build Coastguard Worker UBool checkVariableRange(UChar32 ch) const; 219*0e209d39SAndroid Build Coastguard Worker 220*0e209d39SAndroid Build Coastguard Worker /** 221*0e209d39SAndroid Build Coastguard Worker * Set the maximum backup to 'backup', in response to a pragma 222*0e209d39SAndroid Build Coastguard Worker * statement. 223*0e209d39SAndroid Build Coastguard Worker * @param backup the new value to be set. 224*0e209d39SAndroid Build Coastguard Worker */ 225*0e209d39SAndroid Build Coastguard Worker void pragmaMaximumBackup(int32_t backup); 226*0e209d39SAndroid Build Coastguard Worker 227*0e209d39SAndroid Build Coastguard Worker /** 228*0e209d39SAndroid Build Coastguard Worker * Begin normalizing all rules using the given mode, in response 229*0e209d39SAndroid Build Coastguard Worker * to a pragma statement. 230*0e209d39SAndroid Build Coastguard Worker * @param mode the given mode. 231*0e209d39SAndroid Build Coastguard Worker */ 232*0e209d39SAndroid Build Coastguard Worker void pragmaNormalizeRules(UNormalizationMode mode); 233*0e209d39SAndroid Build Coastguard Worker 234*0e209d39SAndroid Build Coastguard Worker /** 235*0e209d39SAndroid Build Coastguard Worker * Return true if the given rule looks like a pragma. 236*0e209d39SAndroid Build Coastguard Worker * @param pos offset to the first non-whitespace character 237*0e209d39SAndroid Build Coastguard Worker * of the rule. 238*0e209d39SAndroid Build Coastguard Worker * @param limit pointer past the last character of the rule. 239*0e209d39SAndroid Build Coastguard Worker * @return true if the given rule looks like a pragma. 240*0e209d39SAndroid Build Coastguard Worker */ 241*0e209d39SAndroid Build Coastguard Worker static UBool resemblesPragma(const UnicodeString& rule, int32_t pos, int32_t limit); 242*0e209d39SAndroid Build Coastguard Worker 243*0e209d39SAndroid Build Coastguard Worker /** 244*0e209d39SAndroid Build Coastguard Worker * Parse a pragma. This method assumes resemblesPragma() has 245*0e209d39SAndroid Build Coastguard Worker * already returned true. 246*0e209d39SAndroid Build Coastguard Worker * @param pos offset to the first non-whitespace character 247*0e209d39SAndroid Build Coastguard Worker * of the rule. 248*0e209d39SAndroid Build Coastguard Worker * @param limit pointer past the last character of the rule. 249*0e209d39SAndroid Build Coastguard Worker * @return the position index after the final ';' of the pragma, 250*0e209d39SAndroid Build Coastguard Worker * or -1 on failure. 251*0e209d39SAndroid Build Coastguard Worker */ 252*0e209d39SAndroid Build Coastguard Worker int32_t parsePragma(const UnicodeString& rule, int32_t pos, int32_t limit, UErrorCode& status); 253*0e209d39SAndroid Build Coastguard Worker 254*0e209d39SAndroid Build Coastguard Worker /** 255*0e209d39SAndroid Build Coastguard Worker * Called by main parser upon syntax error. Search the rule string 256*0e209d39SAndroid Build Coastguard Worker * for the probable end of the rule. Of course, if the error is that 257*0e209d39SAndroid Build Coastguard Worker * the end of rule marker is missing, then the rule end will not be found. 258*0e209d39SAndroid Build Coastguard Worker * In any case the rule start will be correctly reported. 259*0e209d39SAndroid Build Coastguard Worker * @param parseErrorCode error code. 260*0e209d39SAndroid Build Coastguard Worker * @param msg error description. 261*0e209d39SAndroid Build Coastguard Worker * @param start position of first character of current rule. 262*0e209d39SAndroid Build Coastguard Worker * @return start position of first character of current rule. 263*0e209d39SAndroid Build Coastguard Worker */ 264*0e209d39SAndroid Build Coastguard Worker int32_t syntaxError(UErrorCode parseErrorCode, const UnicodeString&, int32_t start, 265*0e209d39SAndroid Build Coastguard Worker UErrorCode& status); 266*0e209d39SAndroid Build Coastguard Worker 267*0e209d39SAndroid Build Coastguard Worker /** 268*0e209d39SAndroid Build Coastguard Worker * Parse a UnicodeSet out, store it, and return the stand-in character 269*0e209d39SAndroid Build Coastguard Worker * used to represent it. 270*0e209d39SAndroid Build Coastguard Worker * 271*0e209d39SAndroid Build Coastguard Worker * @param rule the rule for UnicodeSet. 272*0e209d39SAndroid Build Coastguard Worker * @param pos the position in pattern at which to start parsing. 273*0e209d39SAndroid Build Coastguard Worker * @return the stand-in character used to represent it. 274*0e209d39SAndroid Build Coastguard Worker */ 275*0e209d39SAndroid Build Coastguard Worker char16_t parseSet(const UnicodeString& rule, 276*0e209d39SAndroid Build Coastguard Worker ParsePosition& pos, 277*0e209d39SAndroid Build Coastguard Worker UErrorCode& status); 278*0e209d39SAndroid Build Coastguard Worker 279*0e209d39SAndroid Build Coastguard Worker /** 280*0e209d39SAndroid Build Coastguard Worker * Generate and return a stand-in for a new UnicodeFunctor. Store 281*0e209d39SAndroid Build Coastguard Worker * the matcher (adopt it). 282*0e209d39SAndroid Build Coastguard Worker * @param adopted the UnicodeFunctor to be adopted. 283*0e209d39SAndroid Build Coastguard Worker * @return a stand-in for a new UnicodeFunctor. 284*0e209d39SAndroid Build Coastguard Worker */ 285*0e209d39SAndroid Build Coastguard Worker char16_t generateStandInFor(UnicodeFunctor* adopted, UErrorCode& status); 286*0e209d39SAndroid Build Coastguard Worker 287*0e209d39SAndroid Build Coastguard Worker /** 288*0e209d39SAndroid Build Coastguard Worker * Return the standin for segment seg (1-based). 289*0e209d39SAndroid Build Coastguard Worker * @param seg the given segment. 290*0e209d39SAndroid Build Coastguard Worker * @return the standIn character for the given segment. 291*0e209d39SAndroid Build Coastguard Worker */ 292*0e209d39SAndroid Build Coastguard Worker char16_t getSegmentStandin(int32_t seg, UErrorCode& status); 293*0e209d39SAndroid Build Coastguard Worker 294*0e209d39SAndroid Build Coastguard Worker /** 295*0e209d39SAndroid Build Coastguard Worker * Set the object for segment seg (1-based). 296*0e209d39SAndroid Build Coastguard Worker * @param seg the given segment. 297*0e209d39SAndroid Build Coastguard Worker * @param adopted the StringMatcher to be adopted. 298*0e209d39SAndroid Build Coastguard Worker */ 299*0e209d39SAndroid Build Coastguard Worker void setSegmentObject(int32_t seg, StringMatcher* adopted, UErrorCode& status); 300*0e209d39SAndroid Build Coastguard Worker 301*0e209d39SAndroid Build Coastguard Worker /** 302*0e209d39SAndroid Build Coastguard Worker * Return the stand-in for the dot set. It is allocated the first 303*0e209d39SAndroid Build Coastguard Worker * time and reused thereafter. 304*0e209d39SAndroid Build Coastguard Worker * @return the stand-in for the dot set. 305*0e209d39SAndroid Build Coastguard Worker */ 306*0e209d39SAndroid Build Coastguard Worker char16_t getDotStandIn(UErrorCode& status); 307*0e209d39SAndroid Build Coastguard Worker 308*0e209d39SAndroid Build Coastguard Worker /** 309*0e209d39SAndroid Build Coastguard Worker * Append the value of the given variable name to the given 310*0e209d39SAndroid Build Coastguard Worker * UnicodeString. 311*0e209d39SAndroid Build Coastguard Worker * @param name the variable name to be appended. 312*0e209d39SAndroid Build Coastguard Worker * @param buf the given UnicodeString to append to. 313*0e209d39SAndroid Build Coastguard Worker */ 314*0e209d39SAndroid Build Coastguard Worker void appendVariableDef(const UnicodeString& name, 315*0e209d39SAndroid Build Coastguard Worker UnicodeString& buf, 316*0e209d39SAndroid Build Coastguard Worker UErrorCode& status); 317*0e209d39SAndroid Build Coastguard Worker 318*0e209d39SAndroid Build Coastguard Worker /** 319*0e209d39SAndroid Build Coastguard Worker * Glue method to get around access restrictions in C++. 320*0e209d39SAndroid Build Coastguard Worker */ 321*0e209d39SAndroid Build Coastguard Worker /*static Transliterator* createBasicInstance(const UnicodeString& id, 322*0e209d39SAndroid Build Coastguard Worker const UnicodeString* canonID);*/ 323*0e209d39SAndroid Build Coastguard Worker 324*0e209d39SAndroid Build Coastguard Worker friend class RuleHalf; 325*0e209d39SAndroid Build Coastguard Worker 326*0e209d39SAndroid Build Coastguard Worker // Disallowed methods; no impl. 327*0e209d39SAndroid Build Coastguard Worker /** 328*0e209d39SAndroid Build Coastguard Worker * Copy constructor 329*0e209d39SAndroid Build Coastguard Worker */ 330*0e209d39SAndroid Build Coastguard Worker TransliteratorParser(const TransliteratorParser&); 331*0e209d39SAndroid Build Coastguard Worker 332*0e209d39SAndroid Build Coastguard Worker /** 333*0e209d39SAndroid Build Coastguard Worker * Assignment operator 334*0e209d39SAndroid Build Coastguard Worker */ 335*0e209d39SAndroid Build Coastguard Worker TransliteratorParser& operator=(const TransliteratorParser&); 336*0e209d39SAndroid Build Coastguard Worker }; 337*0e209d39SAndroid Build Coastguard Worker 338*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END 339*0e209d39SAndroid Build Coastguard Worker 340*0e209d39SAndroid Build Coastguard Worker #endif /* #ifdef __cplusplus */ 341*0e209d39SAndroid Build Coastguard Worker 342*0e209d39SAndroid Build Coastguard Worker /** 343*0e209d39SAndroid Build Coastguard Worker * Strip/convert the following from the transliterator rules: 344*0e209d39SAndroid Build Coastguard Worker * comments 345*0e209d39SAndroid Build Coastguard Worker * newlines 346*0e209d39SAndroid Build Coastguard Worker * white space at the beginning and end of a line 347*0e209d39SAndroid Build Coastguard Worker * unescape \u notation 348*0e209d39SAndroid Build Coastguard Worker * 349*0e209d39SAndroid Build Coastguard Worker * The target must be equal in size as the source. 350*0e209d39SAndroid Build Coastguard Worker * @internal 351*0e209d39SAndroid Build Coastguard Worker */ 352*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t 353*0e209d39SAndroid Build Coastguard Worker utrans_stripRules(const UChar *source, int32_t sourceLen, UChar *target, UErrorCode *status); 354*0e209d39SAndroid Build Coastguard Worker 355*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_TRANSLITERATION */ 356*0e209d39SAndroid Build Coastguard Worker 357*0e209d39SAndroid Build Coastguard Worker #endif 358