languages/danish.cc

Go to the documentation of this file.
00001 /* This file was generated automatically by the Snowball to ISO C++ compiler */
00002 
00003 #include <limits.h>
00004 #include "danish.h"
00005 
00006 static const symbol s_pool[] = {
00007 #define s_0_0 0
00008 'h', 'e', 'd',
00009 #define s_0_1 3
00010 'e', 't', 'h', 'e', 'd',
00011 #define s_0_2 8
00012 'e', 'r', 'e', 'd',
00013 #define s_0_3 12
00014 'e',
00015 #define s_0_4 13
00016 'e', 'r', 'e', 'd', 'e',
00017 #define s_0_5 18
00018 'e', 'n', 'd', 'e',
00019 #define s_0_6 22
00020 'e', 'r', 'e', 'n', 'd', 'e',
00021 #define s_0_7 28
00022 'e', 'n', 'e',
00023 #define s_0_8 31
00024 'e', 'r', 'n', 'e',
00025 #define s_0_9 35
00026 'e', 'r', 'e',
00027 #define s_0_10 38
00028 'e', 'n',
00029 #define s_0_11 40
00030 'h', 'e', 'd', 'e', 'n',
00031 #define s_0_12 45
00032 'e', 'r', 'e', 'n',
00033 #define s_0_13 49
00034 'e', 'r',
00035 #define s_0_14 51
00036 'h', 'e', 'd', 'e', 'r',
00037 #define s_0_15 56
00038 'e', 'r', 'e', 'r',
00039 #define s_0_16 60
00040 's',
00041 #define s_0_17 61
00042 'h', 'e', 'd', 's',
00043 #define s_0_18 65
00044 'e', 's',
00045 #define s_0_19 67
00046 'e', 'n', 'd', 'e', 's',
00047 #define s_0_20 72
00048 'e', 'r', 'e', 'n', 'd', 'e', 's',
00049 #define s_0_21 79
00050 'e', 'n', 'e', 's',
00051 #define s_0_22 83
00052 'e', 'r', 'n', 'e', 's',
00053 #define s_0_23 88
00054 'e', 'r', 'e', 's',
00055 #define s_0_24 92
00056 'e', 'n', 's',
00057 #define s_0_25 95
00058 'h', 'e', 'd', 'e', 'n', 's',
00059 #define s_0_26 101
00060 'e', 'r', 'e', 'n', 's',
00061 #define s_0_27 106
00062 'e', 'r', 's',
00063 #define s_0_28 109
00064 'e', 't', 's',
00065 #define s_0_29 112
00066 'e', 'r', 'e', 't', 's',
00067 #define s_0_30 117
00068 'e', 't',
00069 #define s_0_31 119
00070 'e', 'r', 'e', 't',
00071 #define s_1_0 123
00072 'g', 'd',
00073 #define s_1_1 125
00074 'd', 't',
00075 #define s_1_2 127
00076 'g', 't',
00077 #define s_1_3 129
00078 'k', 't',
00079 #define s_2_0 131
00080 'i', 'g',
00081 #define s_2_1 133
00082 'l', 'i', 'g',
00083 #define s_2_2 136
00084 'e', 'l', 'i', 'g',
00085 #define s_2_3 140
00086 'e', 'l', 's',
00087 #define s_2_4 143
00088 'l', 0xC3, 0xB8, 's', 't',
00089 };
00090 
00091 
00092 static const struct among a_0[32] =
00093 {
00094 /*  0 */ { 3, s_0_0, -1, 1},
00095 /*  1 */ { 5, s_0_1, 0, 1},
00096 /*  2 */ { 4, s_0_2, -1, 1},
00097 /*  3 */ { 1, s_0_3, -1, 1},
00098 /*  4 */ { 5, s_0_4, 3, 1},
00099 /*  5 */ { 4, s_0_5, 3, 1},
00100 /*  6 */ { 6, s_0_6, 5, 1},
00101 /*  7 */ { 3, s_0_7, 3, 1},
00102 /*  8 */ { 4, s_0_8, 3, 1},
00103 /*  9 */ { 3, s_0_9, 3, 1},
00104 /* 10 */ { 2, s_0_10, -1, 1},
00105 /* 11 */ { 5, s_0_11, 10, 1},
00106 /* 12 */ { 4, s_0_12, 10, 1},
00107 /* 13 */ { 2, s_0_13, -1, 1},
00108 /* 14 */ { 5, s_0_14, 13, 1},
00109 /* 15 */ { 4, s_0_15, 13, 1},
00110 /* 16 */ { 1, s_0_16, -1, 2},
00111 /* 17 */ { 4, s_0_17, 16, 1},
00112 /* 18 */ { 2, s_0_18, 16, 1},
00113 /* 19 */ { 5, s_0_19, 18, 1},
00114 /* 20 */ { 7, s_0_20, 19, 1},
00115 /* 21 */ { 4, s_0_21, 18, 1},
00116 /* 22 */ { 5, s_0_22, 18, 1},
00117 /* 23 */ { 4, s_0_23, 18, 1},
00118 /* 24 */ { 3, s_0_24, 16, 1},
00119 /* 25 */ { 6, s_0_25, 24, 1},
00120 /* 26 */ { 5, s_0_26, 24, 1},
00121 /* 27 */ { 3, s_0_27, 16, 1},
00122 /* 28 */ { 3, s_0_28, 16, 1},
00123 /* 29 */ { 5, s_0_29, 28, 1},
00124 /* 30 */ { 2, s_0_30, -1, 1},
00125 /* 31 */ { 4, s_0_31, 30, 1}
00126 };
00127 
00128 
00129 static const struct among a_1[4] =
00130 {
00131 /*  0 */ { 2, s_1_0, -1, -1},
00132 /*  1 */ { 2, s_1_1, -1, -1},
00133 /*  2 */ { 2, s_1_2, -1, -1},
00134 /*  3 */ { 2, s_1_3, -1, -1}
00135 };
00136 
00137 
00138 static const struct among a_2[5] =
00139 {
00140 /*  0 */ { 2, s_2_0, -1, 1},
00141 /*  1 */ { 3, s_2_1, 0, 1},
00142 /*  2 */ { 4, s_2_2, 1, 1},
00143 /*  3 */ { 3, s_2_3, -1, 1},
00144 /*  4 */ { 5, s_2_4, -1, 2}
00145 };
00146 
00147 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 };
00148 
00149 static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
00150 
00151 static const symbol s_0[] = { 's', 't' };
00152 static const symbol s_1[] = { 'i', 'g' };
00153 static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
00154 
00155 int Xapian::InternalStemDanish::r_mark_regions() { /* forwardmode */
00156     I_p1 = l; /* p1 = <integer expression>, line 31 */
00157     {   int c_test1 = c; /* test, line 33 */
00158         {   int ret = skip_utf8(p, c, 0, l, + 3); /* hop, line 33 */
00159             if (ret < 0) return 0;
00160             c = ret;
00161         }
00162         I_x = c; /* setmark x, line 33 */
00163         c = c_test1;
00164     }
00165     if (out_grouping_U(g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 34 */
00166     {   int ret = in_grouping_U(g_v, 97, 248, 1); /* gopast */ /* non v, line 34 */
00167         if (ret < 0) return 0;
00168         c += ret;
00169     }
00170     I_p1 = c; /* setmark p1, line 34 */
00171     /* try, line 35 */
00172     if (!(I_p1 < I_x)) goto lab0; /* p1 < <integer expression>, line 35 */
00173     I_p1 = I_x; /* p1 = <integer expression>, line 35 */
00174 lab0:
00175     return 1;
00176 }
00177 
00178 int Xapian::InternalStemDanish::r_main_suffix() { /* backwardmode */
00179     int among_var;
00180     {   int m1 = l - c; (void)m1; /* setlimit, line 41 */
00181         int mlimit1;
00182         if (c < I_p1) return 0;
00183         c = I_p1; /* tomark, line 41 */
00184         mlimit1 = lb; lb = c;
00185         c = l - m1;
00186         ket = c; /* [, line 41 */
00187         if (c <= lb || p[c - 1] >> 5 != 3 || !((1851440 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit1; return 0; } /* substring, line 41 */
00188         among_var = find_among_b(s_pool, a_0, 32, 0, 0);
00189         if (!(among_var)) { lb = mlimit1; return 0; }
00190         bra = c; /* ], line 41 */
00191         lb = mlimit1;
00192     }
00193     switch(among_var) { /* among, line 42 */
00194         case 0: return 0;
00195         case 1:
00196             if (slice_del() == -1) return -1; /* delete, line 48 */
00197             break;
00198         case 2:
00199             if (in_grouping_b_U(g_s_ending, 97, 229, 0)) return 0; /* grouping s_ending, line 50 */
00200             if (slice_del() == -1) return -1; /* delete, line 50 */
00201             break;
00202     }
00203     return 1;
00204 }
00205 
00206 int Xapian::InternalStemDanish::r_consonant_pair() { /* backwardmode */
00207     {   int m_test1 = l - c; /* test, line 55 */
00208         {   int m2 = l - c; (void)m2; /* setlimit, line 56 */
00209             int mlimit2;
00210             if (c < I_p1) return 0;
00211             c = I_p1; /* tomark, line 56 */
00212             mlimit2 = lb; lb = c;
00213             c = l - m2;
00214             ket = c; /* [, line 56 */
00215             if (c - 1 <= lb || (p[c - 1] != 100 && p[c - 1] != 116)) { lb = mlimit2; return 0; } /* substring, line 56 */
00216             if (!(find_among_b(s_pool, a_1, 4, 0, 0))) { lb = mlimit2; return 0; }
00217             bra = c; /* ], line 56 */
00218             lb = mlimit2;
00219         }
00220         c = l - m_test1;
00221     }
00222     {   int ret = skip_utf8(p, c, lb, 0, -1);
00223         if (ret < 0) return 0;
00224         c = ret; /* next, line 62 */
00225     }
00226     bra = c; /* ], line 62 */
00227     if (slice_del() == -1) return -1; /* delete, line 62 */
00228     return 1;
00229 }
00230 
00231 int Xapian::InternalStemDanish::r_other_suffix() { /* backwardmode */
00232     int among_var;
00233     {   int m1 = l - c; (void)m1; /* do, line 66 */
00234         ket = c; /* [, line 66 */
00235         if (!(eq_s_b(2, s_0))) goto lab0; /* literal, line 66 */
00236         bra = c; /* ], line 66 */
00237         if (!(eq_s_b(2, s_1))) goto lab0; /* literal, line 66 */
00238         if (slice_del() == -1) return -1; /* delete, line 66 */
00239     lab0:
00240         c = l - m1;
00241     }
00242     {   int m2 = l - c; (void)m2; /* setlimit, line 67 */
00243         int mlimit2;
00244         if (c < I_p1) return 0;
00245         c = I_p1; /* tomark, line 67 */
00246         mlimit2 = lb; lb = c;
00247         c = l - m2;
00248         ket = c; /* [, line 67 */
00249         if (c - 1 <= lb || p[c - 1] >> 5 != 3 || !((1572992 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit2; return 0; } /* substring, line 67 */
00250         among_var = find_among_b(s_pool, a_2, 5, 0, 0);
00251         if (!(among_var)) { lb = mlimit2; return 0; }
00252         bra = c; /* ], line 67 */
00253         lb = mlimit2;
00254     }
00255     switch(among_var) { /* among, line 68 */
00256         case 0: return 0;
00257         case 1:
00258             if (slice_del() == -1) return -1; /* delete, line 70 */
00259             {   int m3 = l - c; (void)m3; /* do, line 70 */
00260                 {   int ret = r_consonant_pair(); /* call consonant_pair, line 70 */
00261                     if (ret == 0) goto lab1;
00262                     if (ret < 0) return ret;
00263                 }
00264             lab1:
00265                 c = l - m3;
00266             }
00267             break;
00268         case 2:
00269             {   int ret = slice_from_s(4, s_2); /* <-, line 72 */
00270                 if (ret < 0) return ret;
00271             }
00272             break;
00273     }
00274     return 1;
00275 }
00276 
00277 int Xapian::InternalStemDanish::r_undouble() { /* backwardmode */
00278     {   int m1 = l - c; (void)m1; /* setlimit, line 76 */
00279         int mlimit1;
00280         if (c < I_p1) return 0;
00281         c = I_p1; /* tomark, line 76 */
00282         mlimit1 = lb; lb = c;
00283         c = l - m1;
00284         ket = c; /* [, line 76 */
00285         if (out_grouping_b_U(g_v, 97, 248, 0)) { lb = mlimit1; return 0; } /* non v, line 76 */
00286         bra = c; /* ], line 76 */
00287         {   symbol * ret = slice_to(S_ch); /* -> ch, line 76 */
00288             if (ret == 0) return -1;
00289             S_ch = ret;
00290         }
00291         lb = mlimit1;
00292     }
00293     if (!(eq_v_b(S_ch))) return 0; /* name ch, line 77 */
00294     if (slice_del() == -1) return -1; /* delete, line 78 */
00295     return 1;
00296 }
00297 
00298 int Xapian::InternalStemDanish::stem() { /* forwardmode */
00299     {   int c1 = c; /* do, line 84 */
00300         {   int ret = r_mark_regions(); /* call mark_regions, line 84 */
00301             if (ret == 0) goto lab0;
00302             if (ret < 0) return ret;
00303         }
00304     lab0:
00305         c = c1;
00306     }
00307     lb = c; c = l; /* backwards, line 85 */
00308 
00309     {   int m2 = l - c; (void)m2; /* do, line 86 */
00310         {   int ret = r_main_suffix(); /* call main_suffix, line 86 */
00311             if (ret == 0) goto lab1;
00312             if (ret < 0) return ret;
00313         }
00314     lab1:
00315         c = l - m2;
00316     }
00317     {   int m3 = l - c; (void)m3; /* do, line 87 */
00318         {   int ret = r_consonant_pair(); /* call consonant_pair, line 87 */
00319             if (ret == 0) goto lab2;
00320             if (ret < 0) return ret;
00321         }
00322     lab2:
00323         c = l - m3;
00324     }
00325     {   int m4 = l - c; (void)m4; /* do, line 88 */
00326         {   int ret = r_other_suffix(); /* call other_suffix, line 88 */
00327             if (ret == 0) goto lab3;
00328             if (ret < 0) return ret;
00329         }
00330     lab3:
00331         c = l - m4;
00332     }
00333     {   int m5 = l - c; (void)m5; /* do, line 89 */
00334         {   int ret = r_undouble(); /* call undouble, line 89 */
00335             if (ret == 0) goto lab4;
00336             if (ret < 0) return ret;
00337         }
00338     lab4:
00339         c = l - m5;
00340     }
00341     c = lb;
00342     return 1;
00343 }
00344 
00345 Xapian::InternalStemDanish::InternalStemDanish()
00346     : I_x(0), I_p1(0), S_ch(0)
00347 {
00348     S_ch = create_s();
00349 }
00350 
00351 Xapian::InternalStemDanish::~InternalStemDanish()
00352 {
00353     lose_s(S_ch);
00354 }
00355 
00356 const char *
00357 Xapian::InternalStemDanish::get_description() const
00358 {
00359     return "danish";
00360 }

Documentation for Xapian (version 1.0.20).
Generated on 28 Apr 2010 by Doxygen 1.5.2.