1 | // This file is autogenerated. Do not edit it! |
2 | // |
3 | // See docs/ragel.md for details. |
4 | |
5 | #![allow ( |
6 | dead_code, |
7 | non_upper_case_globals, |
8 | unused_assignments, |
9 | unused_parens, |
10 | while_true, |
11 | clippy::assign_op_pattern, |
12 | clippy::collapsible_if, |
13 | clippy::comparison_chain, |
14 | clippy::double_parens, |
15 | clippy::unnecessary_cast, |
16 | clippy::single_match, |
17 | clippy::never_loop |
18 | )] |
19 | |
20 | use crate::buffer::Buffer; |
21 | |
22 | static _myanmar_syllable_machine_trans_keys: [u8; 106] = [ |
23 | 0, 21, 1, 20, 3, 19, 3, 5, 3, 19, 1, 15, 3, 15, 3, 15, 1, 19, 1, 19, 1, 19, 1, 19, 0, 8, 1, 19, |
24 | 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 3, 5, 3, 19, 1, |
25 | 15, 3, 15, 3, 15, 1, 19, 1, 19, 1, 19, 1, 19, 0, 8, 1, 20, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, |
26 | 1, 20, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 19, 0, 20, 0, 8, 5, 5, 0, 0, |
27 | ]; |
28 | static _myanmar_syllable_machine_char_class: [i8; 34] = [ |
29 | 0, 0, 1, 2, 3, 3, 4, 5, 4, 6, 7, 4, 4, 4, 4, 8, 4, 9, 10, 4, 11, 12, 13, 14, 15, 16, 17, 18, |
30 | 19, 20, 21, 7, 0, 0, |
31 | ]; |
32 | static _myanmar_syllable_machine_index_offsets: [i16; 54] = [ |
33 | 0, 22, 42, 59, 62, 79, 94, 107, 120, 139, 158, 177, 196, 205, 224, 243, 262, 281, 300, 320, |
34 | 339, 358, 377, 396, 415, 432, 435, 452, 467, 480, 493, 512, 531, 550, 569, 578, 598, 617, 636, |
35 | 655, 674, 693, 713, 732, 751, 770, 789, 808, 828, 847, 868, 877, 0, 0, |
36 | ]; |
37 | static _myanmar_syllable_machine_indices: [i8; 880] = [ |
38 | 2, 3, 4, 5, 1, 6, 7, 2, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 22, |
39 | 26, 27, 22, 22, 28, 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 25, 22, 26, 22, 22, 22, 39, 22, |
40 | 22, 22, 22, 22, 33, 22, 22, 22, 37, 25, 22, 26, 25, 22, 26, 22, 22, 22, 22, 22, 22, 22, 22, 22, |
41 | 33, 22, 22, 22, 37, 40, 22, 25, 22, 26, 33, 22, 22, 41, 22, 22, 22, 22, 22, 33, 25, 22, 26, 22, |
42 | 22, 22, 41, 22, 22, 22, 22, 22, 33, 25, 22, 26, 22, 22, 22, 22, 22, 22, 22, 22, 22, 33, 23, 22, |
43 | 25, 22, 26, 27, 22, 22, 42, 22, 42, 22, 22, 22, 33, 43, 22, 22, 37, 23, 22, 25, 22, 26, 27, 22, |
44 | 22, 22, 22, 22, 22, 22, 22, 33, 22, 22, 22, 37, 23, 22, 25, 22, 26, 27, 22, 22, 42, 22, 22, 22, |
45 | 22, 22, 33, 43, 22, 22, 37, 23, 22, 25, 22, 26, 27, 22, 22, 22, 22, 22, 22, 22, 22, 33, 43, 22, |
46 | 22, 37, 2, 22, 22, 22, 22, 22, 22, 22, 2, 23, 22, 25, 22, 26, 27, 22, 22, 28, 22, 29, 30, 31, |
47 | 32, 33, 34, 35, 36, 37, 23, 22, 25, 22, 26, 27, 22, 22, 44, 22, 22, 22, 22, 22, 33, 34, 35, 36, |
48 | 37, 23, 22, 25, 22, 26, 27, 22, 22, 22, 22, 22, 22, 22, 22, 33, 34, 35, 36, 37, 23, 22, 25, 22, |
49 | 26, 27, 22, 22, 22, 22, 22, 22, 22, 22, 33, 34, 35, 22, 37, 23, 22, 25, 22, 26, 27, 22, 22, 22, |
50 | 22, 22, 22, 22, 22, 33, 22, 35, 22, 37, 23, 22, 25, 22, 26, 27, 22, 22, 22, 22, 22, 22, 22, 22, |
51 | 33, 34, 35, 36, 37, 44, 23, 22, 25, 22, 26, 27, 22, 22, 22, 22, 29, 22, 31, 22, 33, 34, 35, 36, |
52 | 37, 23, 22, 25, 22, 26, 27, 22, 22, 44, 22, 29, 22, 22, 22, 33, 34, 35, 36, 37, 23, 22, 25, 22, |
53 | 26, 27, 22, 22, 45, 22, 29, 30, 31, 22, 33, 34, 35, 36, 37, 23, 22, 25, 22, 26, 27, 22, 22, 22, |
54 | 22, 29, 30, 31, 22, 33, 34, 35, 36, 37, 23, 24, 25, 22, 26, 27, 22, 22, 28, 22, 29, 30, 31, 32, |
55 | 33, 34, 35, 36, 37, 47, 46, 6, 46, 46, 46, 48, 46, 46, 46, 46, 46, 15, 46, 46, 46, 19, 47, 46, |
56 | 6, 47, 46, 6, 46, 46, 46, 46, 46, 46, 46, 46, 46, 15, 46, 46, 46, 19, 49, 46, 47, 46, 6, 15, |
57 | 46, 46, 50, 46, 46, 46, 46, 46, 15, 47, 46, 6, 46, 46, 46, 50, 46, 46, 46, 46, 46, 15, 47, 46, |
58 | 6, 46, 46, 46, 46, 46, 46, 46, 46, 46, 15, 3, 46, 47, 46, 6, 7, 46, 46, 51, 46, 51, 46, 46, 46, |
59 | 15, 52, 46, 46, 19, 3, 46, 47, 46, 6, 7, 46, 46, 46, 46, 46, 46, 46, 46, 15, 46, 46, 46, 19, 3, |
60 | 46, 47, 46, 6, 7, 46, 46, 51, 46, 46, 46, 46, 46, 15, 52, 46, 46, 19, 3, 46, 47, 46, 6, 7, 46, |
61 | 46, 46, 46, 46, 46, 46, 46, 15, 52, 46, 46, 19, 53, 46, 46, 46, 46, 46, 46, 46, 53, 3, 4, 47, |
62 | 46, 6, 7, 46, 46, 9, 46, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 3, 46, 47, 46, 6, 7, 46, 46, |
63 | 9, 46, 11, 12, 13, 14, 15, 16, 17, 18, 19, 3, 46, 47, 46, 6, 7, 46, 46, 54, 46, 46, 46, 46, 46, |
64 | 15, 16, 17, 18, 19, 3, 46, 47, 46, 6, 7, 46, 46, 46, 46, 46, 46, 46, 46, 15, 16, 17, 18, 19, 3, |
65 | 46, 47, 46, 6, 7, 46, 46, 46, 46, 46, 46, 46, 46, 15, 16, 17, 46, 19, 3, 46, 47, 46, 6, 7, 46, |
66 | 46, 46, 46, 46, 46, 46, 46, 15, 46, 17, 46, 19, 3, 46, 47, 46, 6, 7, 46, 46, 46, 46, 46, 46, |
67 | 46, 46, 15, 16, 17, 18, 19, 54, 3, 46, 47, 46, 6, 7, 46, 46, 46, 46, 11, 46, 13, 46, 15, 16, |
68 | 17, 18, 19, 3, 46, 47, 46, 6, 7, 46, 46, 54, 46, 11, 46, 46, 46, 15, 16, 17, 18, 19, 3, 46, 47, |
69 | 46, 6, 7, 46, 46, 55, 46, 11, 12, 13, 46, 15, 16, 17, 18, 19, 3, 46, 47, 46, 6, 7, 46, 46, 46, |
70 | 46, 11, 12, 13, 46, 15, 16, 17, 18, 19, 3, 4, 47, 46, 6, 7, 46, 46, 9, 46, 11, 12, 13, 14, 15, |
71 | 16, 17, 18, 19, 23, 24, 25, 22, 26, 27, 22, 22, 56, 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
72 | 23, 57, 25, 22, 26, 27, 22, 22, 28, 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, 2, 3, 4, 47, 46, 6, |
73 | 7, 2, 2, 9, 46, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 2, 58, 58, 58, 58, 58, 58, 2, 2, 59, 0, |
74 | 0, |
75 | ]; |
76 | static _myanmar_syllable_machine_index_defaults: [i8; 54] = [ |
77 | 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, |
78 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 22, |
79 | 22, 46, 58, 58, 0, 0, |
80 | ]; |
81 | static _myanmar_syllable_machine_cond_targs: [i8; 62] = [ |
82 | 0, 0, 1, 24, 34, 0, 25, 31, 47, 36, 50, 37, 42, 43, 44, 27, 39, 40, 41, 30, 46, 51, 0, 2, 12, |
83 | 0, 3, 9, 13, 14, 19, 20, 21, 5, 16, 17, 18, 8, 23, 4, 6, 7, 10, 11, 15, 22, 0, 0, 26, 28, 29, |
84 | 32, 33, 35, 38, 45, 48, 49, 0, 0, 0, 0, |
85 | ]; |
86 | static _myanmar_syllable_machine_cond_actions: [i8; 62] = [ |
87 | 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 0, 0, |
88 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 0, 0, |
89 | ]; |
90 | static _myanmar_syllable_machine_to_state_actions: [i8; 54] = [ |
91 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
92 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
93 | ]; |
94 | static _myanmar_syllable_machine_from_state_actions: [i8; 54] = [ |
95 | 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
96 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
97 | ]; |
98 | static _myanmar_syllable_machine_eof_trans: [i8; 54] = [ |
99 | 1, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
100 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 23, |
101 | 23, 47, 59, 59, 0, 0, |
102 | ]; |
103 | static myanmar_syllable_machine_start: i32 = 0; |
104 | static myanmar_syllable_machine_first_final: i32 = 0; |
105 | static myanmar_syllable_machine_error: i32 = -1; |
106 | static myanmar_syllable_machine_en_main: i32 = 0; |
107 | #[derive (Clone, Copy)] |
108 | pub enum SyllableType { |
109 | ConsonantSyllable = 0, |
110 | PunctuationCluster, |
111 | BrokenCluster, |
112 | NonMyanmarCluster, |
113 | } |
114 | |
115 | pub fn find_syllables_myanmar(buffer: &mut Buffer) { |
116 | let mut cs = 0; |
117 | let mut ts = 0; |
118 | let mut te; |
119 | let mut p = 0; |
120 | let pe = buffer.len; |
121 | let eof = buffer.len; |
122 | let mut syllable_serial = 1u8; |
123 | |
124 | macro_rules! found_syllable { |
125 | ($kind:expr) => {{ |
126 | found_syllable(ts, te, &mut syllable_serial, $kind, buffer); |
127 | }}; |
128 | } |
129 | |
130 | { |
131 | cs = (myanmar_syllable_machine_start) as i32; |
132 | ts = 0; |
133 | te = 0; |
134 | } |
135 | |
136 | { |
137 | let mut _trans = 0; |
138 | let mut _keys: i32 = 0; |
139 | let mut _inds: i32 = 0; |
140 | let mut _ic = 0; |
141 | '_resume: while (p != pe || p == eof) { |
142 | '_again: while (true) { |
143 | match (_myanmar_syllable_machine_from_state_actions[(cs) as usize]) { |
144 | 2 => { |
145 | ts = p; |
146 | } |
147 | |
148 | _ => {} |
149 | } |
150 | if (p == eof) { |
151 | { |
152 | if (_myanmar_syllable_machine_eof_trans[(cs) as usize] > 0) { |
153 | { |
154 | _trans = |
155 | (_myanmar_syllable_machine_eof_trans[(cs) as usize]) as u32 - 1; |
156 | } |
157 | } |
158 | } |
159 | } else { |
160 | { |
161 | _keys = (cs << 1) as i32; |
162 | _inds = (_myanmar_syllable_machine_index_offsets[(cs) as usize]) as i32; |
163 | if ((buffer.info[p].indic_category() as u8) <= 32 |
164 | && (buffer.info[p].indic_category() as u8) >= 1) |
165 | { |
166 | { |
167 | _ic = (_myanmar_syllable_machine_char_class |
168 | [((buffer.info[p].indic_category() as u8) as i32 - 1) as usize]) |
169 | as i32; |
170 | if (_ic |
171 | <= (_myanmar_syllable_machine_trans_keys[(_keys + 1) as usize]) |
172 | as i32 |
173 | && _ic |
174 | >= (_myanmar_syllable_machine_trans_keys[(_keys) as usize]) |
175 | as i32) |
176 | { |
177 | _trans = (_myanmar_syllable_machine_indices[(_inds |
178 | + (_ic |
179 | - (_myanmar_syllable_machine_trans_keys |
180 | [(_keys) as usize]) |
181 | as i32) |
182 | as i32) |
183 | as usize]) |
184 | as u32; |
185 | } else { |
186 | _trans = (_myanmar_syllable_machine_index_defaults |
187 | [(cs) as usize]) |
188 | as u32; |
189 | } |
190 | } |
191 | } else { |
192 | { |
193 | _trans = (_myanmar_syllable_machine_index_defaults[(cs) as usize]) |
194 | as u32; |
195 | } |
196 | } |
197 | } |
198 | } |
199 | cs = (_myanmar_syllable_machine_cond_targs[(_trans) as usize]) as i32; |
200 | if (_myanmar_syllable_machine_cond_actions[(_trans) as usize] != 0) { |
201 | { |
202 | match (_myanmar_syllable_machine_cond_actions[(_trans) as usize]) { |
203 | 6 => { |
204 | te = p + 1; |
205 | { |
206 | found_syllable!(SyllableType::ConsonantSyllable); |
207 | } |
208 | } |
209 | 4 => { |
210 | te = p + 1; |
211 | { |
212 | found_syllable!(SyllableType::NonMyanmarCluster); |
213 | } |
214 | } |
215 | 10 => { |
216 | te = p + 1; |
217 | { |
218 | found_syllable!(SyllableType::PunctuationCluster); |
219 | } |
220 | } |
221 | 8 => { |
222 | te = p + 1; |
223 | { |
224 | found_syllable!(SyllableType::BrokenCluster); |
225 | } |
226 | } |
227 | 3 => { |
228 | te = p + 1; |
229 | { |
230 | found_syllable!(SyllableType::NonMyanmarCluster); |
231 | } |
232 | } |
233 | 5 => { |
234 | te = p; |
235 | p = p - 1; |
236 | { |
237 | found_syllable!(SyllableType::ConsonantSyllable); |
238 | } |
239 | } |
240 | 7 => { |
241 | te = p; |
242 | p = p - 1; |
243 | { |
244 | found_syllable!(SyllableType::BrokenCluster); |
245 | } |
246 | } |
247 | 9 => { |
248 | te = p; |
249 | p = p - 1; |
250 | { |
251 | found_syllable!(SyllableType::NonMyanmarCluster); |
252 | } |
253 | } |
254 | |
255 | _ => {} |
256 | } |
257 | } |
258 | } |
259 | break '_again; |
260 | } |
261 | if (p == eof) { |
262 | { |
263 | if (cs >= 0) { |
264 | break '_resume; |
265 | } |
266 | } |
267 | } else { |
268 | { |
269 | match (_myanmar_syllable_machine_to_state_actions[(cs) as usize]) { |
270 | 1 => { |
271 | ts = 0; |
272 | } |
273 | |
274 | _ => {} |
275 | } |
276 | p += 1; |
277 | continue '_resume; |
278 | } |
279 | } |
280 | break '_resume; |
281 | } |
282 | } |
283 | } |
284 | |
285 | #[inline ] |
286 | fn found_syllable( |
287 | start: usize, |
288 | end: usize, |
289 | syllable_serial: &mut u8, |
290 | kind: SyllableType, |
291 | buffer: &mut Buffer, |
292 | ) { |
293 | for i: usize in start..end { |
294 | buffer.info[i].set_syllable((*syllable_serial << 4) | kind as u8); |
295 | } |
296 | |
297 | *syllable_serial += 1; |
298 | |
299 | if *syllable_serial == 16 { |
300 | *syllable_serial = 1; |
301 | } |
302 | } |
303 | |