[indic/khmer/myanmar] Add static_assert that categories match OT_*
This commit is contained in:
parent
15ea4ccb04
commit
d414fb3328
|
@ -413,7 +413,7 @@ static const int indic_syllable_machine_en_main = 39;
|
|||
|
||||
|
||||
|
||||
#line 111 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 115 "hb-ot-shaper-indic-machine.rl"
|
||||
|
||||
|
||||
#define found_syllable(syllable_type) \
|
||||
|
@ -440,7 +440,7 @@ find_syllables_indic (hb_buffer_t *buffer)
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 131 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 135 "hb-ot-shaper-indic-machine.rl"
|
||||
|
||||
|
||||
p = 0;
|
||||
|
@ -485,51 +485,51 @@ _eof_trans:
|
|||
{te = p+1;}
|
||||
break;
|
||||
case 11:
|
||||
#line 107 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 111 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p+1;{ found_syllable (indic_non_indic_cluster); }}
|
||||
break;
|
||||
case 13:
|
||||
#line 102 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_consonant_syllable); }}
|
||||
break;
|
||||
case 14:
|
||||
#line 103 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 107 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_vowel_syllable); }}
|
||||
break;
|
||||
case 17:
|
||||
#line 104 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 108 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_standalone_cluster); }}
|
||||
break;
|
||||
case 19:
|
||||
#line 105 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 109 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_symbol_cluster); }}
|
||||
break;
|
||||
case 15:
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 110 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_broken_cluster); }}
|
||||
break;
|
||||
case 16:
|
||||
#line 107 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 111 "hb-ot-shaper-indic-machine.rl"
|
||||
{te = p;p--;{ found_syllable (indic_non_indic_cluster); }}
|
||||
break;
|
||||
case 1:
|
||||
#line 102 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_consonant_syllable); }}
|
||||
break;
|
||||
case 3:
|
||||
#line 103 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 107 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_vowel_syllable); }}
|
||||
break;
|
||||
case 7:
|
||||
#line 104 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 108 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_standalone_cluster); }}
|
||||
break;
|
||||
case 8:
|
||||
#line 105 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 109 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_symbol_cluster); }}
|
||||
break;
|
||||
case 4:
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 110 "hb-ot-shaper-indic-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (indic_broken_cluster); }}
|
||||
break;
|
||||
case 6:
|
||||
|
@ -550,19 +550,19 @@ _eof_trans:
|
|||
case 18:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 102 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
{act = 1;}
|
||||
break;
|
||||
case 5:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 106 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 110 "hb-ot-shaper-indic-machine.rl"
|
||||
{act = 5;}
|
||||
break;
|
||||
case 12:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 107 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 111 "hb-ot-shaper-indic-machine.rl"
|
||||
{act = 6;}
|
||||
break;
|
||||
#line 569 "hb-ot-shaper-indic-machine.hh"
|
||||
|
@ -590,7 +590,7 @@ _again:
|
|||
|
||||
}
|
||||
|
||||
#line 139 "hb-ot-shaper-indic-machine.rl"
|
||||
#line 143 "hb-ot-shaper-indic-machine.rl"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,9 @@ enum indic_syllable_type_t {
|
|||
|
||||
%%{
|
||||
|
||||
# These values are replicated from indic.hh; keep in sync.
|
||||
|
||||
# These values are replicated from indic.hh, and relisted in indic.cc; keep in sync.
|
||||
|
||||
export C = 1;
|
||||
export V = 2;
|
||||
export N = 3;
|
||||
|
@ -75,6 +77,7 @@ export CM = 16;
|
|||
export Symbol= 17;
|
||||
export CS = 18;
|
||||
|
||||
|
||||
c = (C | Ra); # is_consonant
|
||||
n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier
|
||||
z = ZWJ|ZWNJ; # is_joiner
|
||||
|
|
|
@ -39,6 +39,29 @@
|
|||
*/
|
||||
|
||||
|
||||
#define I_Check(C) static_assert (OT_##C == I_Cat(C), "")
|
||||
|
||||
I_Check (C);
|
||||
I_Check (V);
|
||||
I_Check (N);
|
||||
I_Check (H);
|
||||
I_Check (ZWNJ);
|
||||
I_Check (ZWJ);
|
||||
I_Check (M);
|
||||
I_Check (SM);
|
||||
I_Check (A);
|
||||
I_Check (VD);
|
||||
I_Check (PLACEHOLDER);
|
||||
I_Check (DOTTEDCIRCLE);
|
||||
I_Check (RS);
|
||||
I_Check (Repha);
|
||||
I_Check (Ra);
|
||||
I_Check (CM);
|
||||
I_Check (Symbol);
|
||||
I_Check (CS);
|
||||
|
||||
#undef I_Check
|
||||
|
||||
static inline void
|
||||
set_indic_properties (hb_glyph_info_t &info)
|
||||
{
|
||||
|
@ -133,11 +156,6 @@ static const indic_config_t indic_configs[] =
|
|||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Indic shaper.
|
||||
*/
|
||||
|
||||
static const hb_ot_map_feature_t
|
||||
indic_features[] =
|
||||
{
|
||||
|
|
|
@ -76,9 +76,12 @@ enum ot_category_t {
|
|||
OT_Ygroup = 27,
|
||||
|
||||
/* Myanmar */
|
||||
OT_IV = OT_V,
|
||||
OT_As = 32, // Asat
|
||||
OT_D = 33, // Digits except zero
|
||||
OT_D0 = 34, // Digit zero
|
||||
OT_DB = OT_N, // Dot below
|
||||
OT_GB = OT_PLACEHOLDER,
|
||||
OT_MH = 35, // Medial
|
||||
OT_MR = 36, // Medial
|
||||
OT_MW = 37, // Medial
|
||||
|
|
|
@ -257,7 +257,7 @@ static const int khmer_syllable_machine_en_main = 20;
|
|||
|
||||
|
||||
|
||||
#line 98 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 102 "hb-ot-shaper-khmer-machine.rl"
|
||||
|
||||
|
||||
#define found_syllable(syllable_type) \
|
||||
|
@ -284,7 +284,7 @@ find_syllables_khmer (hb_buffer_t *buffer)
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 118 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 122 "hb-ot-shaper-khmer-machine.rl"
|
||||
|
||||
|
||||
p = 0;
|
||||
|
@ -329,27 +329,27 @@ _eof_trans:
|
|||
{te = p+1;}
|
||||
break;
|
||||
case 8:
|
||||
#line 94 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 98 "hb-ot-shaper-khmer-machine.rl"
|
||||
{te = p+1;{ found_syllable (khmer_non_khmer_cluster); }}
|
||||
break;
|
||||
case 10:
|
||||
#line 92 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 96 "hb-ot-shaper-khmer-machine.rl"
|
||||
{te = p;p--;{ found_syllable (khmer_consonant_syllable); }}
|
||||
break;
|
||||
case 12:
|
||||
#line 93 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 97 "hb-ot-shaper-khmer-machine.rl"
|
||||
{te = p;p--;{ found_syllable (khmer_broken_cluster); }}
|
||||
break;
|
||||
case 11:
|
||||
#line 94 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 98 "hb-ot-shaper-khmer-machine.rl"
|
||||
{te = p;p--;{ found_syllable (khmer_non_khmer_cluster); }}
|
||||
break;
|
||||
case 1:
|
||||
#line 92 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 96 "hb-ot-shaper-khmer-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (khmer_consonant_syllable); }}
|
||||
break;
|
||||
case 5:
|
||||
#line 93 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 97 "hb-ot-shaper-khmer-machine.rl"
|
||||
{{p = ((te))-1;}{ found_syllable (khmer_broken_cluster); }}
|
||||
break;
|
||||
case 3:
|
||||
|
@ -367,13 +367,13 @@ _eof_trans:
|
|||
case 4:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 93 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 97 "hb-ot-shaper-khmer-machine.rl"
|
||||
{act = 2;}
|
||||
break;
|
||||
case 9:
|
||||
#line 1 "NONE"
|
||||
{te = p+1;}
|
||||
#line 94 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 98 "hb-ot-shaper-khmer-machine.rl"
|
||||
{act = 3;}
|
||||
break;
|
||||
#line 380 "hb-ot-shaper-khmer-machine.hh"
|
||||
|
@ -401,7 +401,7 @@ _again:
|
|||
|
||||
}
|
||||
|
||||
#line 126 "hb-ot-shaper-khmer-machine.rl"
|
||||
#line 130 "hb-ot-shaper-khmer-machine.rl"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,9 @@ enum khmer_syllable_type_t {
|
|||
|
||||
%%{
|
||||
|
||||
# These values are replicated from indic.hh; keep in sync.
|
||||
|
||||
# These values are replicated from indic.hh, and relisted in khmer.cc; keep in sync.
|
||||
|
||||
export C = 1;
|
||||
export V = 2;
|
||||
export ZWNJ = 5;
|
||||
|
@ -73,6 +75,7 @@ export Robatic = 25;
|
|||
export Xgroup = 26;
|
||||
export Ygroup = 27;
|
||||
|
||||
|
||||
c = (C | Ra | V);
|
||||
cn = c.((ZWJ|ZWNJ)?.Robatic)?;
|
||||
joiner = (ZWJ | ZWNJ);
|
||||
|
|
|
@ -37,6 +37,30 @@
|
|||
* Khmer shaper.
|
||||
*/
|
||||
|
||||
|
||||
#define K_Check(C) static_assert (OT_##C == K_Cat(C), "")
|
||||
|
||||
K_Check (C);
|
||||
K_Check (V);
|
||||
K_Check (ZWNJ);
|
||||
K_Check (ZWJ);
|
||||
K_Check (PLACEHOLDER);
|
||||
K_Check (DOTTEDCIRCLE);
|
||||
K_Check (Ra);
|
||||
|
||||
K_Check (VAbv);
|
||||
K_Check (VBlw);
|
||||
K_Check (VPre);
|
||||
K_Check (VPst);
|
||||
|
||||
K_Check (Coeng);
|
||||
K_Check (Robatic);
|
||||
K_Check (Xgroup);
|
||||
K_Check (Ygroup);
|
||||
|
||||
#undef K_Check
|
||||
|
||||
|
||||
static const hb_ot_map_feature_t
|
||||
khmer_features[] =
|
||||
{
|
||||
|
|
|
@ -435,7 +435,7 @@ static const int myanmar_syllable_machine_en_main = 0;
|
|||
|
||||
|
||||
|
||||
#line 118 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 121 "hb-ot-shaper-myanmar-machine.rl"
|
||||
|
||||
|
||||
#define found_syllable(syllable_type) \
|
||||
|
@ -462,7 +462,7 @@ find_syllables_myanmar (hb_buffer_t *buffer)
|
|||
act = 0;
|
||||
}
|
||||
|
||||
#line 138 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 141 "hb-ot-shaper-myanmar-machine.rl"
|
||||
|
||||
|
||||
p = 0;
|
||||
|
@ -503,35 +503,35 @@ _eof_trans:
|
|||
|
||||
switch ( _myanmar_syllable_machine_trans_actions[_trans] ) {
|
||||
case 6:
|
||||
#line 110 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 113 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_consonant_syllable); }}
|
||||
break;
|
||||
case 4:
|
||||
#line 111 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 114 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_non_myanmar_cluster); }}
|
||||
break;
|
||||
case 10:
|
||||
#line 112 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 115 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_punctuation_cluster); }}
|
||||
break;
|
||||
case 8:
|
||||
#line 113 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 116 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_broken_cluster); }}
|
||||
break;
|
||||
case 3:
|
||||
#line 114 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 117 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p+1;{ found_syllable (myanmar_non_myanmar_cluster); }}
|
||||
break;
|
||||
case 5:
|
||||
#line 110 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 113 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p;p--;{ found_syllable (myanmar_consonant_syllable); }}
|
||||
break;
|
||||
case 7:
|
||||
#line 113 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 116 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p;p--;{ found_syllable (myanmar_broken_cluster); }}
|
||||
break;
|
||||
case 9:
|
||||
#line 114 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 117 "hb-ot-shaper-myanmar-machine.rl"
|
||||
{te = p;p--;{ found_syllable (myanmar_non_myanmar_cluster); }}
|
||||
break;
|
||||
#line 538 "hb-ot-shaper-myanmar-machine.hh"
|
||||
|
@ -559,7 +559,7 @@ _again:
|
|||
|
||||
}
|
||||
|
||||
#line 146 "hb-ot-shaper-myanmar-machine.rl"
|
||||
#line 149 "hb-ot-shaper-myanmar-machine.rl"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,9 @@ enum myanmar_syllable_type_t {
|
|||
|
||||
%%{
|
||||
|
||||
# These values are replicated from indic.hh; keep in sync.
|
||||
|
||||
# These values are replicated from indic.hh, and relisted in myanmar.cc; keep in sync.
|
||||
|
||||
export C = 1;
|
||||
export IV = 2;
|
||||
export DB = 3; # Dot below = OT_N
|
||||
|
|
|
@ -37,6 +37,42 @@
|
|||
* Myanmar shaper.
|
||||
*/
|
||||
|
||||
|
||||
#define M_Check(C) static_assert (OT_##C == M_Cat(C), "")
|
||||
|
||||
M_Check (C);
|
||||
M_Check (IV);
|
||||
M_Check (DB);
|
||||
M_Check (H);
|
||||
M_Check (ZWNJ);
|
||||
M_Check (ZWJ);
|
||||
M_Check (SM);
|
||||
M_Check (GB);
|
||||
M_Check (DOTTEDCIRCLE);
|
||||
M_Check (A);
|
||||
M_Check (Ra);
|
||||
M_Check (CS);
|
||||
|
||||
M_Check (VAbv);
|
||||
M_Check (VBlw);
|
||||
M_Check (VPre);
|
||||
M_Check (VPst);
|
||||
|
||||
M_Check (As);
|
||||
M_Check (D);
|
||||
M_Check (D0);
|
||||
M_Check (MH);
|
||||
M_Check (MR);
|
||||
M_Check (MW);
|
||||
M_Check (MY);
|
||||
M_Check (PT);
|
||||
M_Check (VS);
|
||||
M_Check (P);
|
||||
M_Check (ML);
|
||||
|
||||
#undef M_Check
|
||||
|
||||
|
||||
static const hb_tag_t
|
||||
myanmar_basic_features[] =
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue