xapian-core  2.1.0
danish.cc
Go to the documentation of this file.
1 /* Generated from danish.sbl by Snowball 3.1.1 - https://snowballstem.org/ */
2 
3 #include <config.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6 #include "danish.h"
7 
8 #include <stddef.h>
9 
11 
12 static int r_consonant_pair(struct SN_env * z);
13 
14 static const symbol s_0[] = { 's', 't' };
15 static const symbol s_1[] = { 'i', 'g' };
16 static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
17 
18 static const symbol s_0_0[3] = { 'h', 'e', 'd' };
19 static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
20 static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
21 static const symbol s_0_3[1] = { 'e' };
22 static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
23 static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
24 static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
25 static const symbol s_0_7[3] = { 'e', 'n', 'e' };
26 static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
27 static const symbol s_0_9[3] = { 'e', 'r', 'e' };
28 static const symbol s_0_10[2] = { 'e', 'n' };
29 static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
30 static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
31 static const symbol s_0_13[2] = { 'e', 'r' };
32 static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
33 static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
34 static const symbol s_0_16[1] = { 's' };
35 static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
36 static const symbol s_0_18[2] = { 'e', 's' };
37 static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
38 static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
39 static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
40 static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
41 static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
42 static const symbol s_0_24[3] = { 'e', 'n', 's' };
43 static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
44 static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
45 static const symbol s_0_27[3] = { 'e', 'r', 's' };
46 static const symbol s_0_28[3] = { 'e', 't', 's' };
47 static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
48 static const symbol s_0_30[2] = { 'e', 't' };
49 static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
50 static const struct among a_0[32] = {
51 { 3, s_0_0, 0, 1, 0},
52 { 5, s_0_1, -1, 1, 0},
53 { 4, s_0_2, 0, 1, 0},
54 { 1, s_0_3, 0, 1, 0},
55 { 5, s_0_4, -1, 1, 0},
56 { 4, s_0_5, -2, 1, 0},
57 { 6, s_0_6, -1, 1, 0},
58 { 3, s_0_7, -4, 1, 0},
59 { 4, s_0_8, -5, 1, 0},
60 { 3, s_0_9, -6, 1, 0},
61 { 2, s_0_10, 0, 1, 0},
62 { 5, s_0_11, -1, 1, 0},
63 { 4, s_0_12, -2, 1, 0},
64 { 2, s_0_13, 0, 1, 0},
65 { 5, s_0_14, -1, 1, 0},
66 { 4, s_0_15, -2, 1, 0},
67 { 1, s_0_16, 0, 2, 0},
68 { 4, s_0_17, -1, 1, 0},
69 { 2, s_0_18, -2, 1, 0},
70 { 5, s_0_19, -1, 1, 0},
71 { 7, s_0_20, -1, 1, 0},
72 { 4, s_0_21, -3, 1, 0},
73 { 5, s_0_22, -4, 1, 0},
74 { 4, s_0_23, -5, 1, 0},
75 { 3, s_0_24, -8, 1, 0},
76 { 6, s_0_25, -1, 1, 0},
77 { 5, s_0_26, -2, 1, 0},
78 { 3, s_0_27, -11, 1, 0},
79 { 3, s_0_28, -12, 1, 0},
80 { 5, s_0_29, -1, 1, 0},
81 { 2, s_0_30, 0, 1, 0},
82 { 4, s_0_31, -1, 1, 0}
83 };
84 
85 static const symbol s_1_0[2] = { 'g', 'd' };
86 static const symbol s_1_1[2] = { 'd', 't' };
87 static const symbol s_1_2[2] = { 'g', 't' };
88 static const symbol s_1_3[2] = { 'k', 't' };
89 static const struct among a_1[4] = {
90 { 2, s_1_0, 0, -1, 0},
91 { 2, s_1_1, 0, -1, 0},
92 { 2, s_1_2, 0, -1, 0},
93 { 2, s_1_3, 0, -1, 0}
94 };
95 
96 static const symbol s_2_0[2] = { 'i', 'g' };
97 static const symbol s_2_1[3] = { 'l', 'i', 'g' };
98 static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
99 static const symbol s_2_3[3] = { 'e', 'l', 's' };
100 static const symbol s_2_4[5] = { 'l', 0xC3, 0xB8, 's', 't' };
101 static const struct among a_2[5] = {
102 { 2, s_2_0, 0, 1, 0},
103 { 3, s_2_1, -1, 1, 0},
104 { 4, s_2_2, -1, 1, 0},
105 { 3, s_2_3, 0, 1, 0},
106 { 5, s_2_4, 0, 2, 0}
107 };
108 
109 static const unsigned char g_undouble_c[] = { 53, 94, 7 };
110 
111 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
112 
113 static const unsigned char g_s_ending[] = { 1, 0, 0, 0, 0, 0, 0, 188, 251, 171, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64 };
114 
115 static int r_consonant_pair(struct SN_env * z) {
116  {
117  int v_1 = z->l - z->c;
118  {
119  int v_2;
120  if (z->c < ((SN_local *)z)->i_p1) return 0;
121  v_2 = z->lb; z->lb = ((SN_local *)z)->i_p1;
122  z->ket = z->c;
123  if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = v_2; return 0; }
124  if (!find_among_b(z, a_1, 4, 0)) { z->lb = v_2; return 0; }
125  z->bra = z->c;
126  z->lb = v_2;
127  }
128  z->c = z->l - v_1;
129  }
130  {
131  int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
132  if (ret < 0) return 0;
133  z->c = ret;
134  }
135  z->bra = z->c;
136  slice_del(z);
137  return 1;
138 }
139 
141  int among_var;
142  ((SN_local *)z)->i_p1 = z->l;
143  {
144  int v_1 = z->c;
145  do {
146  int v_2 = z->c;
147  while (1) {
148  if (z->c == z->l || z->p[z->c] != '\'') goto lab2;
149  z->c++;
150  break;
151  lab2:
152  {
153  int ret = skip_utf8(z->p, z->c, z->l, 1);
154  if (ret < 0) goto lab1;
155  z->c = ret;
156  }
157  }
158  break;
159  lab1:
160  z->c = v_2;
161  {
162  int ret = out_grouping_U(z, g_v, 97, 248, 1);
163  if (ret < 0) goto lab0;
164  z->c += ret;
165  }
166  {
167  int ret = in_grouping_U(z, g_v, 97, 248, 1);
168  if (ret < 0) goto lab0;
169  z->c += ret;
170  }
171  } while (0);
172  ((SN_local *)z)->i_p1 = z->c;
173  lab0:
174  z->c = v_1;
175  }
176  {
177  int v_3 = z->c;
178  {
179  int ret = skip_utf8(z->p, z->c, z->l, 3);
180  if (ret < 0) return 0;
181  z->c = ret;
182  }
183  if (((SN_local *)z)->i_p1 >= z->c) goto lab3;
184  ((SN_local *)z)->i_p1 = z->c;
185  lab3:
186  z->c = v_3;
187  }
188  z->lb = z->c; z->c = z->l;
189  {
190  int v_4 = z->l - z->c;
191  {
192  int v_5;
193  if (z->c < ((SN_local *)z)->i_p1) goto lab4;
194  v_5 = z->lb; z->lb = ((SN_local *)z)->i_p1;
195  z->ket = z->c;
196  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_5; goto lab4; }
197  among_var = find_among_b(z, a_0, 32, 0);
198  if (!among_var) { z->lb = v_5; goto lab4; }
199  z->bra = z->c;
200  z->lb = v_5;
201  }
202  switch (among_var) {
203  case 1:
204  slice_del(z);
205  break;
206  case 2:
207  if (in_grouping_b_U(z, g_s_ending, 39, 229, 0)) goto lab4;
208  slice_del(z);
209  break;
210  }
211  lab4:
212  z->c = z->l - v_4;
213  }
214  {
215  int v_6 = z->l - z->c;
216  r_consonant_pair(z);
217  z->c = z->l - v_6;
218  }
219  {
220  int v_7 = z->l - z->c;
221  {
222  int v_8 = z->l - z->c;
223  z->ket = z->c;
224  if (!(eq_s_b(z, 2, s_0))) goto lab6;
225  z->bra = z->c;
226  if (!(eq_s_b(z, 2, s_1))) goto lab6;
227  slice_del(z);
228  lab6:
229  z->c = z->l - v_8;
230  }
231  {
232  int v_9;
233  if (z->c < ((SN_local *)z)->i_p1) goto lab5;
234  v_9 = z->lb; z->lb = ((SN_local *)z)->i_p1;
235  z->ket = z->c;
236  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_9; goto lab5; }
237  among_var = find_among_b(z, a_2, 5, 0);
238  if (!among_var) { z->lb = v_9; goto lab5; }
239  z->bra = z->c;
240  z->lb = v_9;
241  }
242  switch (among_var) {
243  case 1:
244  slice_del(z);
245  {
246  int v_10 = z->l - z->c;
247  r_consonant_pair(z);
248  z->c = z->l - v_10;
249  }
250  break;
251  case 2:
252  slice_from_s(z, 4, s_2);
253  break;
254  }
255  lab5:
256  z->c = z->l - v_7;
257  }
258  {
259  int v_11 = z->l - z->c;
260  {
261  int v_12;
262  if (z->c < ((SN_local *)z)->i_p1) goto lab7;
263  v_12 = z->lb; z->lb = ((SN_local *)z)->i_p1;
264  z->ket = z->c;
265  if (in_grouping_b_U(z, g_undouble_c, 98, 116, 0)) { z->lb = v_12; goto lab7; }
266  z->bra = z->c;
267  slice_to(z, &((SN_local *)z)->s_ch);
268  z->lb = v_12;
269  }
270  if (!(eq_v_b(z, ((SN_local *)z)->s_ch))) goto lab7;
271  slice_del(z);
272  lab7:
273  z->c = z->l - v_11;
274  }
275  z->ket = z->c;
276  if (z->c <= z->lb || z->p[z->c - 1] != '\'') return 0;
277  z->c--;
278  z->bra = z->c;
279  slice_del(z);
280  z->c = z->lb;
281  return 1;
282 }
unsigned char symbol
Definition: api.h:4
static int stem(struct SN_env *z)
Definition: danish.cc:140
static const symbol s_0_24[3]
Definition: danish.cc:42
static const struct among a_2[5]
Definition: danish.cc:101
static const symbol s_0_2[4]
Definition: danish.cc:20
static const symbol s_2[]
Definition: danish.cc:16
static const symbol s_0_15[4]
Definition: danish.cc:33
Xapian::Internal::Snowball::Danish::SN_local SN_local
Definition: danish.cc:10
static const struct among a_0[32]
Definition: danish.cc:50
static const symbol s_0_13[2]
Definition: danish.cc:31
static const symbol s_0_20[7]
Definition: danish.cc:38
static const symbol s_1_2[2]
Definition: danish.cc:87
static const symbol s_0_14[5]
Definition: danish.cc:32
static int r_consonant_pair(struct SN_env *z)
Definition: danish.cc:115
static const symbol s_0_12[4]
Definition: danish.cc:30
static const symbol s_2_3[3]
Definition: danish.cc:99
static const symbol s_0_31[4]
Definition: danish.cc:49
static const symbol s_2_0[2]
Definition: danish.cc:96
static const struct among a_1[4]
Definition: danish.cc:89
static const symbol s_1_3[2]
Definition: danish.cc:88
static const symbol s_2_1[3]
Definition: danish.cc:97
static const symbol s_1_0[2]
Definition: danish.cc:85
static const symbol s_0_5[4]
Definition: danish.cc:23
static const symbol s_2_2[4]
Definition: danish.cc:98
static const symbol s_0_11[5]
Definition: danish.cc:29
static const symbol s_0_1[5]
Definition: danish.cc:19
static const unsigned char g_undouble_c[]
Definition: danish.cc:109
static const symbol s_0_30[2]
Definition: danish.cc:48
static const symbol s_2_4[5]
Definition: danish.cc:100
static const symbol s_0_17[4]
Definition: danish.cc:35
static const symbol s_1_1[2]
Definition: danish.cc:86
static const symbol s_0_0[3]
Definition: danish.cc:18
static const symbol s_0_19[5]
Definition: danish.cc:37
static const symbol s_0_18[2]
Definition: danish.cc:36
static const symbol s_0_23[4]
Definition: danish.cc:41
static const symbol s_0_27[3]
Definition: danish.cc:45
static const symbol s_0_16[1]
Definition: danish.cc:34
static const symbol s_0_28[3]
Definition: danish.cc:46
static const symbol s_0_29[5]
Definition: danish.cc:47
static const symbol s_0_9[3]
Definition: danish.cc:27
static const symbol s_0_22[5]
Definition: danish.cc:40
static const symbol s_1[]
Definition: danish.cc:15
static const symbol s_0_3[1]
Definition: danish.cc:21
static const symbol s_0_6[6]
Definition: danish.cc:24
static const symbol s_0_8[4]
Definition: danish.cc:26
static const symbol s_0_25[6]
Definition: danish.cc:43
static const symbol s_0_7[3]
Definition: danish.cc:25
static const symbol s_0_26[5]
Definition: danish.cc:44
static const symbol s_0_10[2]
Definition: danish.cc:28
static const unsigned char g_v[]
Definition: danish.cc:111
static const unsigned char g_s_ending[]
Definition: danish.cc:113
static const symbol s_0_21[4]
Definition: danish.cc:39
static const symbol s_0[]
Definition: danish.cc:14
static const symbol s_0_4[5]
Definition: danish.cc:22
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)
int eq_v_b(struct SN_env *z, const symbol *p)
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
SNOWBALL_ERR slice_to(struct SN_env *z, symbol **p)
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
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 skip_utf8(const symbol *p, int c, int limit, int n)
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