xapian-core  2.1.0
dutch_porter.cc
Go to the documentation of this file.
1 /* Generated from dutch_porter.sbl by Snowball 3.1.1 - https://snowballstem.org/ */
2 
3 #include <config.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6 #include "dutch_porter.h"
7 
8 #include <stddef.h>
9 
11 
12 static int r_undouble(struct SN_env * z);
13 static int r_en_ending(struct SN_env * z);
14 static int r_e_ending(struct SN_env * z);
15 
16 static const symbol s_0[] = { 'g', 'e', 'm' };
17 static const symbol s_1[] = { 'a' };
18 static const symbol s_2[] = { 'e' };
19 static const symbol s_3[] = { 'i' };
20 static const symbol s_4[] = { 'o' };
21 static const symbol s_5[] = { 'u' };
22 static const symbol s_6[] = { 'Y' };
23 static const symbol s_7[] = { 'I' };
24 static const symbol s_8[] = { 'Y' };
25 static const symbol s_9[] = { 'h', 'e', 'i', 'd' };
26 static const symbol s_10[] = { 'h', 'e', 'i', 'd' };
27 static const symbol s_11[] = { 'e', 'n' };
28 static const symbol s_12[] = { 'i', 'g' };
29 static const symbol s_13[] = { 'y' };
30 static const symbol s_14[] = { 'i' };
31 
32 static const symbol s_0_1[2] = { 0xC3, 0xA1 };
33 static const symbol s_0_2[2] = { 0xC3, 0xA4 };
34 static const symbol s_0_3[2] = { 0xC3, 0xA9 };
35 static const symbol s_0_4[2] = { 0xC3, 0xAB };
36 static const symbol s_0_5[2] = { 0xC3, 0xAD };
37 static const symbol s_0_6[2] = { 0xC3, 0xAF };
38 static const symbol s_0_7[2] = { 0xC3, 0xB3 };
39 static const symbol s_0_8[2] = { 0xC3, 0xB6 };
40 static const symbol s_0_9[2] = { 0xC3, 0xBA };
41 static const symbol s_0_10[2] = { 0xC3, 0xBC };
42 static const struct among a_0[11] = {
43 { 0, 0, 0, 6, 0},
44 { 2, s_0_1, -1, 1, 0},
45 { 2, s_0_2, -2, 1, 0},
46 { 2, s_0_3, -3, 2, 0},
47 { 2, s_0_4, -4, 2, 0},
48 { 2, s_0_5, -5, 3, 0},
49 { 2, s_0_6, -6, 3, 0},
50 { 2, s_0_7, -7, 4, 0},
51 { 2, s_0_8, -8, 4, 0},
52 { 2, s_0_9, -9, 5, 0},
53 { 2, s_0_10, -10, 5, 0}
54 };
55 
56 static const symbol s_1_1[1] = { 'I' };
57 static const symbol s_1_2[1] = { 'Y' };
58 static const struct among a_1[3] = {
59 { 0, 0, 0, 3, 0},
60 { 1, s_1_1, -1, 2, 0},
61 { 1, s_1_2, -2, 1, 0}
62 };
63 
64 static const symbol s_2_0[2] = { 'd', 'd' };
65 static const symbol s_2_1[2] = { 'k', 'k' };
66 static const symbol s_2_2[2] = { 't', 't' };
67 static const struct among a_2[3] = {
68 { 2, s_2_0, 0, -1, 0},
69 { 2, s_2_1, 0, -1, 0},
70 { 2, s_2_2, 0, -1, 0}
71 };
72 
73 static const symbol s_3_0[3] = { 'e', 'n', 'e' };
74 static const symbol s_3_1[2] = { 's', 'e' };
75 static const symbol s_3_2[2] = { 'e', 'n' };
76 static const symbol s_3_3[5] = { 'h', 'e', 'd', 'e', 'n' };
77 static const symbol s_3_4[1] = { 's' };
78 static const struct among a_3[5] = {
79 { 3, s_3_0, 0, 2, 0},
80 { 2, s_3_1, 0, 3, 0},
81 { 2, s_3_2, 0, 2, 0},
82 { 5, s_3_3, -1, 1, 0},
83 { 1, s_3_4, 0, 3, 0}
84 };
85 
86 static const symbol s_4_0[3] = { 'e', 'n', 'd' };
87 static const symbol s_4_1[2] = { 'i', 'g' };
88 static const symbol s_4_2[3] = { 'i', 'n', 'g' };
89 static const symbol s_4_3[4] = { 'l', 'i', 'j', 'k' };
90 static const symbol s_4_4[4] = { 'b', 'a', 'a', 'r' };
91 static const symbol s_4_5[3] = { 'b', 'a', 'r' };
92 static const struct among a_4[6] = {
93 { 3, s_4_0, 0, 1, 0},
94 { 2, s_4_1, 0, 2, 0},
95 { 3, s_4_2, 0, 1, 0},
96 { 4, s_4_3, 0, 3, 0},
97 { 4, s_4_4, 0, 4, 0},
98 { 3, s_4_5, 0, 5, 0}
99 };
100 
101 static const symbol s_5_0[2] = { 'a', 'a' };
102 static const symbol s_5_1[2] = { 'e', 'e' };
103 static const symbol s_5_2[2] = { 'o', 'o' };
104 static const symbol s_5_3[2] = { 'u', 'u' };
105 static const struct among a_5[4] = {
106 { 2, s_5_0, 0, -1, 0},
107 { 2, s_5_1, 0, -1, 0},
108 { 2, s_5_2, 0, -1, 0},
109 { 2, s_5_3, 0, -1, 0}
110 };
111 
112 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 };
113 
114 static const unsigned char g_v_I[] = { 1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 };
115 
116 static const unsigned char g_v_j[] = { 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 };
117 
118 static int r_undouble(struct SN_env * z) {
119  {
120  int v_1 = z->l - z->c;
121  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1050640 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
122  if (!find_among_b(z, a_2, 3, 0)) return 0;
123  z->c = z->l - v_1;
124  }
125  z->ket = z->c;
126  {
127  int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
128  if (ret < 0) return 0;
129  z->c = ret;
130  }
131  z->bra = z->c;
132  slice_del(z);
133  return 1;
134 }
135 
136 static int r_e_ending(struct SN_env * z) {
137  ((SN_local *)z)->b_e_found = false;
138  z->ket = z->c;
139  if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0;
140  z->c--;
141  z->bra = z->c;
142  if (((SN_local *)z)->i_p1 > z->c) return 0;
143  {
144  int v_1 = z->l - z->c;
145  if (out_grouping_b_U(z, g_v, 97, 232, 0)) return 0;
146  z->c = z->l - v_1;
147  }
148  slice_del(z);
149  ((SN_local *)z)->b_e_found = true;
150  return r_undouble(z);
151 }
152 
153 static int r_en_ending(struct SN_env * z) {
154  if (((SN_local *)z)->i_p1 > z->c) return 0;
155  {
156  int v_1 = z->l - z->c;
157  if (out_grouping_b_U(z, g_v, 97, 232, 0)) return 0;
158  z->c = z->l - v_1;
159  if (!(eq_s_b(z, 3, s_0))) goto lab0;
160  return 0;
161  lab0:
162  ;
163  }
164  slice_del(z);
165  return r_undouble(z);
166 }
167 
169  int among_var;
170  int i_x;
171  int i_p2;
172  {
173  int v_1 = z->c;
174  {
175  int v_2 = z->c;
176  while (1) {
177  int v_3 = z->c;
178  z->bra = z->c;
179  if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 5 || !((340306450 >> (z->p[z->c + 1] & 0x1f)) & 1)) among_var = 6; else
180  among_var = find_among(z, a_0, 11, 0);
181  z->ket = z->c;
182  switch (among_var) {
183  case 1:
184  slice_from_s(z, 1, s_1);
185  break;
186  case 2:
187  slice_from_s(z, 1, s_2);
188  break;
189  case 3:
190  slice_from_s(z, 1, s_3);
191  break;
192  case 4:
193  slice_from_s(z, 1, s_4);
194  break;
195  case 5:
196  slice_from_s(z, 1, s_5);
197  break;
198  case 6:
199  {
200  int ret = skip_utf8(z->p, z->c, z->l, 1);
201  if (ret < 0) goto lab1;
202  z->c = ret;
203  }
204  break;
205  }
206  continue;
207  lab1:
208  z->c = v_3;
209  break;
210  }
211  z->c = v_2;
212  }
213  {
214  int v_4 = z->c;
215  z->bra = z->c;
216  if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_4; goto lab2; }
217  z->c++;
218  z->ket = z->c;
219  slice_from_s(z, 1, s_6);
220  lab2:
221  ;
222  }
223  while (1) {
224  int v_5 = z->c;
225  {
226  int ret = out_grouping_U(z, g_v, 97, 232, 1);
227  if (ret < 0) goto lab3;
228  z->c += ret;
229  }
230  {
231  int v_6 = z->c;
232  z->bra = z->c;
233  do {
234  int v_7 = z->c;
235  if (z->c == z->l || z->p[z->c] != 'i') goto lab5;
236  z->c++;
237  z->ket = z->c;
238  {
239  int v_8 = z->c;
240  if (in_grouping_U(z, g_v, 97, 232, 0)) goto lab6;
241  slice_from_s(z, 1, s_7);
242  lab6:
243  z->c = v_8;
244  }
245  break;
246  lab5:
247  z->c = v_7;
248  if (z->c == z->l || z->p[z->c] != 'y') { z->c = v_6; goto lab4; }
249  z->c++;
250  z->ket = z->c;
251  slice_from_s(z, 1, s_8);
252  } while (0);
253  lab4:
254  ;
255  }
256  continue;
257  lab3:
258  z->c = v_5;
259  break;
260  }
261  z->c = v_1;
262  }
263  {
264  int v_9 = z->c;
265  ((SN_local *)z)->i_p1 = z->l;
266  i_p2 = z->l;
267  {
268  int v_10 = z->c;
269  {
270  int ret = skip_utf8(z->p, z->c, z->l, 3);
271  if (ret < 0) goto lab7;
272  z->c = ret;
273  }
274  i_x = z->c;
275  z->c = v_10;
276  }
277  {
278  int ret = out_grouping_U(z, g_v, 97, 232, 1);
279  if (ret < 0) goto lab7;
280  z->c += ret;
281  }
282  {
283  int ret = in_grouping_U(z, g_v, 97, 232, 1);
284  if (ret < 0) goto lab7;
285  z->c += ret;
286  }
287  ((SN_local *)z)->i_p1 = z->c;
288  if (((SN_local *)z)->i_p1 >= i_x) goto lab8;
289  ((SN_local *)z)->i_p1 = i_x;
290  lab8:
291  {
292  int ret = out_grouping_U(z, g_v, 97, 232, 1);
293  if (ret < 0) goto lab7;
294  z->c += ret;
295  }
296  {
297  int ret = in_grouping_U(z, g_v, 97, 232, 1);
298  if (ret < 0) goto lab7;
299  z->c += ret;
300  }
301  i_p2 = z->c;
302  lab7:
303  z->c = v_9;
304  }
305  z->lb = z->c; z->c = z->l;
306  {
307  int v_11 = z->l - z->c;
308  z->ket = z->c;
309  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab10;
310  among_var = find_among_b(z, a_3, 5, 0);
311  if (!among_var) goto lab10;
312  z->bra = z->c;
313  switch (among_var) {
314  case 1:
315  if (((SN_local *)z)->i_p1 > z->c) goto lab10;
316  slice_from_s(z, 4, s_9);
317  break;
318  case 2:
319  if (!r_en_ending(z)) goto lab10;
320  break;
321  case 3:
322  if (((SN_local *)z)->i_p1 > z->c) goto lab10;
323  if (out_grouping_b_U(z, g_v_j, 97, 232, 0)) goto lab10;
324  slice_del(z);
325  break;
326  }
327  lab10:
328  z->c = z->l - v_11;
329  }
330  {
331  int v_12 = z->l - z->c;
332  r_e_ending(z);
333  z->c = z->l - v_12;
334  }
335  {
336  int v_13 = z->l - z->c;
337  z->ket = z->c;
338  if (!(eq_s_b(z, 4, s_10))) goto lab11;
339  z->bra = z->c;
340  if (i_p2 > z->c) goto lab11;
341  if (z->c <= z->lb || z->p[z->c - 1] != 'c') goto lab12;
342  z->c--;
343  goto lab11;
344  lab12:
345  slice_del(z);
346  z->ket = z->c;
347  if (!(eq_s_b(z, 2, s_11))) goto lab11;
348  z->bra = z->c;
349  if (!r_en_ending(z)) goto lab11;
350  lab11:
351  z->c = z->l - v_13;
352  }
353  {
354  int v_14 = z->l - z->c;
355  z->ket = z->c;
356  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((264336 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab13;
357  among_var = find_among_b(z, a_4, 6, 0);
358  if (!among_var) goto lab13;
359  z->bra = z->c;
360  switch (among_var) {
361  case 1:
362  if (i_p2 > z->c) goto lab13;
363  slice_del(z);
364  do {
365  int v_15 = z->l - z->c;
366  z->ket = z->c;
367  if (!(eq_s_b(z, 2, s_12))) goto lab14;
368  z->bra = z->c;
369  if (i_p2 > z->c) goto lab14;
370  if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab15;
371  z->c--;
372  goto lab14;
373  lab15:
374  slice_del(z);
375  break;
376  lab14:
377  z->c = z->l - v_15;
378  if (!r_undouble(z)) goto lab13;
379  } while (0);
380  break;
381  case 2:
382  if (i_p2 > z->c) goto lab13;
383  if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab16;
384  z->c--;
385  goto lab13;
386  lab16:
387  slice_del(z);
388  break;
389  case 3:
390  if (i_p2 > z->c) goto lab13;
391  slice_del(z);
392  if (!r_e_ending(z)) goto lab13;
393  break;
394  case 4:
395  if (i_p2 > z->c) goto lab13;
396  slice_del(z);
397  break;
398  case 5:
399  if (i_p2 > z->c) goto lab13;
400  if (!((SN_local *)z)->b_e_found) goto lab13;
401  slice_del(z);
402  break;
403  }
404  lab13:
405  z->c = z->l - v_14;
406  }
407  {
408  int v_16 = z->l - z->c;
409  if (out_grouping_b_U(z, g_v_I, 73, 232, 0)) goto lab17;
410  {
411  int v_17 = z->l - z->c;
412  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2129954 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab17;
413  if (!find_among_b(z, a_5, 4, 0)) goto lab17;
414  if (out_grouping_b_U(z, g_v, 97, 232, 0)) goto lab17;
415  z->c = z->l - v_17;
416  }
417  z->ket = z->c;
418  {
419  int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
420  if (ret < 0) goto lab17;
421  z->c = ret;
422  }
423  z->bra = z->c;
424  slice_del(z);
425  lab17:
426  z->c = z->l - v_16;
427  }
428  z->c = z->lb;
429  {
430  int v_18 = z->c;
431  while (1) {
432  int v_19 = z->c;
433  z->bra = z->c;
434  if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 89)) among_var = 3; else
435  among_var = find_among(z, a_1, 3, 0);
436  z->ket = z->c;
437  switch (among_var) {
438  case 1:
439  slice_from_s(z, 1, s_13);
440  break;
441  case 2:
442  slice_from_s(z, 1, s_14);
443  break;
444  case 3:
445  {
446  int ret = skip_utf8(z->p, z->c, z->l, 1);
447  if (ret < 0) goto lab19;
448  z->c = ret;
449  }
450  break;
451  }
452  continue;
453  lab19:
454  z->c = v_19;
455  break;
456  }
457  z->c = v_18;
458  }
459  return 1;
460 }
unsigned char symbol
Definition: api.h:4
static int stem(struct SN_env *z)
static const struct among a_5[4]
static const symbol s_2[]
Definition: dutch_porter.cc:18
static const symbol s_0_4[2]
Definition: dutch_porter.cc:35
static const symbol s_2_2[2]
Definition: dutch_porter.cc:66
static const symbol s_0_5[2]
Definition: dutch_porter.cc:36
static const symbol s_4[]
Definition: dutch_porter.cc:20
static const unsigned char g_v_I[]
static const unsigned char g_v_j[]
static const symbol s_0_8[2]
Definition: dutch_porter.cc:39
static const symbol s_5_3[2]
static const symbol s_4_3[4]
Definition: dutch_porter.cc:89
static const symbol s_3_1[2]
Definition: dutch_porter.cc:74
static const symbol s_5_0[2]
static const symbol s_0_1[2]
Definition: dutch_porter.cc:32
static int r_en_ending(struct SN_env *z)
static const symbol s_4_1[2]
Definition: dutch_porter.cc:87
static const symbol s_4_4[4]
Definition: dutch_porter.cc:90
static const symbol s_2_0[2]
Definition: dutch_porter.cc:64
static const struct among a_4[6]
Definition: dutch_porter.cc:92
static const symbol s_6[]
Definition: dutch_porter.cc:22
static const symbol s_3[]
Definition: dutch_porter.cc:19
static const symbol s_3_0[3]
Definition: dutch_porter.cc:73
static const symbol s_0_7[2]
Definition: dutch_porter.cc:38
static const symbol s_7[]
Definition: dutch_porter.cc:23
static const symbol s_13[]
Definition: dutch_porter.cc:29
static int r_undouble(struct SN_env *z)
static const symbol s_4_5[3]
Definition: dutch_porter.cc:91
Xapian::Internal::Snowball::DutchPorter::SN_local SN_local
Definition: dutch_porter.cc:10
static const symbol s_1_2[1]
Definition: dutch_porter.cc:57
static const symbol s_14[]
Definition: dutch_porter.cc:30
static const symbol s_10[]
Definition: dutch_porter.cc:26
static const symbol s_1_1[1]
Definition: dutch_porter.cc:56
static const struct among a_1[3]
Definition: dutch_porter.cc:58
static const symbol s_1[]
Definition: dutch_porter.cc:17
static const struct among a_2[3]
Definition: dutch_porter.cc:67
static const symbol s_5_2[2]
static const symbol s_3_3[5]
Definition: dutch_porter.cc:76
static const symbol s_11[]
Definition: dutch_porter.cc:27
static const symbol s_12[]
Definition: dutch_porter.cc:28
static const struct among a_0[11]
Definition: dutch_porter.cc:42
static const symbol s_0_6[2]
Definition: dutch_porter.cc:37
static const symbol s_3_4[1]
Definition: dutch_porter.cc:77
static const struct among a_3[5]
Definition: dutch_porter.cc:78
static const symbol s_5_1[2]
static int r_e_ending(struct SN_env *z)
static const symbol s_0_2[2]
Definition: dutch_porter.cc:33
static const symbol s_0_10[2]
Definition: dutch_porter.cc:41
static const symbol s_0_3[2]
Definition: dutch_porter.cc:34
static const symbol s_2_1[2]
Definition: dutch_porter.cc:65
static const unsigned char g_v[]
static const symbol s_8[]
Definition: dutch_porter.cc:24
static const symbol s_9[]
Definition: dutch_porter.cc:25
static const symbol s_0_9[2]
Definition: dutch_porter.cc:40
static const symbol s_3_2[2]
Definition: dutch_porter.cc:75
static const symbol s_5[]
Definition: dutch_porter.cc:21
static const symbol s_4_2[3]
Definition: dutch_porter.cc:88
static const symbol s_4_0[3]
Definition: dutch_porter.cc:86
static const symbol s_0[]
Definition: dutch_porter.cc:16
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
int skip_b_utf8(const symbol *p, int c, int limit, int n)
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
SNOWBALL_ERR slice_del(struct SN_env *z)
int out_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
int skip_utf8(const symbol *p, int c, int limit, int n)
int find_among(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
Definition: api.h:12
int lb
Definition: api.h:14
symbol * p
Definition: api.h:13
int ket
Definition: api.h:14
int c
Definition: api.h:14
int bra
Definition: api.h:14
int l
Definition: api.h:14
Definition: header.h:295