tracker-0.16.2/src/libstemmer/stem_UTF_8_porter.c

No issues found

  1 /*
  2  * Copyright (c) 2001, Dr Martin Porter
  3  * All rights reserved.
  4  *
  5  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  6  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  7  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  8  * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  9  *
 10  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 11  */
 12 
 13 
 14 
 15 /* This file was generated automatically by the Snowball to ANSI C compiler */
 16 
 17 #include "header.h"
 18 
 19 extern int porter_UTF_8_stem(struct SN_env * z);
 20 static int r_Step_5b(struct SN_env * z);
 21 static int r_Step_5a(struct SN_env * z);
 22 static int r_Step_4(struct SN_env * z);
 23 static int r_Step_3(struct SN_env * z);
 24 static int r_Step_2(struct SN_env * z);
 25 static int r_Step_1c(struct SN_env * z);
 26 static int r_Step_1b(struct SN_env * z);
 27 static int r_Step_1a(struct SN_env * z);
 28 static int r_R2(struct SN_env * z);
 29 static int r_R1(struct SN_env * z);
 30 static int r_shortv(struct SN_env * z);
 31 
 32 extern struct SN_env * porter_UTF_8_create_env(void);
 33 extern void porter_UTF_8_close_env(struct SN_env * z);
 34 
 35 static symbol s_0_0[1] = { 's' };
 36 static symbol s_0_1[3] = { 'i', 'e', 's' };
 37 static symbol s_0_2[4] = { 's', 's', 'e', 's' };
 38 static symbol s_0_3[2] = { 's', 's' };
 39 
 40 static struct among a_0[4] =
 41 {
 42 /*  0 */ { 1, s_0_0, -1, 3, 0},
 43 /*  1 */ { 3, s_0_1, 0, 2, 0},
 44 /*  2 */ { 4, s_0_2, 0, 1, 0},
 45 /*  3 */ { 2, s_0_3, 0, -1, 0}
 46 };
 47 
 48 static symbol s_1_1[2] = { 'b', 'b' };
 49 static symbol s_1_2[2] = { 'd', 'd' };
 50 static symbol s_1_3[2] = { 'f', 'f' };
 51 static symbol s_1_4[2] = { 'g', 'g' };
 52 static symbol s_1_5[2] = { 'b', 'l' };
 53 static symbol s_1_6[2] = { 'm', 'm' };
 54 static symbol s_1_7[2] = { 'n', 'n' };
 55 static symbol s_1_8[2] = { 'p', 'p' };
 56 static symbol s_1_9[2] = { 'r', 'r' };
 57 static symbol s_1_10[2] = { 'a', 't' };
 58 static symbol s_1_11[2] = { 't', 't' };
 59 static symbol s_1_12[2] = { 'i', 'z' };
 60 
 61 static struct among a_1[13] =
 62 {
 63 /*  0 */ { 0, 0, -1, 3, 0},
 64 /*  1 */ { 2, s_1_1, 0, 2, 0},
 65 /*  2 */ { 2, s_1_2, 0, 2, 0},
 66 /*  3 */ { 2, s_1_3, 0, 2, 0},
 67 /*  4 */ { 2, s_1_4, 0, 2, 0},
 68 /*  5 */ { 2, s_1_5, 0, 1, 0},
 69 /*  6 */ { 2, s_1_6, 0, 2, 0},
 70 /*  7 */ { 2, s_1_7, 0, 2, 0},
 71 /*  8 */ { 2, s_1_8, 0, 2, 0},
 72 /*  9 */ { 2, s_1_9, 0, 2, 0},
 73 /* 10 */ { 2, s_1_10, 0, 1, 0},
 74 /* 11 */ { 2, s_1_11, 0, 2, 0},
 75 /* 12 */ { 2, s_1_12, 0, 1, 0}
 76 };
 77 
 78 static symbol s_2_0[2] = { 'e', 'd' };
 79 static symbol s_2_1[3] = { 'e', 'e', 'd' };
 80 static symbol s_2_2[3] = { 'i', 'n', 'g' };
 81 
 82 static struct among a_2[3] =
 83 {
 84 /*  0 */ { 2, s_2_0, -1, 2, 0},
 85 /*  1 */ { 3, s_2_1, 0, 1, 0},
 86 /*  2 */ { 3, s_2_2, -1, 2, 0}
 87 };
 88 
 89 static symbol s_3_0[4] = { 'a', 'n', 'c', 'i' };
 90 static symbol s_3_1[4] = { 'e', 'n', 'c', 'i' };
 91 static symbol s_3_2[4] = { 'a', 'b', 'l', 'i' };
 92 static symbol s_3_3[3] = { 'e', 'l', 'i' };
 93 static symbol s_3_4[4] = { 'a', 'l', 'l', 'i' };
 94 static symbol s_3_5[5] = { 'o', 'u', 's', 'l', 'i' };
 95 static symbol s_3_6[5] = { 'e', 'n', 't', 'l', 'i' };
 96 static symbol s_3_7[5] = { 'a', 'l', 'i', 't', 'i' };
 97 static symbol s_3_8[6] = { 'b', 'i', 'l', 'i', 't', 'i' };
 98 static symbol s_3_9[5] = { 'i', 'v', 'i', 't', 'i' };
 99 static symbol s_3_10[6] = { 't', 'i', 'o', 'n', 'a', 'l' };
100 static symbol s_3_11[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' };
101 static symbol s_3_12[5] = { 'a', 'l', 'i', 's', 'm' };
102 static symbol s_3_13[5] = { 'a', 't', 'i', 'o', 'n' };
103 static symbol s_3_14[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' };
104 static symbol s_3_15[4] = { 'i', 'z', 'e', 'r' };
105 static symbol s_3_16[4] = { 'a', 't', 'o', 'r' };
106 static symbol s_3_17[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' };
107 static symbol s_3_18[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' };
108 static symbol s_3_19[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' };
109 
110 static struct among a_3[20] =
111 {
112 /*  0 */ { 4, s_3_0, -1, 3, 0},
113 /*  1 */ { 4, s_3_1, -1, 2, 0},
114 /*  2 */ { 4, s_3_2, -1, 4, 0},
115 /*  3 */ { 3, s_3_3, -1, 6, 0},
116 /*  4 */ { 4, s_3_4, -1, 9, 0},
117 /*  5 */ { 5, s_3_5, -1, 12, 0},
118 /*  6 */ { 5, s_3_6, -1, 5, 0},
119 /*  7 */ { 5, s_3_7, -1, 10, 0},
120 /*  8 */ { 6, s_3_8, -1, 14, 0},
121 /*  9 */ { 5, s_3_9, -1, 13, 0},
122 /* 10 */ { 6, s_3_10, -1, 1, 0},
123 /* 11 */ { 7, s_3_11, 10, 8, 0},
124 /* 12 */ { 5, s_3_12, -1, 10, 0},
125 /* 13 */ { 5, s_3_13, -1, 8, 0},
126 /* 14 */ { 7, s_3_14, 13, 7, 0},
127 /* 15 */ { 4, s_3_15, -1, 7, 0},
128 /* 16 */ { 4, s_3_16, -1, 8, 0},
129 /* 17 */ { 7, s_3_17, -1, 13, 0},
130 /* 18 */ { 7, s_3_18, -1, 11, 0},
131 /* 19 */ { 7, s_3_19, -1, 12, 0}
132 };
133 
134 static symbol s_4_0[5] = { 'i', 'c', 'a', 't', 'e' };
135 static symbol s_4_1[5] = { 'a', 't', 'i', 'v', 'e' };
136 static symbol s_4_2[5] = { 'a', 'l', 'i', 'z', 'e' };
137 static symbol s_4_3[5] = { 'i', 'c', 'i', 't', 'i' };
138 static symbol s_4_4[4] = { 'i', 'c', 'a', 'l' };
139 static symbol s_4_5[3] = { 'f', 'u', 'l' };
140 static symbol s_4_6[4] = { 'n', 'e', 's', 's' };
141 
142 static struct among a_4[7] =
143 {
144 /*  0 */ { 5, s_4_0, -1, 2, 0},
145 /*  1 */ { 5, s_4_1, -1, 3, 0},
146 /*  2 */ { 5, s_4_2, -1, 1, 0},
147 /*  3 */ { 5, s_4_3, -1, 2, 0},
148 /*  4 */ { 4, s_4_4, -1, 2, 0},
149 /*  5 */ { 3, s_4_5, -1, 3, 0},
150 /*  6 */ { 4, s_4_6, -1, 3, 0}
151 };
152 
153 static symbol s_5_0[2] = { 'i', 'c' };
154 static symbol s_5_1[4] = { 'a', 'n', 'c', 'e' };
155 static symbol s_5_2[4] = { 'e', 'n', 'c', 'e' };
156 static symbol s_5_3[4] = { 'a', 'b', 'l', 'e' };
157 static symbol s_5_4[4] = { 'i', 'b', 'l', 'e' };
158 static symbol s_5_5[3] = { 'a', 't', 'e' };
159 static symbol s_5_6[3] = { 'i', 'v', 'e' };
160 static symbol s_5_7[3] = { 'i', 'z', 'e' };
161 static symbol s_5_8[3] = { 'i', 't', 'i' };
162 static symbol s_5_9[2] = { 'a', 'l' };
163 static symbol s_5_10[3] = { 'i', 's', 'm' };
164 static symbol s_5_11[3] = { 'i', 'o', 'n' };
165 static symbol s_5_12[2] = { 'e', 'r' };
166 static symbol s_5_13[3] = { 'o', 'u', 's' };
167 static symbol s_5_14[3] = { 'a', 'n', 't' };
168 static symbol s_5_15[3] = { 'e', 'n', 't' };
169 static symbol s_5_16[4] = { 'm', 'e', 'n', 't' };
170 static symbol s_5_17[5] = { 'e', 'm', 'e', 'n', 't' };
171 static symbol s_5_18[2] = { 'o', 'u' };
172 
173 static struct among a_5[19] =
174 {
175 /*  0 */ { 2, s_5_0, -1, 1, 0},
176 /*  1 */ { 4, s_5_1, -1, 1, 0},
177 /*  2 */ { 4, s_5_2, -1, 1, 0},
178 /*  3 */ { 4, s_5_3, -1, 1, 0},
179 /*  4 */ { 4, s_5_4, -1, 1, 0},
180 /*  5 */ { 3, s_5_5, -1, 1, 0},
181 /*  6 */ { 3, s_5_6, -1, 1, 0},
182 /*  7 */ { 3, s_5_7, -1, 1, 0},
183 /*  8 */ { 3, s_5_8, -1, 1, 0},
184 /*  9 */ { 2, s_5_9, -1, 1, 0},
185 /* 10 */ { 3, s_5_10, -1, 1, 0},
186 /* 11 */ { 3, s_5_11, -1, 2, 0},
187 /* 12 */ { 2, s_5_12, -1, 1, 0},
188 /* 13 */ { 3, s_5_13, -1, 1, 0},
189 /* 14 */ { 3, s_5_14, -1, 1, 0},
190 /* 15 */ { 3, s_5_15, -1, 1, 0},
191 /* 16 */ { 4, s_5_16, 15, 1, 0},
192 /* 17 */ { 5, s_5_17, 16, 1, 0},
193 /* 18 */ { 2, s_5_18, -1, 1, 0}
194 };
195 
196 static unsigned char g_v[] = { 17, 65, 16, 1 };
197 
198 static unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 };
199 
200 static symbol s_0[] = { 's', 's' };
201 static symbol s_1[] = { 'i' };
202 static symbol s_2[] = { 'e', 'e' };
203 static symbol s_3[] = { 'e' };
204 static symbol s_4[] = { 'e' };
205 static symbol s_5[] = { 'y' };
206 static symbol s_6[] = { 'Y' };
207 static symbol s_7[] = { 'i' };
208 static symbol s_8[] = { 't', 'i', 'o', 'n' };
209 static symbol s_9[] = { 'e', 'n', 'c', 'e' };
210 static symbol s_10[] = { 'a', 'n', 'c', 'e' };
211 static symbol s_11[] = { 'a', 'b', 'l', 'e' };
212 static symbol s_12[] = { 'e', 'n', 't' };
213 static symbol s_13[] = { 'e' };
214 static symbol s_14[] = { 'i', 'z', 'e' };
215 static symbol s_15[] = { 'a', 't', 'e' };
216 static symbol s_16[] = { 'a', 'l' };
217 static symbol s_17[] = { 'a', 'l' };
218 static symbol s_18[] = { 'f', 'u', 'l' };
219 static symbol s_19[] = { 'o', 'u', 's' };
220 static symbol s_20[] = { 'i', 'v', 'e' };
221 static symbol s_21[] = { 'b', 'l', 'e' };
222 static symbol s_22[] = { 'a', 'l' };
223 static symbol s_23[] = { 'i', 'c' };
224 static symbol s_24[] = { 's' };
225 static symbol s_25[] = { 't' };
226 static symbol s_26[] = { 'e' };
227 static symbol s_27[] = { 'l' };
228 static symbol s_28[] = { 'l' };
229 static symbol s_29[] = { 'y' };
230 static symbol s_30[] = { 'Y' };
231 static symbol s_31[] = { 'y' };
232 static symbol s_32[] = { 'Y' };
233 static symbol s_33[] = { 'Y' };
234 static symbol s_34[] = { 'y' };
235 
236 static int r_shortv(struct SN_env * z) {
237     if (!(out_grouping_b_U(z, g_v_WXY, 89, 121))) return 0;
238     if (!(in_grouping_b_U(z, g_v, 97, 121))) return 0;
239     if (!(out_grouping_b_U(z, g_v, 97, 121))) return 0;
240     return 1;
241 }
242 
243 static int r_R1(struct SN_env * z) {
244     if (!(z->I[0] <= z->c)) return 0;
245     return 1;
246 }
247 
248 static int r_R2(struct SN_env * z) {
249     if (!(z->I[1] <= z->c)) return 0;
250     return 1;
251 }
252 
253 static int r_Step_1a(struct SN_env * z) {
254     int among_var;
255     z->ket = z->c; /* [, line 25 */
256     among_var = find_among_b(z, a_0, 4); /* substring, line 25 */
257     if (!(among_var)) return 0;
258     z->bra = z->c; /* ], line 25 */
259     switch(among_var) {
260 	case 0: return 0;
261 	case 1:
262 	    {	int ret;
263 		ret = slice_from_s(z, 2, s_0); /* <-, line 26 */
264 		if (ret < 0) return ret;
265 	    }
266 	    break;
267 	case 2:
268 	    {	int ret;
269 		ret = slice_from_s(z, 1, s_1); /* <-, line 27 */
270 		if (ret < 0) return ret;
271 	    }
272 	    break;
273 	case 3:
274 	    {	int ret;
275 		ret = slice_del(z); /* delete, line 29 */
276 		if (ret < 0) return ret;
277 	    }
278 	    break;
279     }
280     return 1;
281 }
282 
283 static int r_Step_1b(struct SN_env * z) {
284     int among_var;
285     z->ket = z->c; /* [, line 34 */
286     among_var = find_among_b(z, a_2, 3); /* substring, line 34 */
287     if (!(among_var)) return 0;
288     z->bra = z->c; /* ], line 34 */
289     switch(among_var) {
290 	case 0: return 0;
291 	case 1:
292 	    {	int ret = r_R1(z);
293 		if (ret == 0) return 0; /* call R1, line 35 */
294 		if (ret < 0) return ret;
295 	    }
296 	    {	int ret;
297 		ret = slice_from_s(z, 2, s_2); /* <-, line 35 */
298 		if (ret < 0) return ret;
299 	    }
300 	    break;
301 	case 2:
302 	    {	int m_test = z->l - z->c; /* test, line 38 */
303 		while(1) { /* gopast, line 38 */
304 		    if (!(in_grouping_b_U(z, g_v, 97, 121))) goto lab0;
305 		    break;
306 		lab0:
307 		    {	int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
308 			if (c < 0) return 0;
309 			z->c = c; /* gopast, line 38 */
310 		    }
311 		}
312 		z->c = z->l - m_test;
313 	    }
314 	    {	int ret;
315 		ret = slice_del(z); /* delete, line 38 */
316 		if (ret < 0) return ret;
317 	    }
318 	    {	int m_test = z->l - z->c; /* test, line 39 */
319 		among_var = find_among_b(z, a_1, 13); /* substring, line 39 */
320 		if (!(among_var)) return 0;
321 		z->c = z->l - m_test;
322 	    }
323 	    switch(among_var) {
324 		case 0: return 0;
325 		case 1:
326 		    {	int ret;
327 			{   int c = z->c;
328 			    ret = insert_s(z, z->c, z->c, 1, s_3); /* <+, line 41 */
329 			    z->c = c;
330 			}
331 			if (ret < 0) return ret;
332 		    }
333 		    break;
334 		case 2:
335 		    z->ket = z->c; /* [, line 44 */
336 		    {	int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
337 			if (c < 0) return 0;
338 			z->c = c; /* next, line 44 */
339 		    }
340 		    z->bra = z->c; /* ], line 44 */
341 		    {	int ret;
342 			ret = slice_del(z); /* delete, line 44 */
343 			if (ret < 0) return ret;
344 		    }
345 		    break;
346 		case 3:
347 		    if (z->c != z->I[0]) return 0; /* atmark, line 45 */
348 		    {	int m_test = z->l - z->c; /* test, line 45 */
349 			{   int ret = r_shortv(z);
350 			    if (ret == 0) return 0; /* call shortv, line 45 */
351 			    if (ret < 0) return ret;
352 			}
353 			z->c = z->l - m_test;
354 		    }
355 		    {	int ret;
356 			{   int c = z->c;
357 			    ret = insert_s(z, z->c, z->c, 1, s_4); /* <+, line 45 */
358 			    z->c = c;
359 			}
360 			if (ret < 0) return ret;
361 		    }
362 		    break;
363 	    }
364 	    break;
365     }
366     return 1;
367 }
368 
369 static int r_Step_1c(struct SN_env * z) {
370     z->ket = z->c; /* [, line 52 */
371     {	int m = z->l - z->c; (void) m; /* or, line 52 */
372 	if (!(eq_s_b(z, 1, s_5))) goto lab1;
373 	goto lab0;
374     lab1:
375 	z->c = z->l - m;
376 	if (!(eq_s_b(z, 1, s_6))) return 0;
377     }
378 lab0:
379     z->bra = z->c; /* ], line 52 */
380     while(1) { /* gopast, line 53 */
381 	if (!(in_grouping_b_U(z, g_v, 97, 121))) goto lab2;
382 	break;
383     lab2:
384 	{   int c = skip_utf8(z->p, z->c, z->lb, 0, -1);
385 	    if (c < 0) return 0;
386 	    z->c = c; /* gopast, line 53 */
387 	}
388     }
389     {	int ret;
390 	ret = slice_from_s(z, 1, s_7); /* <-, line 54 */
391 	if (ret < 0) return ret;
392     }
393     return 1;
394 }
395 
396 static int r_Step_2(struct SN_env * z) {
397     int among_var;
398     z->ket = z->c; /* [, line 58 */
399     among_var = find_among_b(z, a_3, 20); /* substring, line 58 */
400     if (!(among_var)) return 0;
401     z->bra = z->c; /* ], line 58 */
402     {	int ret = r_R1(z);
403 	if (ret == 0) return 0; /* call R1, line 58 */
404 	if (ret < 0) return ret;
405     }
406     switch(among_var) {
407 	case 0: return 0;
408 	case 1:
409 	    {	int ret;
410 		ret = slice_from_s(z, 4, s_8); /* <-, line 59 */
411 		if (ret < 0) return ret;
412 	    }
413 	    break;
414 	case 2:
415 	    {	int ret;
416 		ret = slice_from_s(z, 4, s_9); /* <-, line 60 */
417 		if (ret < 0) return ret;
418 	    }
419 	    break;
420 	case 3:
421 	    {	int ret;
422 		ret = slice_from_s(z, 4, s_10); /* <-, line 61 */
423 		if (ret < 0) return ret;
424 	    }
425 	    break;
426 	case 4:
427 	    {	int ret;
428 		ret = slice_from_s(z, 4, s_11); /* <-, line 62 */
429 		if (ret < 0) return ret;
430 	    }
431 	    break;
432 	case 5:
433 	    {	int ret;
434 		ret = slice_from_s(z, 3, s_12); /* <-, line 63 */
435 		if (ret < 0) return ret;
436 	    }
437 	    break;
438 	case 6:
439 	    {	int ret;
440 		ret = slice_from_s(z, 1, s_13); /* <-, line 64 */
441 		if (ret < 0) return ret;
442 	    }
443 	    break;
444 	case 7:
445 	    {	int ret;
446 		ret = slice_from_s(z, 3, s_14); /* <-, line 66 */
447 		if (ret < 0) return ret;
448 	    }
449 	    break;
450 	case 8:
451 	    {	int ret;
452 		ret = slice_from_s(z, 3, s_15); /* <-, line 68 */
453 		if (ret < 0) return ret;
454 	    }
455 	    break;
456 	case 9:
457 	    {	int ret;
458 		ret = slice_from_s(z, 2, s_16); /* <-, line 69 */
459 		if (ret < 0) return ret;
460 	    }
461 	    break;
462 	case 10:
463 	    {	int ret;
464 		ret = slice_from_s(z, 2, s_17); /* <-, line 71 */
465 		if (ret < 0) return ret;
466 	    }
467 	    break;
468 	case 11:
469 	    {	int ret;
470 		ret = slice_from_s(z, 3, s_18); /* <-, line 72 */
471 		if (ret < 0) return ret;
472 	    }
473 	    break;
474 	case 12:
475 	    {	int ret;
476 		ret = slice_from_s(z, 3, s_19); /* <-, line 74 */
477 		if (ret < 0) return ret;
478 	    }
479 	    break;
480 	case 13:
481 	    {	int ret;
482 		ret = slice_from_s(z, 3, s_20); /* <-, line 76 */
483 		if (ret < 0) return ret;
484 	    }
485 	    break;
486 	case 14:
487 	    {	int ret;
488 		ret = slice_from_s(z, 3, s_21); /* <-, line 77 */
489 		if (ret < 0) return ret;
490 	    }
491 	    break;
492     }
493     return 1;
494 }
495 
496 static int r_Step_3(struct SN_env * z) {
497     int among_var;
498     z->ket = z->c; /* [, line 82 */
499     among_var = find_among_b(z, a_4, 7); /* substring, line 82 */
500     if (!(among_var)) return 0;
501     z->bra = z->c; /* ], line 82 */
502     {	int ret = r_R1(z);
503 	if (ret == 0) return 0; /* call R1, line 82 */
504 	if (ret < 0) return ret;
505     }
506     switch(among_var) {
507 	case 0: return 0;
508 	case 1:
509 	    {	int ret;
510 		ret = slice_from_s(z, 2, s_22); /* <-, line 83 */
511 		if (ret < 0) return ret;
512 	    }
513 	    break;
514 	case 2:
515 	    {	int ret;
516 		ret = slice_from_s(z, 2, s_23); /* <-, line 85 */
517 		if (ret < 0) return ret;
518 	    }
519 	    break;
520 	case 3:
521 	    {	int ret;
522 		ret = slice_del(z); /* delete, line 87 */
523 		if (ret < 0) return ret;
524 	    }
525 	    break;
526     }
527     return 1;
528 }
529 
530 static int r_Step_4(struct SN_env * z) {
531     int among_var;
532     z->ket = z->c; /* [, line 92 */
533     among_var = find_among_b(z, a_5, 19); /* substring, line 92 */
534     if (!(among_var)) return 0;
535     z->bra = z->c; /* ], line 92 */
536     {	int ret = r_R2(z);
537 	if (ret == 0) return 0; /* call R2, line 92 */
538 	if (ret < 0) return ret;
539     }
540     switch(among_var) {
541 	case 0: return 0;
542 	case 1:
543 	    {	int ret;
544 		ret = slice_del(z); /* delete, line 95 */
545 		if (ret < 0) return ret;
546 	    }
547 	    break;
548 	case 2:
549 	    {	int m = z->l - z->c; (void) m; /* or, line 96 */
550 		if (!(eq_s_b(z, 1, s_24))) goto lab1;
551 		goto lab0;
552 	    lab1:
553 		z->c = z->l - m;
554 		if (!(eq_s_b(z, 1, s_25))) return 0;
555 	    }
556 	lab0:
557 	    {	int ret;
558 		ret = slice_del(z); /* delete, line 96 */
559 		if (ret < 0) return ret;
560 	    }
561 	    break;
562     }
563     return 1;
564 }
565 
566 static int r_Step_5a(struct SN_env * z) {
567     z->ket = z->c; /* [, line 101 */
568     if (!(eq_s_b(z, 1, s_26))) return 0;
569     z->bra = z->c; /* ], line 101 */
570     {	int m = z->l - z->c; (void) m; /* or, line 102 */
571 	{   int ret = r_R2(z);
572 	    if (ret == 0) goto lab1; /* call R2, line 102 */
573 	    if (ret < 0) return ret;
574 	}
575 	goto lab0;
576     lab1:
577 	z->c = z->l - m;
578 	{   int ret = r_R1(z);
579 	    if (ret == 0) return 0; /* call R1, line 102 */
580 	    if (ret < 0) return ret;
581 	}
582 	{   int m = z->l - z->c; (void) m; /* not, line 102 */
583 	    {	int ret = r_shortv(z);
584 		if (ret == 0) goto lab2; /* call shortv, line 102 */
585 		if (ret < 0) return ret;
586 	    }
587 	    return 0;
588 	lab2:
589 	    z->c = z->l - m;
590 	}
591     }
592 lab0:
593     {	int ret;
594 	ret = slice_del(z); /* delete, line 103 */
595 	if (ret < 0) return ret;
596     }
597     return 1;
598 }
599 
600 static int r_Step_5b(struct SN_env * z) {
601     z->ket = z->c; /* [, line 107 */
602     if (!(eq_s_b(z, 1, s_27))) return 0;
603     z->bra = z->c; /* ], line 107 */
604     {	int ret = r_R2(z);
605 	if (ret == 0) return 0; /* call R2, line 108 */
606 	if (ret < 0) return ret;
607     }
608     if (!(eq_s_b(z, 1, s_28))) return 0;
609     {	int ret;
610 	ret = slice_del(z); /* delete, line 109 */
611 	if (ret < 0) return ret;
612     }
613     return 1;
614 }
615 
616 extern int porter_UTF_8_stem(struct SN_env * z) {
617     z->B[0] = 0; /* unset Y_found, line 115 */
618     {	int c = z->c; /* do, line 116 */
619 	z->bra = z->c; /* [, line 116 */
620 	if (!(eq_s(z, 1, s_29))) goto lab0;
621 	z->ket = z->c; /* ], line 116 */
622 	{   int ret;
623 	    ret = slice_from_s(z, 1, s_30); /* <-, line 116 */
624 	    if (ret < 0) return ret;
625 	}
626 	z->B[0] = 1; /* set Y_found, line 116 */
627     lab0:
628 	z->c = c;
629     }
630     {	int c = z->c; /* do, line 117 */
631 	while(1) { /* repeat, line 117 */
632 	    int c = z->c;
633 	    while(1) { /* goto, line 117 */
634 		int c = z->c;
635 		if (!(in_grouping_U(z, g_v, 97, 121))) goto lab3;
636 		z->bra = z->c; /* [, line 117 */
637 		if (!(eq_s(z, 1, s_31))) goto lab3;
638 		z->ket = z->c; /* ], line 117 */
639 		z->c = c;
640 		break;
641 	    lab3:
642 		z->c = c;
643 		{   int c = skip_utf8(z->p, z->c, 0, z->l, 1);
644 		    if (c < 0) goto lab2;
645 		    z->c = c; /* goto, line 117 */
646 		}
647 	    }
648 	    {	int ret;
649 		ret = slice_from_s(z, 1, s_32); /* <-, line 117 */
650 		if (ret < 0) return ret;
651 	    }
652 	    z->B[0] = 1; /* set Y_found, line 117 */
653 	    continue;
654 	lab2:
655 	    z->c = c;
656 	    break;
657 	}
658 	z->c = c;
659     }
660     z->I[0] = z->l;
661     z->I[1] = z->l;
662     {	int c = z->c; /* do, line 121 */
663 	while(1) { /* gopast, line 122 */
664 	    if (!(in_grouping_U(z, g_v, 97, 121))) goto lab5;
665 	    break;
666 	lab5:
667 	    {	int c = skip_utf8(z->p, z->c, 0, z->l, 1);
668 		if (c < 0) goto lab4;
669 		z->c = c; /* gopast, line 122 */
670 	    }
671 	}
672 	while(1) { /* gopast, line 122 */
673 	    if (!(out_grouping_U(z, g_v, 97, 121))) goto lab6;
674 	    break;
675 	lab6:
676 	    {	int c = skip_utf8(z->p, z->c, 0, z->l, 1);
677 		if (c < 0) goto lab4;
678 		z->c = c; /* gopast, line 122 */
679 	    }
680 	}
681 	z->I[0] = z->c; /* setmark p1, line 122 */
682 	while(1) { /* gopast, line 123 */
683 	    if (!(in_grouping_U(z, g_v, 97, 121))) goto lab7;
684 	    break;
685 	lab7:
686 	    {	int c = skip_utf8(z->p, z->c, 0, z->l, 1);
687 		if (c < 0) goto lab4;
688 		z->c = c; /* gopast, line 123 */
689 	    }
690 	}
691 	while(1) { /* gopast, line 123 */
692 	    if (!(out_grouping_U(z, g_v, 97, 121))) goto lab8;
693 	    break;
694 	lab8:
695 	    {	int c = skip_utf8(z->p, z->c, 0, z->l, 1);
696 		if (c < 0) goto lab4;
697 		z->c = c; /* gopast, line 123 */
698 	    }
699 	}
700 	z->I[1] = z->c; /* setmark p2, line 123 */
701     lab4:
702 	z->c = c;
703     }
704     z->lb = z->c; z->c = z->l; /* backwards, line 126 */
705 
706     {	int m = z->l - z->c; (void) m; /* do, line 127 */
707 	{   int ret = r_Step_1a(z);
708 	    if (ret == 0) goto lab9; /* call Step_1a, line 127 */
709 	    if (ret < 0) return ret;
710 	}
711     lab9:
712 	z->c = z->l - m;
713     }
714     {	int m = z->l - z->c; (void) m; /* do, line 128 */
715 	{   int ret = r_Step_1b(z);
716 	    if (ret == 0) goto lab10; /* call Step_1b, line 128 */
717 	    if (ret < 0) return ret;
718 	}
719     lab10:
720 	z->c = z->l - m;
721     }
722     {	int m = z->l - z->c; (void) m; /* do, line 129 */
723 	{   int ret = r_Step_1c(z);
724 	    if (ret == 0) goto lab11; /* call Step_1c, line 129 */
725 	    if (ret < 0) return ret;
726 	}
727     lab11:
728 	z->c = z->l - m;
729     }
730     {	int m = z->l - z->c; (void) m; /* do, line 130 */
731 	{   int ret = r_Step_2(z);
732 	    if (ret == 0) goto lab12; /* call Step_2, line 130 */
733 	    if (ret < 0) return ret;
734 	}
735     lab12:
736 	z->c = z->l - m;
737     }
738     {	int m = z->l - z->c; (void) m; /* do, line 131 */
739 	{   int ret = r_Step_3(z);
740 	    if (ret == 0) goto lab13; /* call Step_3, line 131 */
741 	    if (ret < 0) return ret;
742 	}
743     lab13:
744 	z->c = z->l - m;
745     }
746     {	int m = z->l - z->c; (void) m; /* do, line 132 */
747 	{   int ret = r_Step_4(z);
748 	    if (ret == 0) goto lab14; /* call Step_4, line 132 */
749 	    if (ret < 0) return ret;
750 	}
751     lab14:
752 	z->c = z->l - m;
753     }
754     {	int m = z->l - z->c; (void) m; /* do, line 133 */
755 	{   int ret = r_Step_5a(z);
756 	    if (ret == 0) goto lab15; /* call Step_5a, line 133 */
757 	    if (ret < 0) return ret;
758 	}
759     lab15:
760 	z->c = z->l - m;
761     }
762     {	int m = z->l - z->c; (void) m; /* do, line 134 */
763 	{   int ret = r_Step_5b(z);
764 	    if (ret == 0) goto lab16; /* call Step_5b, line 134 */
765 	    if (ret < 0) return ret;
766 	}
767     lab16:
768 	z->c = z->l - m;
769     }
770     z->c = z->lb;
771     {	int c = z->c; /* do, line 137 */
772 	if (!(z->B[0])) goto lab17; /* Boolean test Y_found, line 137 */
773 	while(1) { /* repeat, line 137 */
774 	    int c = z->c;
775 	    while(1) { /* goto, line 137 */
776 		int c = z->c;
777 		z->bra = z->c; /* [, line 137 */
778 		if (!(eq_s(z, 1, s_33))) goto lab19;
779 		z->ket = z->c; /* ], line 137 */
780 		z->c = c;
781 		break;
782 	    lab19:
783 		z->c = c;
784 		{   int c = skip_utf8(z->p, z->c, 0, z->l, 1);
785 		    if (c < 0) goto lab18;
786 		    z->c = c; /* goto, line 137 */
787 		}
788 	    }
789 	    {	int ret;
790 		ret = slice_from_s(z, 1, s_34); /* <-, line 137 */
791 		if (ret < 0) return ret;
792 	    }
793 	    continue;
794 	lab18:
795 	    z->c = c;
796 	    break;
797 	}
798     lab17:
799 	z->c = c;
800     }
801     return 1;
802 }
803 
804 extern struct SN_env * porter_UTF_8_create_env(void) { return SN_create_env(0, 2, 1); }
805 
806 extern void porter_UTF_8_close_env(struct SN_env * z) { SN_close_env(z); }