5 #include "unicode/uchar.h"
6 #include "unicode/uscript.h"
14 const unsigned num_codes =
codes_.size();
36 tprintf(
"Invalid start of Myanmar syllable:0x%x\n",
41 if (ConsumeSubscriptIfPresent())
return true;
42 ConsumeOptionalSignsIfPresent();
62 bool ValidateMyanmar::ConsumeSubscriptIfPresent() {
64 const unsigned num_codes =
codes_.size();
77 bool ValidateMyanmar::ConsumeOptionalSignsIfPresent() {
80 const std::vector<char32> kMedials({kMyanmarAsat, kMyanmarMedialYa, 0x103c,
81 0x103d, 0x103e, 0x105e, 0x105f, 0x1060,
83 for (
char32 ch : kMedials) {
86 if (ch == kMyanmarMedialYa &&
94 if (ch == 0x102d || ch == 0x102e || ch == 0x1032) {
99 if (ch == 0x102f || ch == 0x1030 || (0x1056 <= ch && ch <= 0x1059) ||
100 ch == 0x1062 || ch == 0x1067 || ch == 0x1068 ||
101 (0x1071 <= ch && ch <= 0x1074) || (0x1083 <= ch && ch <= 0x1086) ||
102 ch == 0x109c || ch == 0x109d) {
115 const std::vector<char32> kSigns({0x1036, 0x1037, 0x1038});
116 for (
char32 ch : kSigns) {
123 if (ch == 0x1038 || ch == kMyanmarAsat || ch == 0x1063 || ch == 0x1064 ||
124 (0x1069 <= ch && ch <= 0x106d) || (0x1087 <= ch && ch <= 0x108d) ||
125 ch == 0x108f || ch == 0x109a || ch == 0x109b ||
126 (0xaa7b <= ch && ch <= 0xaa7d)) {
141 bool ValidateMyanmar::IsMyanmarLetter(
char32 ch) {
142 return (0x1000 <= ch && ch <= 0x102a) || ch == 0x103f ||
143 (0x104c <= ch && ch <= 0x1055) || (0x105a <= ch && ch <= 0x105d) ||
144 ch == 0x1061 || ch == 0x1065 || ch == 0x1066 ||
145 (0x106e <= ch && ch <= 0x1070) || (0x1075 <= ch && ch <= 0x1081) ||
146 ch == 0x108e || (0xa9e0 <= ch && ch <= 0xa9e4) ||
147 (0xa9e7 <= ch && ch <= 0xa9ef) || (0xa9fa <= ch && ch <= 0xa9fe) ||
148 (0xaa60 <= ch && ch <= 0xaa6f) || (0xaa71 <= ch && ch <= 0xaa73) ||
149 ch == 0xaa7a || ch == 0xaa7e || ch == 0xaa7f;
157 bool ValidateMyanmar::IsMyanmarOther(
char32 ch) {
159 UScriptCode script_code = uscript_getScript(ch, err);
163 return (0x1040 <= ch && ch <= 0x104f) || (0x1090 <= ch && ch <= 0x1099) ||
164 (0x109e <= ch && ch <= 0x109f) || (0xa9f0 <= ch && ch <= 0xa9f9) ||
165 (ch == 0xa9e6 || ch == 0xaa70) || (0xaa74 <= ch && ch <= 0xaa79);