Line data Source code
1 : /* Generated from esperanto.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 :
3 : #include "stem_UTF_8_esperanto.h"
4 :
5 : #include <stddef.h>
6 :
7 : #include "snowball_runtime.h"
8 :
9 : #ifdef __cplusplus
10 : extern "C" {
11 : #endif
12 : extern int esperanto_UTF_8_stem(struct SN_env * z);
13 : #ifdef __cplusplus
14 : }
15 : #endif
16 :
17 : static int r_uninflected(struct SN_env * z);
18 : static int r_ujn_suffix(struct SN_env * z);
19 : static int r_standard_suffix(struct SN_env * z);
20 : static int r_pronoun(struct SN_env * z);
21 : static int r_merged_numeral(struct SN_env * z);
22 : static int r_long_word(struct SN_env * z);
23 : static int r_initial_apostrophe(struct SN_env * z);
24 : static int r_final_apostrophe(struct SN_env * z);
25 : static int r_correlative(struct SN_env * z);
26 : static int r_canonical_form(struct SN_env * z);
27 :
28 : static const symbol s_0[] = { 0xC4, 0x89 };
29 : static const symbol s_1[] = { 0xC4, 0x9D };
30 : static const symbol s_2[] = { 0xC4, 0xA5 };
31 : static const symbol s_3[] = { 0xC4, 0xB5 };
32 : static const symbol s_4[] = { 0xC5, 0x9D };
33 : static const symbol s_5[] = { 0xC5, 0xAD };
34 : static const symbol s_6[] = { 'a' };
35 : static const symbol s_7[] = { 'e' };
36 : static const symbol s_8[] = { 'i' };
37 : static const symbol s_9[] = { 'o' };
38 : static const symbol s_10[] = { 'u' };
39 : static const symbol s_11[] = { 's', 't' };
40 : static const symbol s_12[] = { 'e' };
41 : static const symbol s_13[] = { 'a' };
42 : static const symbol s_14[] = { 'u', 'n' };
43 : static const symbol s_15[] = { 'u' };
44 : static const symbol s_16[] = { 'a', 0xC5, 0xAD };
45 : static const symbol s_17[] = { 'o' };
46 :
47 : static const symbol s_0_1[1] = { '-' };
48 : static const symbol s_0_2[2] = { 'c', 'x' };
49 : static const symbol s_0_3[2] = { 'g', 'x' };
50 : static const symbol s_0_4[2] = { 'h', 'x' };
51 : static const symbol s_0_5[2] = { 'j', 'x' };
52 : static const symbol s_0_6[1] = { 'q' };
53 : static const symbol s_0_7[2] = { 's', 'x' };
54 : static const symbol s_0_8[2] = { 'u', 'x' };
55 : static const symbol s_0_9[1] = { 'w' };
56 : static const symbol s_0_10[1] = { 'x' };
57 : static const symbol s_0_11[1] = { 'y' };
58 : static const symbol s_0_12[2] = { 0xC3, 0xA1 };
59 : static const symbol s_0_13[2] = { 0xC3, 0xA9 };
60 : static const symbol s_0_14[2] = { 0xC3, 0xAD };
61 : static const symbol s_0_15[2] = { 0xC3, 0xB3 };
62 : static const symbol s_0_16[2] = { 0xC3, 0xBA };
63 : static const struct among a_0[17] = {
64 : { 0, 0, 0, 14, 0},
65 : { 1, s_0_1, -1, 13, 0},
66 : { 2, s_0_2, -2, 1, 0},
67 : { 2, s_0_3, -3, 2, 0},
68 : { 2, s_0_4, -4, 3, 0},
69 : { 2, s_0_5, -5, 4, 0},
70 : { 1, s_0_6, -6, 12, 0},
71 : { 2, s_0_7, -7, 5, 0},
72 : { 2, s_0_8, -8, 6, 0},
73 : { 1, s_0_9, -9, 12, 0},
74 : { 1, s_0_10, -10, 12, 0},
75 : { 1, s_0_11, -11, 12, 0},
76 : { 2, s_0_12, -12, 7, 0},
77 : { 2, s_0_13, -13, 8, 0},
78 : { 2, s_0_14, -14, 9, 0},
79 : { 2, s_0_15, -15, 10, 0},
80 : { 2, s_0_16, -16, 11, 0}
81 : };
82 :
83 : static const symbol s_1_0[2] = { 'a', 's' };
84 : static const symbol s_1_1[1] = { 'i' };
85 : static const symbol s_1_2[2] = { 'i', 's' };
86 : static const symbol s_1_3[2] = { 'o', 's' };
87 : static const symbol s_1_4[1] = { 'u' };
88 : static const symbol s_1_5[2] = { 'u', 's' };
89 : static const struct among a_1[6] = {
90 : { 2, s_1_0, 0, -1, 0},
91 : { 1, s_1_1, 0, -1, 0},
92 : { 2, s_1_2, -1, -1, 0},
93 : { 2, s_1_3, 0, -1, 0},
94 : { 1, s_1_4, 0, -1, 0},
95 : { 2, s_1_5, -1, -1, 0}
96 : };
97 :
98 : static const symbol s_2_0[2] = { 'c', 'i' };
99 : static const symbol s_2_1[2] = { 'g', 'i' };
100 : static const symbol s_2_2[2] = { 'h', 'i' };
101 : static const symbol s_2_3[2] = { 'l', 'i' };
102 : static const symbol s_2_4[3] = { 'i', 'l', 'i' };
103 : static const symbol s_2_5[4] = { 0xC5, 0x9D, 'l', 'i' };
104 : static const symbol s_2_6[2] = { 'm', 'i' };
105 : static const symbol s_2_7[2] = { 'n', 'i' };
106 : static const symbol s_2_8[3] = { 'o', 'n', 'i' };
107 : static const symbol s_2_9[2] = { 'r', 'i' };
108 : static const symbol s_2_10[2] = { 's', 'i' };
109 : static const symbol s_2_11[2] = { 'v', 'i' };
110 : static const symbol s_2_12[3] = { 'i', 'v', 'i' };
111 : static const symbol s_2_13[3] = { 0xC4, 0x9D, 'i' };
112 : static const symbol s_2_14[3] = { 0xC5, 0x9D, 'i' };
113 : static const symbol s_2_15[4] = { 'i', 0xC5, 0x9D, 'i' };
114 : static const symbol s_2_16[6] = { 'm', 'a', 'l', 0xC5, 0x9D, 'i' };
115 : static const struct among a_2[17] = {
116 : { 2, s_2_0, 0, -1, 0},
117 : { 2, s_2_1, 0, -1, 0},
118 : { 2, s_2_2, 0, -1, 0},
119 : { 2, s_2_3, 0, -1, 0},
120 : { 3, s_2_4, -1, -1, 0},
121 : { 4, s_2_5, -2, -1, 0},
122 : { 2, s_2_6, 0, -1, 0},
123 : { 2, s_2_7, 0, -1, 0},
124 : { 3, s_2_8, -1, -1, 0},
125 : { 2, s_2_9, 0, -1, 0},
126 : { 2, s_2_10, 0, -1, 0},
127 : { 2, s_2_11, 0, -1, 0},
128 : { 3, s_2_12, -1, -1, 0},
129 : { 3, s_2_13, 0, -1, 0},
130 : { 3, s_2_14, 0, -1, 0},
131 : { 4, s_2_15, -1, -1, 0},
132 : { 6, s_2_16, -2, -1, 0}
133 : };
134 :
135 : static const symbol s_3_0[3] = { 'a', 'm', 'b' };
136 : static const symbol s_3_1[4] = { 'b', 'a', 'l', 'd' };
137 : static const symbol s_3_2[7] = { 'm', 'a', 'l', 'b', 'a', 'l', 'd' };
138 : static const symbol s_3_3[4] = { 'm', 'o', 'r', 'g' };
139 : static const symbol s_3_4[8] = { 'p', 'o', 's', 't', 'm', 'o', 'r', 'g' };
140 : static const symbol s_3_5[3] = { 'a', 'd', 'i' };
141 : static const symbol s_3_6[4] = { 'h', 'o', 'd', 'i' };
142 : static const symbol s_3_7[3] = { 'a', 'n', 'k' };
143 : static const symbol s_3_8[5] = { 0xC4, 0x89, 'i', 'r', 'k' };
144 : static const symbol s_3_9[8] = { 't', 'u', 't', 0xC4, 0x89, 'i', 'r', 'k' };
145 : static const symbol s_3_10[5] = { 'p', 'r', 'e', 's', 'k' };
146 : static const symbol s_3_11[5] = { 'a', 'l', 'm', 'e', 'n' };
147 : static const symbol s_3_12[4] = { 'a', 'p', 'e', 'n' };
148 : static const symbol s_3_13[4] = { 'h', 'i', 'e', 'r' };
149 : static const symbol s_3_14[10] = { 'a', 'n', 't', 'a', 0xC5, 0xAD, 'h', 'i', 'e', 'r' };
150 : static const symbol s_3_15[5] = { 'm', 'a', 'l', 'g', 'r' };
151 : static const symbol s_3_16[5] = { 'a', 'n', 'k', 'o', 'r' };
152 : static const symbol s_3_17[5] = { 'k', 'o', 'n', 't', 'r' };
153 : static const symbol s_3_18[6] = { 'a', 'n', 's', 't', 'a', 't' };
154 : static const symbol s_3_19[4] = { 'k', 'v', 'a', 'z' };
155 : static const struct among a_3[20] = {
156 : { 3, s_3_0, 0, -1, 0},
157 : { 4, s_3_1, 0, -1, 0},
158 : { 7, s_3_2, -1, -1, 0},
159 : { 4, s_3_3, 0, -1, 0},
160 : { 8, s_3_4, -1, -1, 0},
161 : { 3, s_3_5, 0, -1, 0},
162 : { 4, s_3_6, 0, -1, 0},
163 : { 3, s_3_7, 0, -1, 0},
164 : { 5, s_3_8, 0, -1, 0},
165 : { 8, s_3_9, -1, -1, 0},
166 : { 5, s_3_10, 0, -1, 0},
167 : { 5, s_3_11, 0, -1, 0},
168 : { 4, s_3_12, 0, -1, 0},
169 : { 4, s_3_13, 0, -1, 0},
170 : { 10, s_3_14, -1, -1, 0},
171 : { 5, s_3_15, 0, -1, 0},
172 : { 5, s_3_16, 0, -1, 0},
173 : { 5, s_3_17, 0, -1, 0},
174 : { 6, s_3_18, 0, -1, 0},
175 : { 4, s_3_19, 0, -1, 0}
176 : };
177 :
178 : static const symbol s_4_0[4] = { 'a', 'l', 'i', 'u' };
179 : static const symbol s_4_1[3] = { 'u', 'n', 'u' };
180 : static const struct among a_4[2] = {
181 : { 4, s_4_0, 0, -1, 0},
182 : { 3, s_4_1, 0, -1, 0}
183 : };
184 :
185 : static const symbol s_5_0[3] = { 'a', 'h', 'a' };
186 : static const symbol s_5_1[4] = { 'h', 'a', 'h', 'a' };
187 : static const symbol s_5_2[8] = { 'h', 'a', 'l', 'e', 'l', 'u', 'j', 'a' };
188 : static const symbol s_5_3[4] = { 'h', 'o', 'l', 'a' };
189 : static const symbol s_5_4[6] = { 'h', 'o', 's', 'a', 'n', 'a' };
190 : static const symbol s_5_5[6] = { 'm', 'a', 'l', 't', 'r', 'a' };
191 : static const symbol s_5_6[4] = { 'h', 'u', 'r', 'a' };
192 : static const symbol s_5_7[6] = { 0xC4, 0xA5, 'a', 0xC4, 0xA5, 'a' };
193 : static const symbol s_5_8[4] = { 'e', 'k', 'd', 'e' };
194 : static const symbol s_5_9[4] = { 'e', 'l', 'd', 'e' };
195 : static const symbol s_5_10[5] = { 'd', 'i', 's', 'd', 'e' };
196 : static const symbol s_5_11[3] = { 'e', 'h', 'e' };
197 : static const symbol s_5_12[6] = { 'm', 'a', 'l', 't', 'r', 'e' };
198 : static const symbol s_5_13[9] = { 'd', 'i', 'r', 'l', 'i', 'd', 'i', 'd', 'i' };
199 : static const symbol s_5_14[6] = { 'm', 'a', 'l', 'p', 'l', 'i' };
200 : static const symbol s_5_15[6] = { 'm', 'a', 'l', 0xC4, 0x89, 'i' };
201 : static const symbol s_5_16[6] = { 'm', 'a', 'l', 'k', 'a', 'j' };
202 : static const symbol s_5_17[4] = { 'a', 'm', 'e', 'n' };
203 : static const symbol s_5_18[5] = { 't', 'a', 'm', 'e', 'n' };
204 : static const symbol s_5_19[3] = { 'o', 'h', 'o' };
205 : static const symbol s_5_20[6] = { 'm', 'a', 'l', 't', 'r', 'o' };
206 : static const symbol s_5_21[5] = { 'm', 'i', 'n', 'u', 's' };
207 : static const symbol s_5_22[3] = { 'u', 'h', 'u' };
208 : static const symbol s_5_23[3] = { 'm', 'u', 'u' };
209 : static const struct among a_5[24] = {
210 : { 3, s_5_0, 0, -1, 0},
211 : { 4, s_5_1, -1, -1, 0},
212 : { 8, s_5_2, 0, -1, 0},
213 : { 4, s_5_3, 0, -1, 0},
214 : { 6, s_5_4, 0, -1, 0},
215 : { 6, s_5_5, 0, -1, 0},
216 : { 4, s_5_6, 0, -1, 0},
217 : { 6, s_5_7, 0, -1, 0},
218 : { 4, s_5_8, 0, -1, 0},
219 : { 4, s_5_9, 0, -1, 0},
220 : { 5, s_5_10, 0, -1, 0},
221 : { 3, s_5_11, 0, -1, 0},
222 : { 6, s_5_12, 0, -1, 0},
223 : { 9, s_5_13, 0, -1, 0},
224 : { 6, s_5_14, 0, -1, 0},
225 : { 6, s_5_15, 0, -1, 0},
226 : { 6, s_5_16, 0, -1, 0},
227 : { 4, s_5_17, 0, -1, 0},
228 : { 5, s_5_18, -1, -1, 0},
229 : { 3, s_5_19, 0, -1, 0},
230 : { 6, s_5_20, 0, -1, 0},
231 : { 5, s_5_21, 0, -1, 0},
232 : { 3, s_5_22, 0, -1, 0},
233 : { 3, s_5_23, 0, -1, 0}
234 : };
235 :
236 : static const symbol s_6_0[3] = { 't', 'r', 'i' };
237 : static const symbol s_6_1[2] = { 'd', 'u' };
238 : static const symbol s_6_2[3] = { 'u', 'n', 'u' };
239 : static const struct among a_6[3] = {
240 : { 3, s_6_0, 0, -1, 0},
241 : { 2, s_6_1, 0, -1, 0},
242 : { 3, s_6_2, 0, -1, 0}
243 : };
244 :
245 : static const symbol s_7_0[3] = { 'd', 'e', 'k' };
246 : static const symbol s_7_1[4] = { 'c', 'e', 'n', 't' };
247 : static const struct among a_7[2] = {
248 : { 3, s_7_0, 0, -1, 0},
249 : { 4, s_7_1, 0, -1, 0}
250 : };
251 :
252 : static const symbol s_8_0[1] = { 'k' };
253 : static const symbol s_8_1[4] = { 'k', 'e', 'l', 'k' };
254 : static const symbol s_8_2[3] = { 'n', 'e', 'n' };
255 : static const symbol s_8_3[1] = { 't' };
256 : static const symbol s_8_4[4] = { 'm', 'u', 'l', 't' };
257 : static const symbol s_8_5[4] = { 's', 'a', 'm', 't' };
258 : static const symbol s_8_6[2] = { 0xC4, 0x89 };
259 : static const struct among a_8[7] = {
260 : { 1, s_8_0, 0, -1, 0},
261 : { 4, s_8_1, -1, -1, 0},
262 : { 3, s_8_2, 0, -1, 0},
263 : { 1, s_8_3, 0, -1, 0},
264 : { 4, s_8_4, -1, -1, 0},
265 : { 4, s_8_5, -2, -1, 0},
266 : { 2, s_8_6, 0, -1, 0}
267 : };
268 :
269 : static const symbol s_9_0[1] = { 'a' };
270 : static const symbol s_9_1[1] = { 'e' };
271 : static const symbol s_9_2[1] = { 'i' };
272 : static const symbol s_9_3[1] = { 'j' };
273 : static const symbol s_9_4[2] = { 'a', 'j' };
274 : static const symbol s_9_5[2] = { 'o', 'j' };
275 : static const symbol s_9_6[1] = { 'n' };
276 : static const symbol s_9_7[2] = { 'a', 'n' };
277 : static const symbol s_9_8[2] = { 'e', 'n' };
278 : static const symbol s_9_9[2] = { 'j', 'n' };
279 : static const symbol s_9_10[3] = { 'a', 'j', 'n' };
280 : static const symbol s_9_11[3] = { 'o', 'j', 'n' };
281 : static const symbol s_9_12[2] = { 'o', 'n' };
282 : static const symbol s_9_13[1] = { 'o' };
283 : static const symbol s_9_14[2] = { 'a', 's' };
284 : static const symbol s_9_15[2] = { 'i', 's' };
285 : static const symbol s_9_16[2] = { 'o', 's' };
286 : static const symbol s_9_17[2] = { 'u', 's' };
287 : static const symbol s_9_18[1] = { 'u' };
288 : static const struct among a_9[19] = {
289 : { 1, s_9_0, 0, -1, 0},
290 : { 1, s_9_1, 0, -1, 0},
291 : { 1, s_9_2, 0, -1, 0},
292 : { 1, s_9_3, 0, 1, 0},
293 : { 2, s_9_4, -1, -1, 0},
294 : { 2, s_9_5, -2, -1, 0},
295 : { 1, s_9_6, 0, 1, 0},
296 : { 2, s_9_7, -1, -1, 0},
297 : { 2, s_9_8, -2, -1, 0},
298 : { 2, s_9_9, -3, 1, 0},
299 : { 3, s_9_10, -1, -1, 0},
300 : { 3, s_9_11, -2, -1, 0},
301 : { 2, s_9_12, -6, -1, 0},
302 : { 1, s_9_13, 0, -1, 0},
303 : { 2, s_9_14, 0, -1, 0},
304 : { 2, s_9_15, 0, -1, 0},
305 : { 2, s_9_16, 0, -1, 0},
306 : { 2, s_9_17, 0, -1, 0},
307 : { 1, s_9_18, 0, -1, 0}
308 : };
309 :
310 : static const unsigned char g_vowel[] = { 17, 65, 16 };
311 :
312 : static const unsigned char g_aou[] = { 1, 64, 16 };
313 :
314 : static const unsigned char g_digit[] = { 255, 3 };
315 :
316 0 : static int r_canonical_form(struct SN_env * z) {
317 : int among_var;
318 : int b_foreign;
319 0 : b_foreign = 0;
320 0 : while (1) {
321 0 : int v_1 = z->c;
322 0 : z->bra = z->c;
323 0 : among_var = find_among(z, a_0, 17, 0);
324 0 : z->ket = z->c;
325 0 : switch (among_var) {
326 0 : case 1:
327 : {
328 0 : int ret = slice_from_s(z, 2, s_0);
329 0 : if (ret < 0) return ret;
330 : }
331 0 : break;
332 0 : case 2:
333 : {
334 0 : int ret = slice_from_s(z, 2, s_1);
335 0 : if (ret < 0) return ret;
336 : }
337 0 : break;
338 0 : case 3:
339 : {
340 0 : int ret = slice_from_s(z, 2, s_2);
341 0 : if (ret < 0) return ret;
342 : }
343 0 : break;
344 0 : case 4:
345 : {
346 0 : int ret = slice_from_s(z, 2, s_3);
347 0 : if (ret < 0) return ret;
348 : }
349 0 : break;
350 0 : case 5:
351 : {
352 0 : int ret = slice_from_s(z, 2, s_4);
353 0 : if (ret < 0) return ret;
354 : }
355 0 : break;
356 0 : case 6:
357 : {
358 0 : int ret = slice_from_s(z, 2, s_5);
359 0 : if (ret < 0) return ret;
360 : }
361 0 : break;
362 0 : case 7:
363 : {
364 0 : int ret = slice_from_s(z, 1, s_6);
365 0 : if (ret < 0) return ret;
366 : }
367 0 : b_foreign = 1;
368 0 : break;
369 0 : case 8:
370 : {
371 0 : int ret = slice_from_s(z, 1, s_7);
372 0 : if (ret < 0) return ret;
373 : }
374 0 : b_foreign = 1;
375 0 : break;
376 0 : case 9:
377 : {
378 0 : int ret = slice_from_s(z, 1, s_8);
379 0 : if (ret < 0) return ret;
380 : }
381 0 : b_foreign = 1;
382 0 : break;
383 0 : case 10:
384 : {
385 0 : int ret = slice_from_s(z, 1, s_9);
386 0 : if (ret < 0) return ret;
387 : }
388 0 : b_foreign = 1;
389 0 : break;
390 0 : case 11:
391 : {
392 0 : int ret = slice_from_s(z, 1, s_10);
393 0 : if (ret < 0) return ret;
394 : }
395 0 : b_foreign = 1;
396 0 : break;
397 0 : case 12:
398 0 : b_foreign = 1;
399 0 : break;
400 0 : case 13:
401 0 : b_foreign = 0;
402 0 : break;
403 0 : case 14:
404 : {
405 0 : int ret = skip_utf8(z->p, z->c, z->l, 1);
406 0 : if (ret < 0) goto lab0;
407 0 : z->c = ret;
408 : }
409 0 : break;
410 : }
411 0 : continue;
412 0 : lab0:
413 0 : z->c = v_1;
414 0 : break;
415 : }
416 0 : return !b_foreign;
417 : }
418 :
419 0 : static int r_initial_apostrophe(struct SN_env * z) {
420 0 : z->bra = z->c;
421 0 : if (z->c == z->l || z->p[z->c] != '\'') return 0;
422 0 : z->c++;
423 0 : z->ket = z->c;
424 0 : if (!(eq_s(z, 2, s_11))) return 0;
425 0 : if (z->c >= z->l || z->p[z->c + 0] >> 5 != 3 || !((2130434 >> (z->p[z->c + 0] & 0x1f)) & 1)) return 0;
426 0 : if (!find_among(z, a_1, 6, 0)) return 0;
427 0 : if (z->c < z->l) return 0;
428 : {
429 0 : int ret = slice_from_s(z, 1, s_12);
430 0 : if (ret < 0) return ret;
431 : }
432 0 : return 1;
433 : }
434 :
435 0 : static int r_pronoun(struct SN_env * z) {
436 0 : z->ket = z->c;
437 : {
438 0 : int v_1 = z->l - z->c;
439 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_1; goto lab0; }
440 0 : z->c--;
441 0 : lab0:
442 : ;
443 : }
444 0 : z->bra = z->c;
445 0 : if (z->c - 1 <= z->lb || z->p[z->c - 1] != 105) return 0;
446 0 : if (!find_among_b(z, a_2, 17, 0)) return 0;
447 : do {
448 0 : int v_2 = z->l - z->c;
449 0 : if (z->c > z->lb) goto lab1;
450 0 : break;
451 0 : lab1:
452 0 : z->c = z->l - v_2;
453 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0;
454 0 : z->c--;
455 : } while (0);
456 : {
457 0 : int ret = slice_del(z);
458 0 : if (ret < 0) return ret;
459 : }
460 0 : return 1;
461 : }
462 :
463 0 : static int r_final_apostrophe(struct SN_env * z) {
464 0 : z->ket = z->c;
465 0 : if (z->c <= z->lb || z->p[z->c - 1] != '\'') return 0;
466 0 : z->c--;
467 0 : z->bra = z->c;
468 : do {
469 0 : int v_1 = z->l - z->c;
470 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'l') goto lab0;
471 0 : z->c--;
472 0 : if (z->c > z->lb) goto lab0;
473 : {
474 0 : int ret = slice_from_s(z, 1, s_13);
475 0 : if (ret < 0) return ret;
476 : }
477 0 : break;
478 0 : lab0:
479 0 : z->c = z->l - v_1;
480 0 : if (!(eq_s_b(z, 2, s_14))) goto lab1;
481 0 : if (z->c > z->lb) goto lab1;
482 : {
483 0 : int ret = slice_from_s(z, 1, s_15);
484 0 : if (ret < 0) return ret;
485 : }
486 0 : break;
487 0 : lab1:
488 0 : z->c = z->l - v_1;
489 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68438676 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab2;
490 0 : if (!find_among_b(z, a_3, 20, 0)) goto lab2;
491 : do {
492 0 : int v_2 = z->l - z->c;
493 0 : if (z->c > z->lb) goto lab3;
494 0 : break;
495 0 : lab3:
496 0 : z->c = z->l - v_2;
497 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab2;
498 0 : z->c--;
499 : } while (0);
500 : {
501 0 : int ret = slice_from_s(z, 3, s_16);
502 0 : if (ret < 0) return ret;
503 : }
504 0 : break;
505 0 : lab2:
506 0 : z->c = z->l - v_1;
507 : {
508 0 : int ret = slice_from_s(z, 1, s_17);
509 0 : if (ret < 0) return ret;
510 : }
511 : } while (0);
512 0 : return 1;
513 : }
514 :
515 0 : static int r_ujn_suffix(struct SN_env * z) {
516 0 : z->ket = z->c;
517 : {
518 0 : int v_1 = z->l - z->c;
519 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_1; goto lab0; }
520 0 : z->c--;
521 0 : lab0:
522 : ;
523 : }
524 : {
525 0 : int v_2 = z->l - z->c;
526 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'j') { z->c = z->l - v_2; goto lab1; }
527 0 : z->c--;
528 0 : lab1:
529 : ;
530 : }
531 0 : z->bra = z->c;
532 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] != 117) return 0;
533 0 : if (!find_among_b(z, a_4, 2, 0)) return 0;
534 : do {
535 0 : int v_3 = z->l - z->c;
536 0 : if (z->c > z->lb) goto lab2;
537 0 : break;
538 0 : lab2:
539 0 : z->c = z->l - v_3;
540 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0;
541 0 : z->c--;
542 : } while (0);
543 : {
544 0 : int ret = slice_del(z);
545 0 : if (ret < 0) return ret;
546 : }
547 0 : return 1;
548 : }
549 :
550 0 : static int r_uninflected(struct SN_env * z) {
551 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2672162 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
552 0 : if (!find_among_b(z, a_5, 24, 0)) return 0;
553 : do {
554 0 : int v_1 = z->l - z->c;
555 0 : if (z->c > z->lb) goto lab0;
556 0 : break;
557 0 : lab0:
558 0 : z->c = z->l - v_1;
559 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0;
560 0 : z->c--;
561 : } while (0);
562 0 : return 1;
563 : }
564 :
565 0 : static int r_merged_numeral(struct SN_env * z) {
566 0 : if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 117)) return 0;
567 0 : if (!find_among_b(z, a_6, 3, 0)) return 0;
568 0 : if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 107 && z->p[z->c - 1] != 116)) return 0;
569 0 : return find_among_b(z, a_7, 2, 0) != 0;
570 : }
571 :
572 0 : static int r_correlative(struct SN_env * z) {
573 0 : z->ket = z->c;
574 0 : z->bra = z->c;
575 : {
576 0 : int v_1 = z->l - z->c;
577 : do {
578 0 : int v_2 = z->l - z->c;
579 : {
580 0 : int v_3 = z->l - z->c;
581 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_3; goto lab1; }
582 0 : z->c--;
583 0 : lab1:
584 : ;
585 : }
586 0 : z->bra = z->c;
587 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab0;
588 0 : z->c--;
589 0 : break;
590 0 : lab0:
591 0 : z->c = z->l - v_2;
592 : {
593 0 : int v_4 = z->l - z->c;
594 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'n') { z->c = z->l - v_4; goto lab2; }
595 0 : z->c--;
596 0 : lab2:
597 : ;
598 : }
599 : {
600 0 : int v_5 = z->l - z->c;
601 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'j') { z->c = z->l - v_5; goto lab3; }
602 0 : z->c--;
603 0 : lab3:
604 : ;
605 : }
606 0 : z->bra = z->c;
607 0 : if (in_grouping_b_U(z, g_aou, 97, 117, 0)) return 0;
608 : } while (0);
609 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0;
610 0 : z->c--;
611 : {
612 0 : int v_6 = z->l - z->c;
613 0 : if (!find_among_b(z, a_8, 7, 0)) { z->c = z->l - v_6; goto lab4; }
614 0 : lab4:
615 : ;
616 : }
617 : do {
618 0 : int v_7 = z->l - z->c;
619 0 : if (z->c > z->lb) goto lab5;
620 0 : break;
621 0 : lab5:
622 0 : z->c = z->l - v_7;
623 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') return 0;
624 0 : z->c--;
625 : } while (0);
626 0 : z->c = z->l - v_1;
627 : }
628 : {
629 0 : int ret = slice_del(z);
630 0 : if (ret < 0) return ret;
631 : }
632 0 : return 1;
633 : }
634 :
635 0 : static int r_long_word(struct SN_env * z) {
636 : do {
637 0 : int v_1 = z->l - z->c;
638 : {
639 0 : int i; for (i = 2; i > 0; i--) {
640 : {
641 0 : int ret = out_grouping_b_U(z, g_vowel, 97, 117, 1);
642 0 : if (ret < 0) goto lab0;
643 0 : z->c -= ret;
644 : }
645 : }
646 : }
647 0 : break;
648 0 : lab0:
649 0 : z->c = z->l - v_1;
650 : while (1) {
651 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab2;
652 0 : z->c--;
653 0 : break;
654 0 : lab2:
655 : {
656 0 : int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
657 0 : if (ret < 0) goto lab1;
658 0 : z->c = ret;
659 : }
660 : }
661 : {
662 0 : int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
663 0 : if (ret < 0) goto lab1;
664 0 : z->c = ret;
665 : }
666 0 : break;
667 0 : lab1:
668 0 : z->c = z->l - v_1;
669 : {
670 0 : int ret = out_grouping_b_U(z, g_digit, 48, 57, 1);
671 0 : if (ret < 0) return 0;
672 0 : z->c -= ret;
673 : }
674 : } while (0);
675 0 : return 1;
676 : }
677 :
678 0 : static int r_standard_suffix(struct SN_env * z) {
679 : int among_var;
680 0 : z->ket = z->c;
681 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2672162 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
682 0 : among_var = find_among_b(z, a_9, 19, 0);
683 0 : if (!among_var) return 0;
684 0 : switch (among_var) {
685 0 : case 1:
686 : {
687 0 : int v_1 = z->l - z->c;
688 : do {
689 0 : int v_2 = z->l - z->c;
690 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') goto lab0;
691 0 : z->c--;
692 0 : break;
693 0 : lab0:
694 0 : z->c = z->l - v_2;
695 0 : if (in_grouping_b_U(z, g_digit, 48, 57, 0)) return 0;
696 : } while (0);
697 0 : z->c = z->l - v_1;
698 : }
699 0 : break;
700 : }
701 : {
702 0 : int v_3 = z->l - z->c;
703 0 : if (z->c <= z->lb || z->p[z->c - 1] != '-') { z->c = z->l - v_3; goto lab1; }
704 0 : z->c--;
705 0 : lab1:
706 : ;
707 : }
708 0 : z->bra = z->c;
709 : {
710 0 : int ret = slice_del(z);
711 0 : if (ret < 0) return ret;
712 : }
713 0 : return 1;
714 : }
715 :
716 0 : extern int esperanto_UTF_8_stem(struct SN_env * z) {
717 : {
718 0 : int v_1 = z->c;
719 : {
720 0 : int ret = r_canonical_form(z);
721 0 : if (ret <= 0) return ret;
722 : }
723 0 : z->c = v_1;
724 : }
725 : {
726 0 : int v_2 = z->c;
727 : {
728 0 : int ret = r_initial_apostrophe(z);
729 0 : if (ret < 0) return ret;
730 : }
731 0 : z->c = v_2;
732 : }
733 0 : z->lb = z->c; z->c = z->l;
734 : {
735 0 : int v_3 = z->l - z->c;
736 : {
737 0 : int ret = r_pronoun(z);
738 0 : if (ret == 0) goto lab0;
739 0 : if (ret < 0) return ret;
740 : }
741 0 : return 0;
742 0 : lab0:
743 0 : z->c = z->l - v_3;
744 : }
745 : {
746 0 : int v_4 = z->l - z->c;
747 : {
748 0 : int ret = r_final_apostrophe(z);
749 0 : if (ret < 0) return ret;
750 : }
751 0 : z->c = z->l - v_4;
752 : }
753 : {
754 0 : int v_5 = z->l - z->c;
755 : {
756 0 : int ret = r_correlative(z);
757 0 : if (ret == 0) goto lab1;
758 0 : if (ret < 0) return ret;
759 : }
760 0 : return 0;
761 0 : lab1:
762 0 : z->c = z->l - v_5;
763 : }
764 : {
765 0 : int v_6 = z->l - z->c;
766 : {
767 0 : int ret = r_uninflected(z);
768 0 : if (ret == 0) goto lab2;
769 0 : if (ret < 0) return ret;
770 : }
771 0 : return 0;
772 0 : lab2:
773 0 : z->c = z->l - v_6;
774 : }
775 : {
776 0 : int v_7 = z->l - z->c;
777 : {
778 0 : int ret = r_merged_numeral(z);
779 0 : if (ret == 0) goto lab3;
780 0 : if (ret < 0) return ret;
781 : }
782 0 : return 0;
783 0 : lab3:
784 0 : z->c = z->l - v_7;
785 : }
786 : {
787 0 : int v_8 = z->l - z->c;
788 : {
789 0 : int ret = r_ujn_suffix(z);
790 0 : if (ret == 0) goto lab4;
791 0 : if (ret < 0) return ret;
792 : }
793 0 : return 0;
794 0 : lab4:
795 0 : z->c = z->l - v_8;
796 : }
797 : {
798 0 : int v_9 = z->l - z->c;
799 : {
800 0 : int ret = r_long_word(z);
801 0 : if (ret <= 0) return ret;
802 : }
803 0 : z->c = z->l - v_9;
804 : }
805 : {
806 0 : int ret = r_standard_suffix(z);
807 0 : if (ret <= 0) return ret;
808 : }
809 0 : z->c = z->lb;
810 0 : return 1;
811 : }
812 :
813 0 : extern struct SN_env * esperanto_UTF_8_create_env(void) {
814 0 : return SN_new_env(sizeof(struct SN_env));
815 : }
816 :
817 0 : extern void esperanto_UTF_8_close_env(struct SN_env * z) {
818 0 : SN_delete_env(z);
819 0 : }
820 :
|