Branch data Line data Source code
1 : : /* Generated from russian.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 : :
3 : : #include "stem_KOI8_R_russian.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_pV;
13 : : };
14 : :
15 : : typedef struct SN_local SN_local;
16 : :
17 : : #ifdef __cplusplus
18 : : extern "C" {
19 : : #endif
20 : : extern int russian_KOI8_R_stem(struct SN_env * z);
21 : : #ifdef __cplusplus
22 : : }
23 : : #endif
24 : :
25 : : static int r_tidy_up(struct SN_env * z);
26 : : static int r_derivational(struct SN_env * z);
27 : : static int r_noun(struct SN_env * z);
28 : : static int r_verb(struct SN_env * z);
29 : : static int r_reflexive(struct SN_env * z);
30 : : static int r_adjectival(struct SN_env * z);
31 : : static int r_adjective(struct SN_env * z);
32 : : static int r_perfective_gerund(struct SN_env * z);
33 : : static int r_R2(struct SN_env * z);
34 : : static int r_mark_regions(struct SN_env * z);
35 : :
36 : : static const symbol s_0[] = { 0xC5 };
37 : :
38 : : static const symbol s_0_0[3] = { 0xD7, 0xDB, 0xC9 };
39 : : static const symbol s_0_1[4] = { 0xC9, 0xD7, 0xDB, 0xC9 };
40 : : static const symbol s_0_2[4] = { 0xD9, 0xD7, 0xDB, 0xC9 };
41 : : static const symbol s_0_3[1] = { 0xD7 };
42 : : static const symbol s_0_4[2] = { 0xC9, 0xD7 };
43 : : static const symbol s_0_5[2] = { 0xD9, 0xD7 };
44 : : static const symbol s_0_6[5] = { 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 };
45 : : static const symbol s_0_7[6] = { 0xC9, 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 };
46 : : static const symbol s_0_8[6] = { 0xD9, 0xD7, 0xDB, 0xC9, 0xD3, 0xD8 };
47 : : static const struct among a_0[9] = {
48 : : { 3, s_0_0, 0, 1, 0},
49 : : { 4, s_0_1, -1, 2, 0},
50 : : { 4, s_0_2, -2, 2, 0},
51 : : { 1, s_0_3, 0, 1, 0},
52 : : { 2, s_0_4, -1, 2, 0},
53 : : { 2, s_0_5, -2, 2, 0},
54 : : { 5, s_0_6, 0, 1, 0},
55 : : { 6, s_0_7, -1, 2, 0},
56 : : { 6, s_0_8, -2, 2, 0}
57 : : };
58 : :
59 : : static const symbol s_1_0[2] = { 0xC0, 0xC0 };
60 : : static const symbol s_1_1[2] = { 0xC5, 0xC0 };
61 : : static const symbol s_1_2[2] = { 0xCF, 0xC0 };
62 : : static const symbol s_1_3[2] = { 0xD5, 0xC0 };
63 : : static const symbol s_1_4[2] = { 0xC5, 0xC5 };
64 : : static const symbol s_1_5[2] = { 0xC9, 0xC5 };
65 : : static const symbol s_1_6[2] = { 0xCF, 0xC5 };
66 : : static const symbol s_1_7[2] = { 0xD9, 0xC5 };
67 : : static const symbol s_1_8[2] = { 0xC9, 0xC8 };
68 : : static const symbol s_1_9[2] = { 0xD9, 0xC8 };
69 : : static const symbol s_1_10[3] = { 0xC9, 0xCD, 0xC9 };
70 : : static const symbol s_1_11[3] = { 0xD9, 0xCD, 0xC9 };
71 : : static const symbol s_1_12[2] = { 0xC5, 0xCA };
72 : : static const symbol s_1_13[2] = { 0xC9, 0xCA };
73 : : static const symbol s_1_14[2] = { 0xCF, 0xCA };
74 : : static const symbol s_1_15[2] = { 0xD9, 0xCA };
75 : : static const symbol s_1_16[2] = { 0xC5, 0xCD };
76 : : static const symbol s_1_17[2] = { 0xC9, 0xCD };
77 : : static const symbol s_1_18[2] = { 0xCF, 0xCD };
78 : : static const symbol s_1_19[2] = { 0xD9, 0xCD };
79 : : static const symbol s_1_20[3] = { 0xC5, 0xC7, 0xCF };
80 : : static const symbol s_1_21[3] = { 0xCF, 0xC7, 0xCF };
81 : : static const symbol s_1_22[2] = { 0xC1, 0xD1 };
82 : : static const symbol s_1_23[2] = { 0xD1, 0xD1 };
83 : : static const symbol s_1_24[3] = { 0xC5, 0xCD, 0xD5 };
84 : : static const symbol s_1_25[3] = { 0xCF, 0xCD, 0xD5 };
85 : : static const struct among a_1[26] = {
86 : : { 2, s_1_0, 0, 1, 0},
87 : : { 2, s_1_1, 0, 1, 0},
88 : : { 2, s_1_2, 0, 1, 0},
89 : : { 2, s_1_3, 0, 1, 0},
90 : : { 2, s_1_4, 0, 1, 0},
91 : : { 2, s_1_5, 0, 1, 0},
92 : : { 2, s_1_6, 0, 1, 0},
93 : : { 2, s_1_7, 0, 1, 0},
94 : : { 2, s_1_8, 0, 1, 0},
95 : : { 2, s_1_9, 0, 1, 0},
96 : : { 3, s_1_10, 0, 1, 0},
97 : : { 3, s_1_11, 0, 1, 0},
98 : : { 2, s_1_12, 0, 1, 0},
99 : : { 2, s_1_13, 0, 1, 0},
100 : : { 2, s_1_14, 0, 1, 0},
101 : : { 2, s_1_15, 0, 1, 0},
102 : : { 2, s_1_16, 0, 1, 0},
103 : : { 2, s_1_17, 0, 1, 0},
104 : : { 2, s_1_18, 0, 1, 0},
105 : : { 2, s_1_19, 0, 1, 0},
106 : : { 3, s_1_20, 0, 1, 0},
107 : : { 3, s_1_21, 0, 1, 0},
108 : : { 2, s_1_22, 0, 1, 0},
109 : : { 2, s_1_23, 0, 1, 0},
110 : : { 3, s_1_24, 0, 1, 0},
111 : : { 3, s_1_25, 0, 1, 0}
112 : : };
113 : :
114 : : static const symbol s_2_0[2] = { 0xC5, 0xCD };
115 : : static const symbol s_2_1[2] = { 0xCE, 0xCE };
116 : : static const symbol s_2_2[2] = { 0xD7, 0xDB };
117 : : static const symbol s_2_3[3] = { 0xC9, 0xD7, 0xDB };
118 : : static const symbol s_2_4[3] = { 0xD9, 0xD7, 0xDB };
119 : : static const symbol s_2_5[1] = { 0xDD };
120 : : static const symbol s_2_6[2] = { 0xC0, 0xDD };
121 : : static const symbol s_2_7[3] = { 0xD5, 0xC0, 0xDD };
122 : : static const struct among a_2[8] = {
123 : : { 2, s_2_0, 0, 1, 0},
124 : : { 2, s_2_1, 0, 1, 0},
125 : : { 2, s_2_2, 0, 1, 0},
126 : : { 3, s_2_3, -1, 2, 0},
127 : : { 3, s_2_4, -2, 2, 0},
128 : : { 1, s_2_5, 0, 1, 0},
129 : : { 2, s_2_6, -1, 1, 0},
130 : : { 3, s_2_7, -1, 2, 0}
131 : : };
132 : :
133 : : static const symbol s_3_0[2] = { 0xD3, 0xD1 };
134 : : static const symbol s_3_1[2] = { 0xD3, 0xD8 };
135 : : static const struct among a_3[2] = {
136 : : { 2, s_3_0, 0, 1, 0},
137 : : { 2, s_3_1, 0, 1, 0}
138 : : };
139 : :
140 : : static const symbol s_4_0[1] = { 0xC0 };
141 : : static const symbol s_4_1[2] = { 0xD5, 0xC0 };
142 : : static const symbol s_4_2[2] = { 0xCC, 0xC1 };
143 : : static const symbol s_4_3[3] = { 0xC9, 0xCC, 0xC1 };
144 : : static const symbol s_4_4[3] = { 0xD9, 0xCC, 0xC1 };
145 : : static const symbol s_4_5[2] = { 0xCE, 0xC1 };
146 : : static const symbol s_4_6[3] = { 0xC5, 0xCE, 0xC1 };
147 : : static const symbol s_4_7[3] = { 0xC5, 0xD4, 0xC5 };
148 : : static const symbol s_4_8[3] = { 0xC9, 0xD4, 0xC5 };
149 : : static const symbol s_4_9[3] = { 0xCA, 0xD4, 0xC5 };
150 : : static const symbol s_4_10[4] = { 0xC5, 0xCA, 0xD4, 0xC5 };
151 : : static const symbol s_4_11[4] = { 0xD5, 0xCA, 0xD4, 0xC5 };
152 : : static const symbol s_4_12[2] = { 0xCC, 0xC9 };
153 : : static const symbol s_4_13[3] = { 0xC9, 0xCC, 0xC9 };
154 : : static const symbol s_4_14[3] = { 0xD9, 0xCC, 0xC9 };
155 : : static const symbol s_4_15[1] = { 0xCA };
156 : : static const symbol s_4_16[2] = { 0xC5, 0xCA };
157 : : static const symbol s_4_17[2] = { 0xD5, 0xCA };
158 : : static const symbol s_4_18[1] = { 0xCC };
159 : : static const symbol s_4_19[2] = { 0xC9, 0xCC };
160 : : static const symbol s_4_20[2] = { 0xD9, 0xCC };
161 : : static const symbol s_4_21[2] = { 0xC5, 0xCD };
162 : : static const symbol s_4_22[2] = { 0xC9, 0xCD };
163 : : static const symbol s_4_23[2] = { 0xD9, 0xCD };
164 : : static const symbol s_4_24[1] = { 0xCE };
165 : : static const symbol s_4_25[2] = { 0xC5, 0xCE };
166 : : static const symbol s_4_26[2] = { 0xCC, 0xCF };
167 : : static const symbol s_4_27[3] = { 0xC9, 0xCC, 0xCF };
168 : : static const symbol s_4_28[3] = { 0xD9, 0xCC, 0xCF };
169 : : static const symbol s_4_29[2] = { 0xCE, 0xCF };
170 : : static const symbol s_4_30[3] = { 0xC5, 0xCE, 0xCF };
171 : : static const symbol s_4_31[3] = { 0xCE, 0xCE, 0xCF };
172 : : static const symbol s_4_32[2] = { 0xC0, 0xD4 };
173 : : static const symbol s_4_33[3] = { 0xD5, 0xC0, 0xD4 };
174 : : static const symbol s_4_34[2] = { 0xC5, 0xD4 };
175 : : static const symbol s_4_35[3] = { 0xD5, 0xC5, 0xD4 };
176 : : static const symbol s_4_36[2] = { 0xC9, 0xD4 };
177 : : static const symbol s_4_37[2] = { 0xD1, 0xD4 };
178 : : static const symbol s_4_38[2] = { 0xD9, 0xD4 };
179 : : static const symbol s_4_39[2] = { 0xD4, 0xD8 };
180 : : static const symbol s_4_40[3] = { 0xC9, 0xD4, 0xD8 };
181 : : static const symbol s_4_41[3] = { 0xD9, 0xD4, 0xD8 };
182 : : static const symbol s_4_42[3] = { 0xC5, 0xDB, 0xD8 };
183 : : static const symbol s_4_43[3] = { 0xC9, 0xDB, 0xD8 };
184 : : static const symbol s_4_44[2] = { 0xCE, 0xD9 };
185 : : static const symbol s_4_45[3] = { 0xC5, 0xCE, 0xD9 };
186 : : static const struct among a_4[46] = {
187 : : { 1, s_4_0, 0, 2, 0},
188 : : { 2, s_4_1, -1, 2, 0},
189 : : { 2, s_4_2, 0, 1, 0},
190 : : { 3, s_4_3, -1, 2, 0},
191 : : { 3, s_4_4, -2, 2, 0},
192 : : { 2, s_4_5, 0, 1, 0},
193 : : { 3, s_4_6, -1, 2, 0},
194 : : { 3, s_4_7, 0, 1, 0},
195 : : { 3, s_4_8, 0, 2, 0},
196 : : { 3, s_4_9, 0, 1, 0},
197 : : { 4, s_4_10, -1, 2, 0},
198 : : { 4, s_4_11, -2, 2, 0},
199 : : { 2, s_4_12, 0, 1, 0},
200 : : { 3, s_4_13, -1, 2, 0},
201 : : { 3, s_4_14, -2, 2, 0},
202 : : { 1, s_4_15, 0, 1, 0},
203 : : { 2, s_4_16, -1, 2, 0},
204 : : { 2, s_4_17, -2, 2, 0},
205 : : { 1, s_4_18, 0, 1, 0},
206 : : { 2, s_4_19, -1, 2, 0},
207 : : { 2, s_4_20, -2, 2, 0},
208 : : { 2, s_4_21, 0, 1, 0},
209 : : { 2, s_4_22, 0, 2, 0},
210 : : { 2, s_4_23, 0, 2, 0},
211 : : { 1, s_4_24, 0, 1, 0},
212 : : { 2, s_4_25, -1, 2, 0},
213 : : { 2, s_4_26, 0, 1, 0},
214 : : { 3, s_4_27, -1, 2, 0},
215 : : { 3, s_4_28, -2, 2, 0},
216 : : { 2, s_4_29, 0, 1, 0},
217 : : { 3, s_4_30, -1, 2, 0},
218 : : { 3, s_4_31, -2, 1, 0},
219 : : { 2, s_4_32, 0, 1, 0},
220 : : { 3, s_4_33, -1, 2, 0},
221 : : { 2, s_4_34, 0, 1, 0},
222 : : { 3, s_4_35, -1, 2, 0},
223 : : { 2, s_4_36, 0, 2, 0},
224 : : { 2, s_4_37, 0, 2, 0},
225 : : { 2, s_4_38, 0, 2, 0},
226 : : { 2, s_4_39, 0, 1, 0},
227 : : { 3, s_4_40, -1, 2, 0},
228 : : { 3, s_4_41, -2, 2, 0},
229 : : { 3, s_4_42, 0, 1, 0},
230 : : { 3, s_4_43, 0, 2, 0},
231 : : { 2, s_4_44, 0, 1, 0},
232 : : { 3, s_4_45, -1, 2, 0}
233 : : };
234 : :
235 : : static const symbol s_5_0[1] = { 0xC0 };
236 : : static const symbol s_5_1[2] = { 0xC9, 0xC0 };
237 : : static const symbol s_5_2[2] = { 0xD8, 0xC0 };
238 : : static const symbol s_5_3[1] = { 0xC1 };
239 : : static const symbol s_5_4[1] = { 0xC5 };
240 : : static const symbol s_5_5[2] = { 0xC9, 0xC5 };
241 : : static const symbol s_5_6[2] = { 0xD8, 0xC5 };
242 : : static const symbol s_5_7[2] = { 0xC1, 0xC8 };
243 : : static const symbol s_5_8[2] = { 0xD1, 0xC8 };
244 : : static const symbol s_5_9[3] = { 0xC9, 0xD1, 0xC8 };
245 : : static const symbol s_5_10[1] = { 0xC9 };
246 : : static const symbol s_5_11[2] = { 0xC5, 0xC9 };
247 : : static const symbol s_5_12[2] = { 0xC9, 0xC9 };
248 : : static const symbol s_5_13[3] = { 0xC1, 0xCD, 0xC9 };
249 : : static const symbol s_5_14[3] = { 0xD1, 0xCD, 0xC9 };
250 : : static const symbol s_5_15[4] = { 0xC9, 0xD1, 0xCD, 0xC9 };
251 : : static const symbol s_5_16[1] = { 0xCA };
252 : : static const symbol s_5_17[2] = { 0xC5, 0xCA };
253 : : static const symbol s_5_18[3] = { 0xC9, 0xC5, 0xCA };
254 : : static const symbol s_5_19[2] = { 0xC9, 0xCA };
255 : : static const symbol s_5_20[2] = { 0xCF, 0xCA };
256 : : static const symbol s_5_21[2] = { 0xC1, 0xCD };
257 : : static const symbol s_5_22[2] = { 0xC5, 0xCD };
258 : : static const symbol s_5_23[3] = { 0xC9, 0xC5, 0xCD };
259 : : static const symbol s_5_24[2] = { 0xCF, 0xCD };
260 : : static const symbol s_5_25[2] = { 0xD1, 0xCD };
261 : : static const symbol s_5_26[3] = { 0xC9, 0xD1, 0xCD };
262 : : static const symbol s_5_27[1] = { 0xCF };
263 : : static const symbol s_5_28[1] = { 0xD1 };
264 : : static const symbol s_5_29[2] = { 0xC9, 0xD1 };
265 : : static const symbol s_5_30[2] = { 0xD8, 0xD1 };
266 : : static const symbol s_5_31[1] = { 0xD5 };
267 : : static const symbol s_5_32[2] = { 0xC5, 0xD7 };
268 : : static const symbol s_5_33[2] = { 0xCF, 0xD7 };
269 : : static const symbol s_5_34[1] = { 0xD8 };
270 : : static const symbol s_5_35[1] = { 0xD9 };
271 : : static const struct among a_5[36] = {
272 : : { 1, s_5_0, 0, 1, 0},
273 : : { 2, s_5_1, -1, 1, 0},
274 : : { 2, s_5_2, -2, 1, 0},
275 : : { 1, s_5_3, 0, 1, 0},
276 : : { 1, s_5_4, 0, 1, 0},
277 : : { 2, s_5_5, -1, 1, 0},
278 : : { 2, s_5_6, -2, 1, 0},
279 : : { 2, s_5_7, 0, 1, 0},
280 : : { 2, s_5_8, 0, 1, 0},
281 : : { 3, s_5_9, -1, 1, 0},
282 : : { 1, s_5_10, 0, 1, 0},
283 : : { 2, s_5_11, -1, 1, 0},
284 : : { 2, s_5_12, -2, 1, 0},
285 : : { 3, s_5_13, -3, 1, 0},
286 : : { 3, s_5_14, -4, 1, 0},
287 : : { 4, s_5_15, -1, 1, 0},
288 : : { 1, s_5_16, 0, 1, 0},
289 : : { 2, s_5_17, -1, 1, 0},
290 : : { 3, s_5_18, -1, 1, 0},
291 : : { 2, s_5_19, -3, 1, 0},
292 : : { 2, s_5_20, -4, 1, 0},
293 : : { 2, s_5_21, 0, 1, 0},
294 : : { 2, s_5_22, 0, 1, 0},
295 : : { 3, s_5_23, -1, 1, 0},
296 : : { 2, s_5_24, 0, 1, 0},
297 : : { 2, s_5_25, 0, 1, 0},
298 : : { 3, s_5_26, -1, 1, 0},
299 : : { 1, s_5_27, 0, 1, 0},
300 : : { 1, s_5_28, 0, 1, 0},
301 : : { 2, s_5_29, -1, 1, 0},
302 : : { 2, s_5_30, -2, 1, 0},
303 : : { 1, s_5_31, 0, 1, 0},
304 : : { 2, s_5_32, 0, 1, 0},
305 : : { 2, s_5_33, 0, 1, 0},
306 : : { 1, s_5_34, 0, 1, 0},
307 : : { 1, s_5_35, 0, 1, 0}
308 : : };
309 : :
310 : : static const symbol s_6_0[3] = { 0xCF, 0xD3, 0xD4 };
311 : : static const symbol s_6_1[4] = { 0xCF, 0xD3, 0xD4, 0xD8 };
312 : : static const struct among a_6[2] = {
313 : : { 3, s_6_0, 0, 1, 0},
314 : : { 4, s_6_1, 0, 1, 0}
315 : : };
316 : :
317 : : static const symbol s_7_0[4] = { 0xC5, 0xCA, 0xDB, 0xC5 };
318 : : static const symbol s_7_1[1] = { 0xCE };
319 : : static const symbol s_7_2[1] = { 0xD8 };
320 : : static const symbol s_7_3[3] = { 0xC5, 0xCA, 0xDB };
321 : : static const struct among a_7[4] = {
322 : : { 4, s_7_0, 0, 1, 0},
323 : : { 1, s_7_1, 0, 2, 0},
324 : : { 1, s_7_2, 0, 3, 0},
325 : : { 3, s_7_3, 0, 1, 0}
326 : : };
327 : :
328 : : static const unsigned char g_v[] = { 35, 130, 34, 18 };
329 : :
330 : 0 : static int r_mark_regions(struct SN_env * z) {
331 : 0 : ((SN_local *)z)->i_pV = z->l;
332 : 0 : ((SN_local *)z)->i_p2 = z->l;
333 : : {
334 : 0 : int v_1 = z->c;
335 : : {
336 : 0 : int ret = out_grouping(z, g_v, 192, 220, 1);
337 [ # # ]: 0 : if (ret < 0) goto lab0;
338 : 0 : z->c += ret;
339 [ # # ]: 0 : }
340 : 0 : ((SN_local *)z)->i_pV = z->c;
341 : : {
342 : 0 : int ret = in_grouping(z, g_v, 192, 220, 1);
343 [ # # ]: 0 : if (ret < 0) goto lab0;
344 : 0 : z->c += ret;
345 [ # # ]: 0 : }
346 : : {
347 : 0 : int ret = out_grouping(z, g_v, 192, 220, 1);
348 [ # # ]: 0 : if (ret < 0) goto lab0;
349 : 0 : z->c += ret;
350 [ # # ]: 0 : }
351 : : {
352 : 0 : int ret = in_grouping(z, g_v, 192, 220, 1);
353 [ # # ]: 0 : if (ret < 0) goto lab0;
354 : 0 : z->c += ret;
355 [ # # ]: 0 : }
356 : 0 : ((SN_local *)z)->i_p2 = z->c;
357 : : lab0:
358 : 0 : z->c = v_1;
359 : 0 : }
360 : 0 : return 1;
361 : : }
362 : :
363 : 0 : static int r_R2(struct SN_env * z) {
364 : 0 : return ((SN_local *)z)->i_p2 <= z->c;
365 : : }
366 : :
367 : 0 : static int r_perfective_gerund(struct SN_env * z) {
368 : 0 : int among_var;
369 : 0 : z->ket = z->c;
370 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((25166336 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
# # ]
371 : 0 : among_var = find_among_b(z, a_0, 9, 0);
372 [ # # ]: 0 : if (!among_var) return 0;
373 : 0 : z->bra = z->c;
374 [ # # # ]: 0 : switch (among_var) {
375 : : case 1:
376 : 0 : do {
377 : 0 : int v_1 = z->l - z->c;
378 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab0;
379 : 0 : z->c--;
380 : 0 : break;
381 : : lab0:
382 : 0 : z->c = z->l - v_1;
383 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) return 0;
384 : 0 : z->c--;
385 [ # # # ]: 0 : } while (0);
386 : : {
387 : 0 : int ret = slice_del(z);
388 [ # # ]: 0 : if (ret < 0) return ret;
389 [ # # ]: 0 : }
390 : 0 : break;
391 : : case 2:
392 : : {
393 : 0 : int ret = slice_del(z);
394 [ # # ]: 0 : if (ret < 0) return ret;
395 [ # # ]: 0 : }
396 : 0 : break;
397 : : }
398 : 0 : return 1;
399 : 0 : }
400 : :
401 : 0 : static int r_adjective(struct SN_env * z) {
402 : 0 : z->ket = z->c;
403 [ # # # # : 0 : if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((2271009 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
# # ]
404 [ # # ]: 0 : if (!find_among_b(z, a_1, 26, 0)) return 0;
405 : 0 : z->bra = z->c;
406 : : {
407 : 0 : int ret = slice_del(z);
408 [ # # ]: 0 : if (ret < 0) return ret;
409 [ # # # ]: 0 : }
410 : 0 : return 1;
411 : 0 : }
412 : :
413 : 0 : static int r_adjectival(struct SN_env * z) {
414 : 0 : int among_var;
415 : : {
416 : 0 : int ret = r_adjective(z);
417 [ # # ]: 0 : if (ret <= 0) return ret;
418 [ # # ]: 0 : }
419 : : {
420 : 0 : int v_1 = z->l - z->c;
421 : 0 : z->ket = z->c;
422 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((671113216 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - v_1; goto lab0; }
# # ]
423 : 0 : among_var = find_among_b(z, a_2, 8, 0);
424 [ # # ]: 0 : if (!among_var) { z->c = z->l - v_1; goto lab0; }
425 : 0 : z->bra = z->c;
426 [ # # # ]: 0 : switch (among_var) {
427 : : case 1:
428 : 0 : do {
429 : 0 : int v_2 = z->l - z->c;
430 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab1;
431 : 0 : z->c--;
432 : 0 : break;
433 : : lab1:
434 : 0 : z->c = z->l - v_2;
435 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) { z->c = z->l - v_1; goto lab0; }
436 : 0 : z->c--;
437 [ # # # # ]: 0 : } while (0);
438 : : {
439 : 0 : int ret = slice_del(z);
440 [ # # ]: 0 : if (ret < 0) return ret;
441 [ # # ]: 0 : }
442 : 0 : break;
443 : : case 2:
444 : : {
445 : 0 : int ret = slice_del(z);
446 [ # # ]: 0 : if (ret < 0) return ret;
447 [ # # ]: 0 : }
448 : 0 : break;
449 : 0 : }
450 : : lab0:
451 : : ;
452 [ # # ]: 0 : }
453 : 0 : return 1;
454 : 0 : }
455 : :
456 : 0 : static int r_reflexive(struct SN_env * z) {
457 : 0 : z->ket = z->c;
458 [ # # # # : 0 : if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 209 && z->p[z->c - 1] != 216)) return 0;
# # ]
459 [ # # ]: 0 : if (!find_among_b(z, a_3, 2, 0)) return 0;
460 : 0 : z->bra = z->c;
461 : : {
462 : 0 : int ret = slice_del(z);
463 [ # # ]: 0 : if (ret < 0) return ret;
464 [ # # # ]: 0 : }
465 : 0 : return 1;
466 : 0 : }
467 : :
468 : 0 : static int r_verb(struct SN_env * z) {
469 : 0 : int among_var;
470 : 0 : z->ket = z->c;
471 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((51443235 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
# # ]
472 : 0 : among_var = find_among_b(z, a_4, 46, 0);
473 [ # # ]: 0 : if (!among_var) return 0;
474 : 0 : z->bra = z->c;
475 [ # # # ]: 0 : switch (among_var) {
476 : : case 1:
477 : 0 : do {
478 : 0 : int v_1 = z->l - z->c;
479 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xC1) goto lab0;
480 : 0 : z->c--;
481 : 0 : break;
482 : : lab0:
483 : 0 : z->c = z->l - v_1;
484 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xD1) return 0;
485 : 0 : z->c--;
486 [ # # # ]: 0 : } while (0);
487 : : {
488 : 0 : int ret = slice_del(z);
489 [ # # ]: 0 : if (ret < 0) return ret;
490 [ # # ]: 0 : }
491 : 0 : break;
492 : : case 2:
493 : : {
494 : 0 : int ret = slice_del(z);
495 [ # # ]: 0 : if (ret < 0) return ret;
496 [ # # ]: 0 : }
497 : 0 : break;
498 : : }
499 : 0 : return 1;
500 : 0 : }
501 : :
502 : 0 : static int r_noun(struct SN_env * z) {
503 : 0 : z->ket = z->c;
504 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((60991267 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
# # ]
505 [ # # ]: 0 : if (!find_among_b(z, a_5, 36, 0)) return 0;
506 : 0 : z->bra = z->c;
507 : : {
508 : 0 : int ret = slice_del(z);
509 [ # # ]: 0 : if (ret < 0) return ret;
510 [ # # # ]: 0 : }
511 : 0 : return 1;
512 : 0 : }
513 : :
514 : 0 : static int r_derivational(struct SN_env * z) {
515 : 0 : z->ket = z->c;
516 [ # # # # : 0 : if (z->c - 2 <= z->lb || (z->p[z->c - 1] != 212 && z->p[z->c - 1] != 216)) return 0;
# # ]
517 [ # # ]: 0 : if (!find_among_b(z, a_6, 2, 0)) return 0;
518 : 0 : z->bra = z->c;
519 : : {
520 : 0 : int ret = r_R2(z);
521 [ # # ]: 0 : if (ret <= 0) return ret;
522 [ # # ]: 0 : }
523 : : {
524 : 0 : int ret = slice_del(z);
525 [ # # ]: 0 : if (ret < 0) return ret;
526 [ # # ]: 0 : }
527 : 0 : return 1;
528 : 0 : }
529 : :
530 : 0 : static int r_tidy_up(struct SN_env * z) {
531 : 0 : int among_var;
532 : 0 : z->ket = z->c;
533 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 6 || !((151011360 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
# # ]
534 : 0 : among_var = find_among_b(z, a_7, 4, 0);
535 [ # # ]: 0 : if (!among_var) return 0;
536 : 0 : z->bra = z->c;
537 [ # # # # ]: 0 : switch (among_var) {
538 : : case 1:
539 : : {
540 : 0 : int ret = slice_del(z);
541 [ # # ]: 0 : if (ret < 0) return ret;
542 [ # # ]: 0 : }
543 : 0 : z->ket = z->c;
544 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0;
545 : 0 : z->c--;
546 : 0 : z->bra = z->c;
547 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0;
548 : 0 : z->c--;
549 : : {
550 : 0 : int ret = slice_del(z);
551 [ # # ]: 0 : if (ret < 0) return ret;
552 [ # # ]: 0 : }
553 : 0 : break;
554 : : case 2:
555 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xCE) return 0;
556 : 0 : z->c--;
557 : : {
558 : 0 : int ret = slice_del(z);
559 [ # # ]: 0 : if (ret < 0) return ret;
560 [ # # ]: 0 : }
561 : 0 : break;
562 : : case 3:
563 : : {
564 : 0 : int ret = slice_del(z);
565 [ # # ]: 0 : if (ret < 0) return ret;
566 [ # # ]: 0 : }
567 : 0 : break;
568 : : }
569 : 0 : return 1;
570 : 0 : }
571 : :
572 : 0 : extern int russian_KOI8_R_stem(struct SN_env * z) {
573 : : {
574 : 0 : int v_1 = z->c;
575 : 0 : while (1) {
576 : 0 : int v_2 = z->c;
577 : 0 : while (1) {
578 : 0 : int v_3 = z->c;
579 : 0 : z->bra = z->c;
580 [ # # # # ]: 0 : if (z->c == z->l || z->p[z->c] != 0xA3) goto lab2;
581 : 0 : z->c++;
582 : 0 : z->ket = z->c;
583 : 0 : z->c = v_3;
584 : 0 : break;
585 : : lab2:
586 : 0 : z->c = v_3;
587 [ # # ]: 0 : if (z->c >= z->l) goto lab1;
588 : 0 : z->c++;
589 [ # # # # ]: 0 : }
590 : : {
591 : 0 : int ret = slice_from_s(z, 1, s_0);
592 [ # # ]: 0 : if (ret < 0) return ret;
593 [ # # ]: 0 : }
594 : 0 : continue;
595 : : lab1:
596 : 0 : z->c = v_2;
597 : 0 : break;
598 [ # # # ]: 0 : }
599 : 0 : z->c = v_1;
600 [ # # ]: 0 : }
601 : : {
602 : 0 : int ret = r_mark_regions(z);
603 [ # # ]: 0 : if (ret < 0) return ret;
604 [ # # ]: 0 : }
605 : 0 : z->lb = z->c; z->c = z->l;
606 : : {
607 : 0 : int v_4;
608 [ # # ]: 0 : if (z->c < ((SN_local *)z)->i_pV) return 0;
609 : 0 : v_4 = z->lb; z->lb = ((SN_local *)z)->i_pV;
610 : : {
611 : 0 : int v_5 = z->l - z->c;
612 : 0 : do {
613 : 0 : int v_6 = z->l - z->c;
614 : : {
615 : 0 : int ret = r_perfective_gerund(z);
616 [ # # ]: 0 : if (ret == 0) goto lab4;
617 [ # # ]: 0 : if (ret < 0) return ret;
618 [ # # # ]: 0 : }
619 : 0 : break;
620 : : lab4:
621 : 0 : z->c = z->l - v_6;
622 : : {
623 : 0 : int v_7 = z->l - z->c;
624 : : {
625 : 0 : int ret = r_reflexive(z);
626 [ # # ]: 0 : if (ret == 0) { z->c = z->l - v_7; goto lab5; }
627 [ # # ]: 0 : if (ret < 0) return ret;
628 [ # # # ]: 0 : }
629 : : lab5:
630 : : ;
631 [ # # ]: 0 : }
632 : 0 : do {
633 : 0 : int v_8 = z->l - z->c;
634 : : {
635 : 0 : int ret = r_adjectival(z);
636 [ # # ]: 0 : if (ret == 0) goto lab6;
637 [ # # ]: 0 : if (ret < 0) return ret;
638 [ # # # ]: 0 : }
639 : 0 : break;
640 : : lab6:
641 : 0 : z->c = z->l - v_8;
642 : : {
643 : 0 : int ret = r_verb(z);
644 [ # # ]: 0 : if (ret == 0) goto lab7;
645 [ # # ]: 0 : if (ret < 0) return ret;
646 [ # # # ]: 0 : }
647 : 0 : break;
648 : : lab7:
649 : 0 : z->c = z->l - v_8;
650 : : {
651 : 0 : int ret = r_noun(z);
652 [ # # ]: 0 : if (ret == 0) goto lab3;
653 [ # # ]: 0 : if (ret < 0) return ret;
654 [ # # ]: 0 : }
655 [ # # # ]: 0 : } while (0);
656 [ # # # # ]: 0 : } while (0);
657 : : lab3:
658 : 0 : z->c = z->l - v_5;
659 [ # # ]: 0 : }
660 : : {
661 : 0 : int v_9 = z->l - z->c;
662 : 0 : z->ket = z->c;
663 [ # # # # ]: 0 : if (z->c <= z->lb || z->p[z->c - 1] != 0xC9) { z->c = z->l - v_9; goto lab8; }
664 : 0 : z->c--;
665 : 0 : z->bra = z->c;
666 : : {
667 : 0 : int ret = slice_del(z);
668 [ # # ]: 0 : if (ret < 0) return ret;
669 [ # # ]: 0 : }
670 : : lab8:
671 : : ;
672 [ # # ]: 0 : }
673 : : {
674 : 0 : int v_10 = z->l - z->c;
675 : : {
676 : 0 : int ret = r_derivational(z);
677 [ # # ]: 0 : if (ret < 0) return ret;
678 [ # # ]: 0 : }
679 : 0 : z->c = z->l - v_10;
680 [ # # ]: 0 : }
681 : : {
682 : 0 : int v_11 = z->l - z->c;
683 : : {
684 : 0 : int ret = r_tidy_up(z);
685 [ # # ]: 0 : if (ret < 0) return ret;
686 [ # # ]: 0 : }
687 : 0 : z->c = z->l - v_11;
688 [ # # ]: 0 : }
689 : 0 : z->lb = v_4;
690 [ # # ]: 0 : }
691 : 0 : z->c = z->lb;
692 : 0 : return 1;
693 : 0 : }
694 : :
695 : 0 : extern struct SN_env * russian_KOI8_R_create_env(void) {
696 : 0 : struct SN_env * z = SN_new_env(sizeof(SN_local));
697 [ # # ]: 0 : if (z) {
698 : 0 : ((SN_local *)z)->i_p2 = 0;
699 : 0 : ((SN_local *)z)->i_pV = 0;
700 : 0 : }
701 : 0 : return z;
702 : 0 : }
703 : :
704 : 0 : extern void russian_KOI8_R_close_env(struct SN_env * z) {
705 : 0 : SN_delete_env(z);
706 : 0 : }
707 : :
|