Line data Source code
1 : /* Generated from finnish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 :
3 : #include "stem_UTF_8_finnish.h"
4 :
5 : #include <stddef.h>
6 :
7 : #include "snowball_runtime.h"
8 :
9 : struct SN_local {
10 : struct SN_env z;
11 : int i_p2;
12 : int i_p1;
13 : unsigned char b_ending_removed;
14 : symbol * s_x;
15 : };
16 :
17 : typedef struct SN_local SN_local;
18 :
19 : #ifdef __cplusplus
20 : extern "C" {
21 : #endif
22 : extern int finnish_UTF_8_stem(struct SN_env * z);
23 : #ifdef __cplusplus
24 : }
25 : #endif
26 :
27 : static int r_tidy(struct SN_env * z);
28 : static int r_other_endings(struct SN_env * z);
29 : static int r_t_plural(struct SN_env * z);
30 : static int r_i_plural(struct SN_env * z);
31 : static int r_case_ending(struct SN_env * z);
32 : static int r_VI(struct SN_env * z);
33 : static int r_LONG(struct SN_env * z);
34 : static int r_possessive(struct SN_env * z);
35 : static int r_particle_etc(struct SN_env * z);
36 : static int r_R2(struct SN_env * z);
37 : static int r_mark_regions(struct SN_env * z);
38 :
39 : static const symbol s_0[] = { 'k', 's', 'e' };
40 : static const symbol s_1[] = { 'k', 's', 'i' };
41 : static const symbol s_2[] = { 0xC3, 0xA4 };
42 : static const symbol s_3[] = { 0xC3, 0xB6 };
43 : static const symbol s_4[] = { 'i', 'e' };
44 : static const symbol s_5[] = { 'p', 'o' };
45 : static const symbol s_6[] = { 'p', 'o' };
46 :
47 : static const symbol s_0_0[2] = { 'p', 'a' };
48 : static const symbol s_0_1[3] = { 's', 't', 'i' };
49 : static const symbol s_0_2[4] = { 'k', 'a', 'a', 'n' };
50 : static const symbol s_0_3[3] = { 'h', 'a', 'n' };
51 : static const symbol s_0_4[3] = { 'k', 'i', 'n' };
52 : static const symbol s_0_5[4] = { 'h', 0xC3, 0xA4, 'n' };
53 : static const symbol s_0_6[6] = { 'k', 0xC3, 0xA4, 0xC3, 0xA4, 'n' };
54 : static const symbol s_0_7[2] = { 'k', 'o' };
55 : static const symbol s_0_8[3] = { 'p', 0xC3, 0xA4 };
56 : static const symbol s_0_9[3] = { 'k', 0xC3, 0xB6 };
57 : static const struct among a_0[10] = {
58 : { 2, s_0_0, 0, 1, 0},
59 : { 3, s_0_1, 0, 2, 0},
60 : { 4, s_0_2, 0, 1, 0},
61 : { 3, s_0_3, 0, 1, 0},
62 : { 3, s_0_4, 0, 1, 0},
63 : { 4, s_0_5, 0, 1, 0},
64 : { 6, s_0_6, 0, 1, 0},
65 : { 2, s_0_7, 0, 1, 0},
66 : { 3, s_0_8, 0, 1, 0},
67 : { 3, s_0_9, 0, 1, 0}
68 : };
69 :
70 : static const symbol s_1_0[3] = { 'l', 'l', 'a' };
71 : static const symbol s_1_1[2] = { 'n', 'a' };
72 : static const symbol s_1_2[3] = { 's', 's', 'a' };
73 : static const symbol s_1_3[2] = { 't', 'a' };
74 : static const symbol s_1_4[3] = { 'l', 't', 'a' };
75 : static const symbol s_1_5[3] = { 's', 't', 'a' };
76 : static const struct among a_1[6] = {
77 : { 3, s_1_0, 0, -1, 0},
78 : { 2, s_1_1, 0, -1, 0},
79 : { 3, s_1_2, 0, -1, 0},
80 : { 2, s_1_3, 0, -1, 0},
81 : { 3, s_1_4, -1, -1, 0},
82 : { 3, s_1_5, -2, -1, 0}
83 : };
84 :
85 : static const symbol s_2_0[4] = { 'l', 'l', 0xC3, 0xA4 };
86 : static const symbol s_2_1[3] = { 'n', 0xC3, 0xA4 };
87 : static const symbol s_2_2[4] = { 's', 's', 0xC3, 0xA4 };
88 : static const symbol s_2_3[3] = { 't', 0xC3, 0xA4 };
89 : static const symbol s_2_4[4] = { 'l', 't', 0xC3, 0xA4 };
90 : static const symbol s_2_5[4] = { 's', 't', 0xC3, 0xA4 };
91 : static const struct among a_2[6] = {
92 : { 4, s_2_0, 0, -1, 0},
93 : { 3, s_2_1, 0, -1, 0},
94 : { 4, s_2_2, 0, -1, 0},
95 : { 3, s_2_3, 0, -1, 0},
96 : { 4, s_2_4, -1, -1, 0},
97 : { 4, s_2_5, -2, -1, 0}
98 : };
99 :
100 : static const symbol s_3_0[3] = { 'l', 'l', 'e' };
101 : static const symbol s_3_1[3] = { 'i', 'n', 'e' };
102 : static const struct among a_3[2] = {
103 : { 3, s_3_0, 0, -1, 0},
104 : { 3, s_3_1, 0, -1, 0}
105 : };
106 :
107 : static const symbol s_4_0[3] = { 'n', 's', 'a' };
108 : static const symbol s_4_1[3] = { 'm', 'm', 'e' };
109 : static const symbol s_4_2[3] = { 'n', 'n', 'e' };
110 : static const symbol s_4_3[2] = { 'n', 'i' };
111 : static const symbol s_4_4[2] = { 's', 'i' };
112 : static const symbol s_4_5[2] = { 'a', 'n' };
113 : static const symbol s_4_6[2] = { 'e', 'n' };
114 : static const symbol s_4_7[3] = { 0xC3, 0xA4, 'n' };
115 : static const symbol s_4_8[4] = { 'n', 's', 0xC3, 0xA4 };
116 : static const struct among a_4[9] = {
117 : { 3, s_4_0, 0, 3, 0},
118 : { 3, s_4_1, 0, 3, 0},
119 : { 3, s_4_2, 0, 3, 0},
120 : { 2, s_4_3, 0, 2, 0},
121 : { 2, s_4_4, 0, 1, 0},
122 : { 2, s_4_5, 0, 4, 0},
123 : { 2, s_4_6, 0, 6, 0},
124 : { 3, s_4_7, 0, 5, 0},
125 : { 4, s_4_8, 0, 3, 0}
126 : };
127 :
128 : static const symbol s_5_0[2] = { 'a', 'a' };
129 : static const symbol s_5_1[2] = { 'e', 'e' };
130 : static const symbol s_5_2[2] = { 'i', 'i' };
131 : static const symbol s_5_3[2] = { 'o', 'o' };
132 : static const symbol s_5_4[2] = { 'u', 'u' };
133 : static const symbol s_5_5[4] = { 0xC3, 0xA4, 0xC3, 0xA4 };
134 : static const symbol s_5_6[4] = { 0xC3, 0xB6, 0xC3, 0xB6 };
135 : static const struct among a_5[7] = {
136 : { 2, s_5_0, 0, -1, 0},
137 : { 2, s_5_1, 0, -1, 0},
138 : { 2, s_5_2, 0, -1, 0},
139 : { 2, s_5_3, 0, -1, 0},
140 : { 2, s_5_4, 0, -1, 0},
141 : { 4, s_5_5, 0, -1, 0},
142 : { 4, s_5_6, 0, -1, 0}
143 : };
144 :
145 : static const symbol s_6_0[1] = { 'a' };
146 : static const symbol s_6_1[3] = { 'l', 'l', 'a' };
147 : static const symbol s_6_2[2] = { 'n', 'a' };
148 : static const symbol s_6_3[3] = { 's', 's', 'a' };
149 : static const symbol s_6_4[2] = { 't', 'a' };
150 : static const symbol s_6_5[3] = { 'l', 't', 'a' };
151 : static const symbol s_6_6[3] = { 's', 't', 'a' };
152 : static const symbol s_6_7[3] = { 't', 't', 'a' };
153 : static const symbol s_6_8[3] = { 'l', 'l', 'e' };
154 : static const symbol s_6_9[3] = { 'i', 'n', 'e' };
155 : static const symbol s_6_10[3] = { 'k', 's', 'i' };
156 : static const symbol s_6_11[1] = { 'n' };
157 : static const symbol s_6_12[3] = { 'h', 'a', 'n' };
158 : static const symbol s_6_13[3] = { 'd', 'e', 'n' };
159 : static const symbol s_6_14[4] = { 's', 'e', 'e', 'n' };
160 : static const symbol s_6_15[3] = { 'h', 'e', 'n' };
161 : static const symbol s_6_16[4] = { 't', 't', 'e', 'n' };
162 : static const symbol s_6_17[3] = { 'h', 'i', 'n' };
163 : static const symbol s_6_18[4] = { 's', 'i', 'i', 'n' };
164 : static const symbol s_6_19[3] = { 'h', 'o', 'n' };
165 : static const symbol s_6_20[4] = { 'h', 0xC3, 0xA4, 'n' };
166 : static const symbol s_6_21[4] = { 'h', 0xC3, 0xB6, 'n' };
167 : static const symbol s_6_22[2] = { 0xC3, 0xA4 };
168 : static const symbol s_6_23[4] = { 'l', 'l', 0xC3, 0xA4 };
169 : static const symbol s_6_24[3] = { 'n', 0xC3, 0xA4 };
170 : static const symbol s_6_25[4] = { 's', 's', 0xC3, 0xA4 };
171 : static const symbol s_6_26[3] = { 't', 0xC3, 0xA4 };
172 : static const symbol s_6_27[4] = { 'l', 't', 0xC3, 0xA4 };
173 : static const symbol s_6_28[4] = { 's', 't', 0xC3, 0xA4 };
174 : static const symbol s_6_29[4] = { 't', 't', 0xC3, 0xA4 };
175 : static const struct among a_6[30] = {
176 : { 1, s_6_0, 0, 8, 0},
177 : { 3, s_6_1, -1, -1, 0},
178 : { 2, s_6_2, -2, -1, 0},
179 : { 3, s_6_3, -3, -1, 0},
180 : { 2, s_6_4, -4, -1, 0},
181 : { 3, s_6_5, -1, -1, 0},
182 : { 3, s_6_6, -2, -1, 0},
183 : { 3, s_6_7, -3, 2, 0},
184 : { 3, s_6_8, 0, -1, 0},
185 : { 3, s_6_9, 0, -1, 0},
186 : { 3, s_6_10, 0, -1, 0},
187 : { 1, s_6_11, 0, 7, 0},
188 : { 3, s_6_12, -1, 1, 0},
189 : { 3, s_6_13, -2, -1, 1},
190 : { 4, s_6_14, -3, -1, 2},
191 : { 3, s_6_15, -4, 2, 0},
192 : { 4, s_6_16, -5, -1, 1},
193 : { 3, s_6_17, -6, 3, 0},
194 : { 4, s_6_18, -7, -1, 1},
195 : { 3, s_6_19, -8, 4, 0},
196 : { 4, s_6_20, -9, 5, 0},
197 : { 4, s_6_21, -10, 6, 0},
198 : { 2, s_6_22, 0, 8, 0},
199 : { 4, s_6_23, -1, -1, 0},
200 : { 3, s_6_24, -2, -1, 0},
201 : { 4, s_6_25, -3, -1, 0},
202 : { 3, s_6_26, -4, -1, 0},
203 : { 4, s_6_27, -1, -1, 0},
204 : { 4, s_6_28, -2, -1, 0},
205 : { 4, s_6_29, -3, 2, 0}
206 : };
207 :
208 0 : static int af_6(struct SN_env * z) {
209 0 : switch (z->af) {
210 0 : case 1: return r_VI(z);
211 0 : case 2: return r_LONG(z);
212 : }
213 0 : return -1;
214 : }
215 :
216 : static const symbol s_7_0[3] = { 'e', 'j', 'a' };
217 : static const symbol s_7_1[3] = { 'm', 'm', 'a' };
218 : static const symbol s_7_2[4] = { 'i', 'm', 'm', 'a' };
219 : static const symbol s_7_3[3] = { 'm', 'p', 'a' };
220 : static const symbol s_7_4[4] = { 'i', 'm', 'p', 'a' };
221 : static const symbol s_7_5[3] = { 'm', 'm', 'i' };
222 : static const symbol s_7_6[4] = { 'i', 'm', 'm', 'i' };
223 : static const symbol s_7_7[3] = { 'm', 'p', 'i' };
224 : static const symbol s_7_8[4] = { 'i', 'm', 'p', 'i' };
225 : static const symbol s_7_9[4] = { 'e', 'j', 0xC3, 0xA4 };
226 : static const symbol s_7_10[4] = { 'm', 'm', 0xC3, 0xA4 };
227 : static const symbol s_7_11[5] = { 'i', 'm', 'm', 0xC3, 0xA4 };
228 : static const symbol s_7_12[4] = { 'm', 'p', 0xC3, 0xA4 };
229 : static const symbol s_7_13[5] = { 'i', 'm', 'p', 0xC3, 0xA4 };
230 : static const struct among a_7[14] = {
231 : { 3, s_7_0, 0, -1, 0},
232 : { 3, s_7_1, 0, 1, 0},
233 : { 4, s_7_2, -1, -1, 0},
234 : { 3, s_7_3, 0, 1, 0},
235 : { 4, s_7_4, -1, -1, 0},
236 : { 3, s_7_5, 0, 1, 0},
237 : { 4, s_7_6, -1, -1, 0},
238 : { 3, s_7_7, 0, 1, 0},
239 : { 4, s_7_8, -1, -1, 0},
240 : { 4, s_7_9, 0, -1, 0},
241 : { 4, s_7_10, 0, 1, 0},
242 : { 5, s_7_11, -1, -1, 0},
243 : { 4, s_7_12, 0, 1, 0},
244 : { 5, s_7_13, -1, -1, 0}
245 : };
246 :
247 : static const symbol s_9_0[3] = { 'm', 'm', 'a' };
248 : static const symbol s_9_1[4] = { 'i', 'm', 'm', 'a' };
249 : static const struct among a_9[2] = {
250 : { 3, s_9_0, 0, 1, 0},
251 : { 4, s_9_1, -1, -1, 0}
252 : };
253 :
254 : static const unsigned char g_AEI[] = { 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 };
255 :
256 : static const unsigned char g_C[] = { 119, 223, 119, 1 };
257 :
258 : static const unsigned char g_V1[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
259 :
260 : static const unsigned char g_V2[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
261 :
262 : static const unsigned char g_particle_end[] = { 17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
263 :
264 0 : static int r_mark_regions(struct SN_env * z) {
265 0 : ((SN_local *)z)->i_p1 = z->l;
266 0 : ((SN_local *)z)->i_p2 = z->l;
267 : {
268 0 : int ret = out_grouping_U(z, g_V1, 97, 246, 1);
269 0 : if (ret < 0) return 0;
270 0 : z->c += ret;
271 : }
272 : {
273 0 : int ret = in_grouping_U(z, g_V1, 97, 246, 1);
274 0 : if (ret < 0) return 0;
275 0 : z->c += ret;
276 : }
277 0 : ((SN_local *)z)->i_p1 = z->c;
278 : {
279 0 : int ret = out_grouping_U(z, g_V1, 97, 246, 1);
280 0 : if (ret < 0) return 0;
281 0 : z->c += ret;
282 : }
283 : {
284 0 : int ret = in_grouping_U(z, g_V1, 97, 246, 1);
285 0 : if (ret < 0) return 0;
286 0 : z->c += ret;
287 : }
288 0 : ((SN_local *)z)->i_p2 = z->c;
289 0 : return 1;
290 : }
291 :
292 0 : static int r_R2(struct SN_env * z) {
293 0 : return ((SN_local *)z)->i_p2 <= z->c;
294 : }
295 :
296 0 : static int r_particle_etc(struct SN_env * z) {
297 : int among_var;
298 : {
299 : int v_1;
300 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
301 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
302 0 : z->ket = z->c;
303 0 : among_var = find_among_b(z, a_0, 10, 0);
304 0 : if (!among_var) { z->lb = v_1; return 0; }
305 0 : z->bra = z->c;
306 0 : z->lb = v_1;
307 : }
308 0 : switch (among_var) {
309 0 : case 1:
310 0 : if (in_grouping_b_U(z, g_particle_end, 97, 246, 0)) return 0;
311 0 : break;
312 0 : case 2:
313 : {
314 0 : int ret = r_R2(z);
315 0 : if (ret <= 0) return ret;
316 : }
317 0 : break;
318 : }
319 : {
320 0 : int ret = slice_del(z);
321 0 : if (ret < 0) return ret;
322 : }
323 0 : return 1;
324 : }
325 :
326 0 : static int r_possessive(struct SN_env * z) {
327 : int among_var;
328 : {
329 : int v_1;
330 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
331 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
332 0 : z->ket = z->c;
333 0 : among_var = find_among_b(z, a_4, 9, 0);
334 0 : if (!among_var) { z->lb = v_1; return 0; }
335 0 : z->bra = z->c;
336 0 : z->lb = v_1;
337 : }
338 0 : switch (among_var) {
339 0 : case 1:
340 : {
341 0 : int v_2 = z->l - z->c;
342 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'k') goto lab0;
343 0 : z->c--;
344 0 : return 0;
345 0 : lab0:
346 0 : z->c = z->l - v_2;
347 : }
348 : {
349 0 : int ret = slice_del(z);
350 0 : if (ret < 0) return ret;
351 : }
352 0 : break;
353 0 : case 2:
354 : {
355 0 : int ret = slice_del(z);
356 0 : if (ret < 0) return ret;
357 : }
358 0 : z->ket = z->c;
359 0 : if (!(eq_s_b(z, 3, s_0))) return 0;
360 0 : z->bra = z->c;
361 : {
362 0 : int ret = slice_from_s(z, 3, s_1);
363 0 : if (ret < 0) return ret;
364 : }
365 0 : break;
366 0 : case 3:
367 : {
368 0 : int ret = slice_del(z);
369 0 : if (ret < 0) return ret;
370 : }
371 0 : break;
372 0 : case 4:
373 0 : if (z->c - 1 <= z->lb || z->p[z->c - 1] != 97) return 0;
374 0 : if (!find_among_b(z, a_1, 6, 0)) return 0;
375 : {
376 0 : int ret = slice_del(z);
377 0 : if (ret < 0) return ret;
378 : }
379 0 : break;
380 0 : case 5:
381 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] != 164) return 0;
382 0 : if (!find_among_b(z, a_2, 6, 0)) return 0;
383 : {
384 0 : int ret = slice_del(z);
385 0 : if (ret < 0) return ret;
386 : }
387 0 : break;
388 0 : case 6:
389 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] != 101) return 0;
390 0 : if (!find_among_b(z, a_3, 2, 0)) return 0;
391 : {
392 0 : int ret = slice_del(z);
393 0 : if (ret < 0) return ret;
394 : }
395 0 : break;
396 : }
397 0 : return 1;
398 : }
399 :
400 0 : static int r_LONG(struct SN_env * z) {
401 0 : return find_among_b(z, a_5, 7, 0) != 0;
402 : }
403 :
404 0 : static int r_VI(struct SN_env * z) {
405 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0;
406 0 : z->c--;
407 0 : return !in_grouping_b_U(z, g_V2, 97, 246, 0);
408 : }
409 :
410 0 : static int r_case_ending(struct SN_env * z) {
411 : int among_var;
412 : {
413 : int v_1;
414 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
415 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
416 0 : z->ket = z->c;
417 0 : among_var = find_among_b(z, a_6, 30, af_6);
418 0 : if (!among_var) { z->lb = v_1; return 0; }
419 0 : z->bra = z->c;
420 0 : z->lb = v_1;
421 : }
422 0 : switch (among_var) {
423 0 : case 1:
424 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'a') return 0;
425 0 : z->c--;
426 0 : break;
427 0 : case 2:
428 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0;
429 0 : z->c--;
430 0 : break;
431 0 : case 3:
432 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0;
433 0 : z->c--;
434 0 : break;
435 0 : case 4:
436 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'o') return 0;
437 0 : z->c--;
438 0 : break;
439 0 : case 5:
440 0 : if (!(eq_s_b(z, 2, s_2))) return 0;
441 0 : break;
442 0 : case 6:
443 0 : if (!(eq_s_b(z, 2, s_3))) return 0;
444 0 : break;
445 0 : case 7:
446 : {
447 0 : int v_2 = z->l - z->c;
448 : {
449 0 : int v_3 = z->l - z->c;
450 : do {
451 0 : int v_4 = z->l - z->c;
452 : {
453 0 : int ret = r_LONG(z);
454 0 : if (ret == 0) goto lab1;
455 0 : if (ret < 0) return ret;
456 : }
457 0 : break;
458 0 : lab1:
459 0 : z->c = z->l - v_4;
460 0 : if (!(eq_s_b(z, 2, s_4))) { z->c = z->l - v_2; goto lab0; }
461 : } while (0);
462 0 : z->c = z->l - v_3;
463 : {
464 0 : int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
465 0 : if (ret < 0) { z->c = z->l - v_2; goto lab0; }
466 0 : z->c = ret;
467 : }
468 : }
469 0 : z->bra = z->c;
470 0 : lab0:
471 : ;
472 : }
473 0 : break;
474 0 : case 8:
475 0 : if (in_grouping_b_U(z, g_V1, 97, 246, 0)) return 0;
476 0 : if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0;
477 0 : break;
478 : }
479 : {
480 0 : int ret = slice_del(z);
481 0 : if (ret < 0) return ret;
482 : }
483 0 : ((SN_local *)z)->b_ending_removed = 1;
484 0 : return 1;
485 : }
486 :
487 0 : static int r_other_endings(struct SN_env * z) {
488 : int among_var;
489 : {
490 : int v_1;
491 0 : if (z->c < ((SN_local *)z)->i_p2) return 0;
492 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p2;
493 0 : z->ket = z->c;
494 0 : among_var = find_among_b(z, a_7, 14, 0);
495 0 : if (!among_var) { z->lb = v_1; return 0; }
496 0 : z->bra = z->c;
497 0 : z->lb = v_1;
498 : }
499 0 : switch (among_var) {
500 0 : case 1:
501 : {
502 0 : int v_2 = z->l - z->c;
503 0 : if (!(eq_s_b(z, 2, s_5))) goto lab0;
504 0 : return 0;
505 0 : lab0:
506 0 : z->c = z->l - v_2;
507 : }
508 0 : break;
509 : }
510 : {
511 0 : int ret = slice_del(z);
512 0 : if (ret < 0) return ret;
513 : }
514 0 : return 1;
515 : }
516 :
517 0 : static int r_i_plural(struct SN_env * z) {
518 : {
519 : int v_1;
520 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
521 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
522 0 : z->ket = z->c;
523 0 : if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 106)) { z->lb = v_1; return 0; }
524 0 : z->c--;
525 0 : z->bra = z->c;
526 0 : z->lb = v_1;
527 : }
528 : {
529 0 : int ret = slice_del(z);
530 0 : if (ret < 0) return ret;
531 : }
532 0 : return 1;
533 : }
534 :
535 0 : static int r_t_plural(struct SN_env * z) {
536 : int among_var;
537 : {
538 : int v_1;
539 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
540 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
541 0 : z->ket = z->c;
542 0 : if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_1; return 0; }
543 0 : z->c--;
544 0 : z->bra = z->c;
545 : {
546 0 : int v_2 = z->l - z->c;
547 0 : if (in_grouping_b_U(z, g_V1, 97, 246, 0)) { z->lb = v_1; return 0; }
548 0 : z->c = z->l - v_2;
549 : }
550 : {
551 0 : int ret = slice_del(z);
552 0 : if (ret < 0) return ret;
553 : }
554 0 : z->lb = v_1;
555 : }
556 : {
557 : int v_3;
558 0 : if (z->c < ((SN_local *)z)->i_p2) return 0;
559 0 : v_3 = z->lb; z->lb = ((SN_local *)z)->i_p2;
560 0 : z->ket = z->c;
561 0 : if (z->c - 2 <= z->lb || z->p[z->c - 1] != 97) { z->lb = v_3; return 0; }
562 0 : among_var = find_among_b(z, a_9, 2, 0);
563 0 : if (!among_var) { z->lb = v_3; return 0; }
564 0 : z->bra = z->c;
565 0 : z->lb = v_3;
566 : }
567 0 : switch (among_var) {
568 0 : case 1:
569 : {
570 0 : int v_4 = z->l - z->c;
571 0 : if (!(eq_s_b(z, 2, s_6))) goto lab0;
572 0 : return 0;
573 0 : lab0:
574 0 : z->c = z->l - v_4;
575 : }
576 0 : break;
577 : }
578 : {
579 0 : int ret = slice_del(z);
580 0 : if (ret < 0) return ret;
581 : }
582 0 : return 1;
583 : }
584 :
585 0 : static int r_tidy(struct SN_env * z) {
586 : {
587 : int v_1;
588 0 : if (z->c < ((SN_local *)z)->i_p1) return 0;
589 0 : v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
590 : {
591 0 : int v_2 = z->l - z->c;
592 : {
593 0 : int v_3 = z->l - z->c;
594 : {
595 0 : int ret = r_LONG(z);
596 0 : if (ret == 0) goto lab0;
597 0 : if (ret < 0) return ret;
598 : }
599 0 : z->c = z->l - v_3;
600 0 : z->ket = z->c;
601 : {
602 0 : int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
603 0 : if (ret < 0) goto lab0;
604 0 : z->c = ret;
605 : }
606 0 : z->bra = z->c;
607 : {
608 0 : int ret = slice_del(z);
609 0 : if (ret < 0) return ret;
610 : }
611 : }
612 0 : lab0:
613 0 : z->c = z->l - v_2;
614 : }
615 : {
616 0 : int v_4 = z->l - z->c;
617 0 : z->ket = z->c;
618 0 : if (in_grouping_b_U(z, g_AEI, 97, 228, 0)) goto lab1;
619 0 : z->bra = z->c;
620 0 : if (in_grouping_b_U(z, g_C, 98, 122, 0)) goto lab1;
621 : {
622 0 : int ret = slice_del(z);
623 0 : if (ret < 0) return ret;
624 : }
625 0 : lab1:
626 0 : z->c = z->l - v_4;
627 : }
628 : {
629 0 : int v_5 = z->l - z->c;
630 0 : z->ket = z->c;
631 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab2;
632 0 : z->c--;
633 0 : z->bra = z->c;
634 : do {
635 0 : int v_6 = z->l - z->c;
636 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab3;
637 0 : z->c--;
638 0 : break;
639 0 : lab3:
640 0 : z->c = z->l - v_6;
641 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab2;
642 0 : z->c--;
643 : } while (0);
644 : {
645 0 : int ret = slice_del(z);
646 0 : if (ret < 0) return ret;
647 : }
648 0 : lab2:
649 0 : z->c = z->l - v_5;
650 : }
651 : {
652 0 : int v_7 = z->l - z->c;
653 0 : z->ket = z->c;
654 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab4;
655 0 : z->c--;
656 0 : z->bra = z->c;
657 0 : if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab4;
658 0 : z->c--;
659 : {
660 0 : int ret = slice_del(z);
661 0 : if (ret < 0) return ret;
662 : }
663 0 : lab4:
664 0 : z->c = z->l - v_7;
665 : }
666 0 : z->lb = v_1;
667 : }
668 0 : if (in_grouping_b_U(z, g_V1, 97, 246, 1) < 0) return 0;
669 0 : z->ket = z->c;
670 0 : if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0;
671 0 : z->bra = z->c;
672 : {
673 0 : int ret = slice_to(z, &((SN_local *)z)->s_x);
674 0 : if (ret < 0) return ret;
675 : }
676 0 : if (!(eq_v_b(z, ((SN_local *)z)->s_x))) return 0;
677 : {
678 0 : int ret = slice_del(z);
679 0 : if (ret < 0) return ret;
680 : }
681 0 : return 1;
682 : }
683 :
684 0 : extern int finnish_UTF_8_stem(struct SN_env * z) {
685 : {
686 0 : int v_1 = z->c;
687 : {
688 0 : int ret = r_mark_regions(z);
689 0 : if (ret < 0) return ret;
690 : }
691 0 : z->c = v_1;
692 : }
693 0 : ((SN_local *)z)->b_ending_removed = 0;
694 0 : z->lb = z->c; z->c = z->l;
695 : {
696 0 : int v_2 = z->l - z->c;
697 : {
698 0 : int ret = r_particle_etc(z);
699 0 : if (ret < 0) return ret;
700 : }
701 0 : z->c = z->l - v_2;
702 : }
703 : {
704 0 : int v_3 = z->l - z->c;
705 : {
706 0 : int ret = r_possessive(z);
707 0 : if (ret < 0) return ret;
708 : }
709 0 : z->c = z->l - v_3;
710 : }
711 : {
712 0 : int v_4 = z->l - z->c;
713 : {
714 0 : int ret = r_case_ending(z);
715 0 : if (ret < 0) return ret;
716 : }
717 0 : z->c = z->l - v_4;
718 : }
719 : {
720 0 : int v_5 = z->l - z->c;
721 : {
722 0 : int ret = r_other_endings(z);
723 0 : if (ret < 0) return ret;
724 : }
725 0 : z->c = z->l - v_5;
726 : }
727 : do {
728 0 : if (!((SN_local *)z)->b_ending_removed) goto lab0;
729 : {
730 0 : int v_6 = z->l - z->c;
731 : {
732 0 : int ret = r_i_plural(z);
733 0 : if (ret < 0) return ret;
734 : }
735 0 : z->c = z->l - v_6;
736 : }
737 0 : break;
738 0 : lab0:
739 : {
740 0 : int v_7 = z->l - z->c;
741 : {
742 0 : int ret = r_t_plural(z);
743 0 : if (ret < 0) return ret;
744 : }
745 0 : z->c = z->l - v_7;
746 : }
747 : } while (0);
748 : {
749 0 : int v_8 = z->l - z->c;
750 : {
751 0 : int ret = r_tidy(z);
752 0 : if (ret < 0) return ret;
753 : }
754 0 : z->c = z->l - v_8;
755 : }
756 0 : z->c = z->lb;
757 0 : return 1;
758 : }
759 :
760 0 : extern struct SN_env * finnish_UTF_8_create_env(void) {
761 0 : struct SN_env * z = SN_new_env(sizeof(SN_local));
762 0 : if (z) {
763 0 : ((SN_local *)z)->b_ending_removed = 0;
764 0 : ((SN_local *)z)->s_x = NULL;
765 0 : ((SN_local *)z)->i_p2 = 0;
766 0 : ((SN_local *)z)->i_p1 = 0;
767 :
768 0 : if ((((SN_local *)z)->s_x = create_s()) == NULL) {
769 0 : finnish_UTF_8_close_env(z);
770 0 : return NULL;
771 : }
772 : }
773 0 : return z;
774 : }
775 :
776 0 : extern void finnish_UTF_8_close_env(struct SN_env * z) {
777 0 : if (z) {
778 0 : lose_s(((SN_local *)z)->s_x);
779 : }
780 0 : SN_delete_env(z);
781 0 : }
782 :
|