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; 114] = [ |
23 | 0, 22, 1, 22, 3, 19, 3, 5, 3, 19, 1, 15, 3, 15, 3, 15, 1, 22, 1, 19, 1, 19, 1, 19, 1, 22, 0, 8, |
24 | 1, 22, 1, 22, 1, 19, 1, 19, 1, 19, 1, 20, 1, 19, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 19, 3, |
25 | 5, 3, 19, 1, 15, 3, 15, 3, 15, 1, 22, 1, 19, 1, 19, 1, 19, 1, 22, 0, 8, 1, 22, 1, 22, 1, 22, 1, |
26 | 19, 1, 19, 1, 19, 1, 20, 1, 19, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 0, 22, 0, 8, |
27 | 5, 5, 0, 0, |
28 | ]; |
29 | static _myanmar_syllable_machine_char_class: [i8; 35] = [ |
30 | 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, |
31 | 19, 20, 21, 7, 22, 0, 0, |
32 | ]; |
33 | static _myanmar_syllable_machine_index_offsets: [i16; 58] = [ |
34 | 0, 23, 45, 62, 65, 82, 97, 110, 123, 145, 164, 183, 202, 224, 233, 255, 277, 296, 315, 334, |
35 | 354, 373, 395, 417, 439, 461, 483, 500, 503, 520, 535, 548, 561, 583, 602, 621, 640, 662, 671, |
36 | 693, 715, 737, 756, 775, 794, 814, 833, 855, 877, 899, 921, 943, 965, 987, 1010, 1019, 0, 0, |
37 | ]; |
38 | static _myanmar_syllable_machine_indices: [i8; 1022] = [ |
39 | 2, 3, 4, 5, 1, 6, 7, 2, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, |
40 | 23, 27, 28, 23, 23, 29, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 23, 40, 26, 23, 27, 23, 23, |
41 | 23, 41, 23, 23, 23, 23, 23, 34, 23, 23, 23, 38, 26, 23, 27, 26, 23, 27, 23, 23, 23, 23, 23, 23, |
42 | 23, 23, 23, 34, 23, 23, 23, 38, 42, 23, 26, 23, 27, 34, 23, 23, 43, 23, 23, 23, 23, 23, 34, 26, |
43 | 23, 27, 23, 23, 23, 43, 23, 23, 23, 23, 23, 34, 26, 23, 27, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
44 | 34, 24, 23, 26, 23, 27, 28, 23, 23, 44, 23, 45, 23, 23, 23, 34, 46, 23, 23, 38, 23, 23, 44, 24, |
45 | 23, 26, 23, 27, 28, 23, 23, 23, 23, 23, 23, 23, 23, 34, 23, 23, 23, 38, 24, 23, 26, 23, 27, 28, |
46 | 23, 23, 44, 23, 23, 23, 23, 23, 34, 46, 23, 23, 38, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 23, |
47 | 23, 23, 23, 34, 46, 23, 23, 38, 24, 23, 26, 23, 27, 28, 23, 23, 44, 23, 23, 23, 23, 23, 34, 46, |
48 | 23, 23, 38, 23, 23, 44, 2, 23, 23, 23, 23, 23, 23, 23, 2, 24, 23, 26, 23, 27, 28, 23, 23, 29, |
49 | 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 23, 23, 40, 24, 23, 26, 23, 27, 28, 23, 23, 47, 23, 23, |
50 | 23, 23, 23, 34, 35, 36, 37, 38, 23, 23, 40, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 23, 23, 23, |
51 | 23, 34, 35, 36, 37, 38, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 23, 23, 23, 23, 34, 35, 36, 23, |
52 | 38, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 23, 23, 23, 23, 34, 23, 36, 23, 38, 24, 23, 26, 23, |
53 | 27, 28, 23, 23, 23, 23, 23, 23, 23, 23, 34, 35, 36, 37, 38, 47, 24, 23, 26, 23, 27, 28, 23, 23, |
54 | 47, 23, 23, 23, 23, 23, 34, 35, 36, 37, 38, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 30, 23, 32, |
55 | 23, 34, 35, 36, 37, 38, 23, 23, 40, 24, 23, 26, 23, 27, 28, 23, 23, 47, 23, 30, 23, 23, 23, 34, |
56 | 35, 36, 37, 38, 23, 23, 40, 24, 23, 26, 23, 27, 28, 23, 23, 48, 23, 30, 31, 32, 23, 34, 35, 36, |
57 | 37, 38, 23, 23, 40, 24, 23, 26, 23, 27, 28, 23, 23, 23, 23, 30, 31, 32, 23, 34, 35, 36, 37, 38, |
58 | 23, 23, 40, 24, 25, 26, 23, 27, 28, 23, 23, 29, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 23, 23, |
59 | 40, 50, 49, 6, 49, 49, 49, 51, 49, 49, 49, 49, 49, 15, 49, 49, 49, 19, 50, 49, 6, 50, 49, 6, |
60 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 15, 49, 49, 49, 19, 52, 49, 50, 49, 6, 15, 49, 49, 53, 49, |
61 | 49, 49, 49, 49, 15, 50, 49, 6, 49, 49, 49, 53, 49, 49, 49, 49, 49, 15, 50, 49, 6, 49, 49, 49, |
62 | 49, 49, 49, 49, 49, 49, 15, 3, 49, 50, 49, 6, 7, 49, 49, 54, 49, 55, 49, 49, 49, 15, 56, 49, |
63 | 49, 19, 49, 49, 54, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 49, 49, 49, 49, 15, 49, 49, 49, 19, 3, |
64 | 49, 50, 49, 6, 7, 49, 49, 54, 49, 49, 49, 49, 49, 15, 56, 49, 49, 19, 3, 49, 50, 49, 6, 7, 49, |
65 | 49, 49, 49, 49, 49, 49, 49, 15, 56, 49, 49, 19, 3, 49, 50, 49, 6, 7, 49, 49, 54, 49, 49, 49, |
66 | 49, 49, 15, 56, 49, 49, 19, 49, 49, 54, 57, 49, 49, 49, 49, 49, 49, 49, 57, 3, 4, 50, 49, 6, 7, |
67 | 49, 49, 9, 49, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 9, |
68 | 49, 11, 12, 13, 14, 15, 16, 17, 18, 19, 49, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 58, 49, 49, |
69 | 49, 49, 49, 15, 16, 17, 18, 19, 49, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 49, 49, 49, |
70 | 49, 15, 16, 17, 18, 19, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 49, 49, 49, 49, 15, 16, 17, 49, |
71 | 19, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 49, 49, 49, 49, 15, 49, 17, 49, 19, 3, 49, 50, 49, 6, |
72 | 7, 49, 49, 49, 49, 49, 49, 49, 49, 15, 16, 17, 18, 19, 58, 3, 49, 50, 49, 6, 7, 49, 49, 58, 49, |
73 | 49, 49, 49, 49, 15, 16, 17, 18, 19, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 11, 49, 13, 49, 15, |
74 | 16, 17, 18, 19, 49, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 58, 49, 11, 49, 49, 49, 15, 16, 17, |
75 | 18, 19, 49, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 59, 49, 11, 12, 13, 49, 15, 16, 17, 18, 19, |
76 | 49, 49, 22, 3, 49, 50, 49, 6, 7, 49, 49, 49, 49, 11, 12, 13, 49, 15, 16, 17, 18, 19, 49, 49, |
77 | 22, 3, 4, 50, 49, 6, 7, 49, 49, 9, 49, 11, 12, 13, 14, 15, 16, 17, 18, 19, 49, 49, 22, 24, 25, |
78 | 26, 23, 27, 28, 23, 23, 60, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 23, 40, 24, 61, 26, 23, |
79 | 27, 28, 23, 23, 29, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 23, 23, 40, 2, 3, 4, 50, 49, 6, 7, |
80 | 2, 2, 9, 49, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 49, 22, 2, 62, 62, 62, 62, 62, 62, 2, 2, |
81 | 63, 0, 0, |
82 | ]; |
83 | static _myanmar_syllable_machine_index_defaults: [i8; 58] = [ |
84 | 1, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
85 | 23, 23, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, |
86 | 49, 49, 49, 23, 23, 49, 62, 62, 0, 0, |
87 | ]; |
88 | static _myanmar_syllable_machine_cond_targs: [i8; 66] = [ |
89 | 0, 0, 1, 26, 37, 0, 27, 33, 51, 39, 54, 40, 46, 47, 48, 29, 42, 43, 44, 32, 50, 55, 45, 0, 2, |
90 | 13, 0, 3, 9, 14, 15, 21, 22, 23, 5, 17, 18, 19, 8, 25, 20, 4, 6, 7, 10, 12, 11, 16, 24, 0, 0, |
91 | 28, 30, 31, 34, 36, 35, 38, 41, 49, 52, 53, 0, 0, 0, 0, |
92 | ]; |
93 | static _myanmar_syllable_machine_cond_actions: [i8; 66] = [ |
94 | 0, 3, 0, 0, 0, 4, 0, 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, |
95 | 0, 0, 0, 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, 0, 9, |
96 | 10, 0, 0, |
97 | ]; |
98 | static _myanmar_syllable_machine_to_state_actions: [i8; 58] = [ |
99 | 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, |
100 | 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, |
101 | ]; |
102 | static _myanmar_syllable_machine_from_state_actions: [i8; 58] = [ |
103 | 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, |
104 | 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, |
105 | ]; |
106 | static _myanmar_syllable_machine_eof_trans: [i8; 58] = [ |
107 | 1, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, |
108 | 24, 24, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, |
109 | 50, 50, 50, 24, 24, 50, 63, 63, 0, 0, |
110 | ]; |
111 | static myanmar_syllable_machine_start: i32 = 0; |
112 | static myanmar_syllable_machine_first_final: i32 = 0; |
113 | static myanmar_syllable_machine_error: i32 = -1; |
114 | static myanmar_syllable_machine_en_main: i32 = 0; |
115 | #[derive (Clone, Copy)] |
116 | pub enum SyllableType { |
117 | ConsonantSyllable = 0, |
118 | PunctuationCluster, |
119 | BrokenCluster, |
120 | NonMyanmarCluster, |
121 | } |
122 | |
123 | pub fn find_syllables_myanmar(buffer: &mut Buffer) { |
124 | let mut cs = 0; |
125 | let mut ts = 0; |
126 | let mut te; |
127 | let mut p = 0; |
128 | let pe = buffer.len; |
129 | let eof = buffer.len; |
130 | let mut syllable_serial = 1u8; |
131 | |
132 | macro_rules! found_syllable { |
133 | ($kind:expr) => {{ |
134 | found_syllable(ts, te, &mut syllable_serial, $kind, buffer); |
135 | }}; |
136 | } |
137 | |
138 | { |
139 | cs = (myanmar_syllable_machine_start) as i32; |
140 | ts = 0; |
141 | te = 0; |
142 | } |
143 | |
144 | { |
145 | let mut _trans = 0; |
146 | let mut _keys: i32 = 0; |
147 | let mut _inds: i32 = 0; |
148 | let mut _ic = 0; |
149 | '_resume: while (p != pe || p == eof) { |
150 | '_again: while (true) { |
151 | match (_myanmar_syllable_machine_from_state_actions[(cs) as usize]) { |
152 | 2 => { |
153 | ts = p; |
154 | } |
155 | |
156 | _ => {} |
157 | } |
158 | if (p == eof) { |
159 | { |
160 | if (_myanmar_syllable_machine_eof_trans[(cs) as usize] > 0) { |
161 | { |
162 | _trans = |
163 | (_myanmar_syllable_machine_eof_trans[(cs) as usize]) as u32 - 1; |
164 | } |
165 | } |
166 | } |
167 | } else { |
168 | { |
169 | _keys = (cs << 1) as i32; |
170 | _inds = (_myanmar_syllable_machine_index_offsets[(cs) as usize]) as i32; |
171 | if ((buffer.info[p].indic_category() as u8) <= 33 |
172 | && (buffer.info[p].indic_category() as u8) >= 1) |
173 | { |
174 | { |
175 | _ic = (_myanmar_syllable_machine_char_class |
176 | [((buffer.info[p].indic_category() as u8) as i32 - 1) as usize]) |
177 | as i32; |
178 | if (_ic |
179 | <= (_myanmar_syllable_machine_trans_keys[(_keys + 1) as usize]) |
180 | as i32 |
181 | && _ic |
182 | >= (_myanmar_syllable_machine_trans_keys[(_keys) as usize]) |
183 | as i32) |
184 | { |
185 | _trans = (_myanmar_syllable_machine_indices[(_inds |
186 | + (_ic |
187 | - (_myanmar_syllable_machine_trans_keys |
188 | [(_keys) as usize]) |
189 | as i32) |
190 | as i32) |
191 | as usize]) |
192 | as u32; |
193 | } else { |
194 | _trans = (_myanmar_syllable_machine_index_defaults |
195 | [(cs) as usize]) |
196 | as u32; |
197 | } |
198 | } |
199 | } else { |
200 | { |
201 | _trans = (_myanmar_syllable_machine_index_defaults[(cs) as usize]) |
202 | as u32; |
203 | } |
204 | } |
205 | } |
206 | } |
207 | cs = (_myanmar_syllable_machine_cond_targs[(_trans) as usize]) as i32; |
208 | if (_myanmar_syllable_machine_cond_actions[(_trans) as usize] != 0) { |
209 | { |
210 | match (_myanmar_syllable_machine_cond_actions[(_trans) as usize]) { |
211 | 6 => { |
212 | te = p + 1; |
213 | { |
214 | found_syllable!(SyllableType::ConsonantSyllable); |
215 | } |
216 | } |
217 | 4 => { |
218 | te = p + 1; |
219 | { |
220 | found_syllable!(SyllableType::NonMyanmarCluster); |
221 | } |
222 | } |
223 | 10 => { |
224 | te = p + 1; |
225 | { |
226 | found_syllable!(SyllableType::PunctuationCluster); |
227 | } |
228 | } |
229 | 8 => { |
230 | te = p + 1; |
231 | { |
232 | found_syllable!(SyllableType::BrokenCluster); |
233 | } |
234 | } |
235 | 3 => { |
236 | te = p + 1; |
237 | { |
238 | found_syllable!(SyllableType::NonMyanmarCluster); |
239 | } |
240 | } |
241 | 5 => { |
242 | te = p; |
243 | p = p - 1; |
244 | { |
245 | found_syllable!(SyllableType::ConsonantSyllable); |
246 | } |
247 | } |
248 | 7 => { |
249 | te = p; |
250 | p = p - 1; |
251 | { |
252 | found_syllable!(SyllableType::BrokenCluster); |
253 | } |
254 | } |
255 | 9 => { |
256 | te = p; |
257 | p = p - 1; |
258 | { |
259 | found_syllable!(SyllableType::NonMyanmarCluster); |
260 | } |
261 | } |
262 | |
263 | _ => {} |
264 | } |
265 | } |
266 | } |
267 | break '_again; |
268 | } |
269 | if (p == eof) { |
270 | { |
271 | if (cs >= 0) { |
272 | break '_resume; |
273 | } |
274 | } |
275 | } else { |
276 | { |
277 | match (_myanmar_syllable_machine_to_state_actions[(cs) as usize]) { |
278 | 1 => { |
279 | ts = 0; |
280 | } |
281 | |
282 | _ => {} |
283 | } |
284 | p += 1; |
285 | continue '_resume; |
286 | } |
287 | } |
288 | break '_resume; |
289 | } |
290 | } |
291 | } |
292 | |
293 | #[inline ] |
294 | fn found_syllable( |
295 | start: usize, |
296 | end: usize, |
297 | syllable_serial: &mut u8, |
298 | kind: SyllableType, |
299 | buffer: &mut Buffer, |
300 | ) { |
301 | for i: usize in start..end { |
302 | buffer.info[i].set_syllable((*syllable_serial << 4) | kind as u8); |
303 | } |
304 | |
305 | *syllable_serial += 1; |
306 | |
307 | if *syllable_serial == 16 { |
308 | *syllable_serial = 1; |
309 | } |
310 | } |
311 | |