LCOV - code coverage report
Current view: top level - src/backend/snowball/libstemmer - stem_ISO_8859_1_danish.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 0 124 0.0 %
Date: 2019-11-21 13:06:38 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This file was generated automatically by the Snowball to ISO C compiler */
       2             : /* http://snowballstem.org/ */
       3             : 
       4             : #include "header.h"
       5             : 
       6             : #ifdef __cplusplus
       7             : extern "C" {
       8             : #endif
       9             : extern int danish_ISO_8859_1_stem(struct SN_env * z);
      10             : #ifdef __cplusplus
      11             : }
      12             : #endif
      13             : static int r_undouble(struct SN_env * z);
      14             : static int r_other_suffix(struct SN_env * z);
      15             : static int r_consonant_pair(struct SN_env * z);
      16             : static int r_main_suffix(struct SN_env * z);
      17             : static int r_mark_regions(struct SN_env * z);
      18             : #ifdef __cplusplus
      19             : extern "C" {
      20             : #endif
      21             : 
      22             : 
      23             : extern struct SN_env * danish_ISO_8859_1_create_env(void);
      24             : extern void danish_ISO_8859_1_close_env(struct SN_env * z);
      25             : 
      26             : 
      27             : #ifdef __cplusplus
      28             : }
      29             : #endif
      30             : static const symbol s_0_0[3] = { 'h', 'e', 'd' };
      31             : static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
      32             : static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
      33             : static const symbol s_0_3[1] = { 'e' };
      34             : static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
      35             : static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
      36             : static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
      37             : static const symbol s_0_7[3] = { 'e', 'n', 'e' };
      38             : static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
      39             : static const symbol s_0_9[3] = { 'e', 'r', 'e' };
      40             : static const symbol s_0_10[2] = { 'e', 'n' };
      41             : static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
      42             : static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
      43             : static const symbol s_0_13[2] = { 'e', 'r' };
      44             : static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
      45             : static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
      46             : static const symbol s_0_16[1] = { 's' };
      47             : static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
      48             : static const symbol s_0_18[2] = { 'e', 's' };
      49             : static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
      50             : static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
      51             : static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
      52             : static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
      53             : static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
      54             : static const symbol s_0_24[3] = { 'e', 'n', 's' };
      55             : static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
      56             : static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
      57             : static const symbol s_0_27[3] = { 'e', 'r', 's' };
      58             : static const symbol s_0_28[3] = { 'e', 't', 's' };
      59             : static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
      60             : static const symbol s_0_30[2] = { 'e', 't' };
      61             : static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
      62             : 
      63             : static const struct among a_0[32] =
      64             : {
      65             : /*  0 */ { 3, s_0_0, -1, 1, 0},
      66             : /*  1 */ { 5, s_0_1, 0, 1, 0},
      67             : /*  2 */ { 4, s_0_2, -1, 1, 0},
      68             : /*  3 */ { 1, s_0_3, -1, 1, 0},
      69             : /*  4 */ { 5, s_0_4, 3, 1, 0},
      70             : /*  5 */ { 4, s_0_5, 3, 1, 0},
      71             : /*  6 */ { 6, s_0_6, 5, 1, 0},
      72             : /*  7 */ { 3, s_0_7, 3, 1, 0},
      73             : /*  8 */ { 4, s_0_8, 3, 1, 0},
      74             : /*  9 */ { 3, s_0_9, 3, 1, 0},
      75             : /* 10 */ { 2, s_0_10, -1, 1, 0},
      76             : /* 11 */ { 5, s_0_11, 10, 1, 0},
      77             : /* 12 */ { 4, s_0_12, 10, 1, 0},
      78             : /* 13 */ { 2, s_0_13, -1, 1, 0},
      79             : /* 14 */ { 5, s_0_14, 13, 1, 0},
      80             : /* 15 */ { 4, s_0_15, 13, 1, 0},
      81             : /* 16 */ { 1, s_0_16, -1, 2, 0},
      82             : /* 17 */ { 4, s_0_17, 16, 1, 0},
      83             : /* 18 */ { 2, s_0_18, 16, 1, 0},
      84             : /* 19 */ { 5, s_0_19, 18, 1, 0},
      85             : /* 20 */ { 7, s_0_20, 19, 1, 0},
      86             : /* 21 */ { 4, s_0_21, 18, 1, 0},
      87             : /* 22 */ { 5, s_0_22, 18, 1, 0},
      88             : /* 23 */ { 4, s_0_23, 18, 1, 0},
      89             : /* 24 */ { 3, s_0_24, 16, 1, 0},
      90             : /* 25 */ { 6, s_0_25, 24, 1, 0},
      91             : /* 26 */ { 5, s_0_26, 24, 1, 0},
      92             : /* 27 */ { 3, s_0_27, 16, 1, 0},
      93             : /* 28 */ { 3, s_0_28, 16, 1, 0},
      94             : /* 29 */ { 5, s_0_29, 28, 1, 0},
      95             : /* 30 */ { 2, s_0_30, -1, 1, 0},
      96             : /* 31 */ { 4, s_0_31, 30, 1, 0}
      97             : };
      98             : 
      99             : static const symbol s_1_0[2] = { 'g', 'd' };
     100             : static const symbol s_1_1[2] = { 'd', 't' };
     101             : static const symbol s_1_2[2] = { 'g', 't' };
     102             : static const symbol s_1_3[2] = { 'k', 't' };
     103             : 
     104             : static const struct among a_1[4] =
     105             : {
     106             : /*  0 */ { 2, s_1_0, -1, -1, 0},
     107             : /*  1 */ { 2, s_1_1, -1, -1, 0},
     108             : /*  2 */ { 2, s_1_2, -1, -1, 0},
     109             : /*  3 */ { 2, s_1_3, -1, -1, 0}
     110             : };
     111             : 
     112             : static const symbol s_2_0[2] = { 'i', 'g' };
     113             : static const symbol s_2_1[3] = { 'l', 'i', 'g' };
     114             : static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
     115             : static const symbol s_2_3[3] = { 'e', 'l', 's' };
     116             : static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' };
     117             : 
     118             : static const struct among a_2[5] =
     119             : {
     120             : /*  0 */ { 2, s_2_0, -1, 1, 0},
     121             : /*  1 */ { 3, s_2_1, 0, 1, 0},
     122             : /*  2 */ { 4, s_2_2, 1, 1, 0},
     123             : /*  3 */ { 3, s_2_3, -1, 1, 0},
     124             : /*  4 */ { 4, s_2_4, -1, 2, 0}
     125             : };
     126             : 
     127             : static const unsigned char g_c[] = { 119, 223, 119, 1 };
     128             : 
     129             : 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 };
     130             : 
     131             : static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
     132             : 
     133             : static const symbol s_0[] = { 's', 't' };
     134             : static const symbol s_1[] = { 'i', 'g' };
     135             : static const symbol s_2[] = { 'l', 0xF8, 's' };
     136             : 
     137           0 : static int r_mark_regions(struct SN_env * z) { /* forwardmode */
     138           0 :     z->I[0] = z->l; /* $p1 = <integer expression>, line 33 */
     139           0 :     {   int c_test1 = z->c; /* test, line 35 */
     140           0 :         {   int ret = z->c + 3; /* hop, line 35 */
     141           0 :             if (0 > ret || ret > z->l) return 0;
     142           0 :             z->c = ret;
     143             :         }
     144           0 :         z->I[1] = z->c; /* setmark x, line 35 */
     145           0 :         z->c = c_test1;
     146             :     }
     147           0 :     if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 36 */
     148             :     {    /* gopast */ /* non v, line 36 */
     149           0 :         int ret = in_grouping(z, g_v, 97, 248, 1);
     150           0 :         if (ret < 0) return 0;
     151           0 :         z->c += ret;
     152             :     }
     153           0 :     z->I[0] = z->c; /* setmark p1, line 36 */
     154             :     /* try, line 37 */
     155           0 :     if (!(z->I[0] < z->I[1])) goto lab0; /* $(<integer expression> < <integer expression>), line 37 */
     156           0 :     z->I[0] = z->I[1]; /* $p1 = <integer expression>, line 37 */
     157             : lab0:
     158           0 :     return 1;
     159             : }
     160             : 
     161           0 : static int r_main_suffix(struct SN_env * z) { /* backwardmode */
     162             :     int among_var;
     163             : 
     164             :     {   int mlimit1; /* setlimit, line 43 */
     165           0 :         if (z->c < z->I[0]) return 0;
     166           0 :         mlimit1 = z->lb; z->lb = z->I[0];
     167           0 :         z->ket = z->c; /* [, line 43 */
     168           0 :         if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit1; return 0; } /* substring, line 43 */
     169           0 :         among_var = find_among_b(z, a_0, 32);
     170           0 :         if (!(among_var)) { z->lb = mlimit1; return 0; }
     171           0 :         z->bra = z->c; /* ], line 43 */
     172           0 :         z->lb = mlimit1;
     173             :     }
     174           0 :     switch (among_var) { /* among, line 44 */
     175             :         case 1:
     176           0 :             {   int ret = slice_del(z); /* delete, line 50 */
     177           0 :                 if (ret < 0) return ret;
     178             :             }
     179           0 :             break;
     180             :         case 2:
     181           0 :             if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0; /* grouping s_ending, line 52 */
     182           0 :             {   int ret = slice_del(z); /* delete, line 52 */
     183           0 :                 if (ret < 0) return ret;
     184             :             }
     185           0 :             break;
     186             :     }
     187           0 :     return 1;
     188             : }
     189             : 
     190           0 : static int r_consonant_pair(struct SN_env * z) { /* backwardmode */
     191           0 :     {   int m_test1 = z->l - z->c; /* test, line 57 */
     192             : 
     193             :         {   int mlimit2; /* setlimit, line 58 */
     194           0 :             if (z->c < z->I[0]) return 0;
     195           0 :             mlimit2 = z->lb; z->lb = z->I[0];
     196           0 :             z->ket = z->c; /* [, line 58 */
     197           0 :             if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit2; return 0; } /* substring, line 58 */
     198           0 :             if (!(find_among_b(z, a_1, 4))) { z->lb = mlimit2; return 0; }
     199           0 :             z->bra = z->c; /* ], line 58 */
     200           0 :             z->lb = mlimit2;
     201             :         }
     202           0 :         z->c = z->l - m_test1;
     203             :     }
     204           0 :     if (z->c <= z->lb) return 0;
     205           0 :     z->c--; /* next, line 64 */
     206           0 :     z->bra = z->c; /* ], line 64 */
     207           0 :     {   int ret = slice_del(z); /* delete, line 64 */
     208           0 :         if (ret < 0) return ret;
     209             :     }
     210           0 :     return 1;
     211             : }
     212             : 
     213           0 : static int r_other_suffix(struct SN_env * z) { /* backwardmode */
     214             :     int among_var;
     215           0 :     {   int m1 = z->l - z->c; (void)m1; /* do, line 68 */
     216           0 :         z->ket = z->c; /* [, line 68 */
     217           0 :         if (!(eq_s_b(z, 2, s_0))) goto lab0; /* literal, line 68 */
     218           0 :         z->bra = z->c; /* ], line 68 */
     219           0 :         if (!(eq_s_b(z, 2, s_1))) goto lab0; /* literal, line 68 */
     220           0 :         {   int ret = slice_del(z); /* delete, line 68 */
     221           0 :             if (ret < 0) return ret;
     222             :         }
     223             :     lab0:
     224           0 :         z->c = z->l - m1;
     225             :     }
     226             : 
     227             :     {   int mlimit2; /* setlimit, line 69 */
     228           0 :         if (z->c < z->I[0]) return 0;
     229           0 :         mlimit2 = z->lb; z->lb = z->I[0];
     230           0 :         z->ket = z->c; /* [, line 69 */
     231           0 :         if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit2; return 0; } /* substring, line 69 */
     232           0 :         among_var = find_among_b(z, a_2, 5);
     233           0 :         if (!(among_var)) { z->lb = mlimit2; return 0; }
     234           0 :         z->bra = z->c; /* ], line 69 */
     235           0 :         z->lb = mlimit2;
     236             :     }
     237           0 :     switch (among_var) { /* among, line 70 */
     238             :         case 1:
     239           0 :             {   int ret = slice_del(z); /* delete, line 72 */
     240           0 :                 if (ret < 0) return ret;
     241             :             }
     242           0 :             {   int m3 = z->l - z->c; (void)m3; /* do, line 72 */
     243           0 :                 {   int ret = r_consonant_pair(z); /* call consonant_pair, line 72 */
     244           0 :                     if (ret == 0) goto lab1;
     245           0 :                     if (ret < 0) return ret;
     246             :                 }
     247             :             lab1:
     248           0 :                 z->c = z->l - m3;
     249             :             }
     250           0 :             break;
     251             :         case 2:
     252           0 :             {   int ret = slice_from_s(z, 3, s_2); /* <-, line 74 */
     253           0 :                 if (ret < 0) return ret;
     254             :             }
     255           0 :             break;
     256             :     }
     257           0 :     return 1;
     258             : }
     259             : 
     260           0 : static int r_undouble(struct SN_env * z) { /* backwardmode */
     261             : 
     262             :     {   int mlimit1; /* setlimit, line 78 */
     263           0 :         if (z->c < z->I[0]) return 0;
     264           0 :         mlimit1 = z->lb; z->lb = z->I[0];
     265           0 :         z->ket = z->c; /* [, line 78 */
     266           0 :         if (in_grouping_b(z, g_c, 98, 122, 0)) { z->lb = mlimit1; return 0; } /* grouping c, line 78 */
     267           0 :         z->bra = z->c; /* ], line 78 */
     268           0 :         z->S[0] = slice_to(z, z->S[0]); /* -> ch, line 78 */
     269           0 :         if (z->S[0] == 0) return -1; /* -> ch, line 78 */
     270           0 :         z->lb = mlimit1;
     271             :     }
     272           0 :     if (!(eq_v_b(z, z->S[0]))) return 0; /* name ch, line 79 */
     273           0 :     {   int ret = slice_del(z); /* delete, line 80 */
     274           0 :         if (ret < 0) return ret;
     275             :     }
     276           0 :     return 1;
     277             : }
     278             : 
     279           0 : extern int danish_ISO_8859_1_stem(struct SN_env * z) { /* forwardmode */
     280           0 :     {   int c1 = z->c; /* do, line 86 */
     281           0 :         {   int ret = r_mark_regions(z); /* call mark_regions, line 86 */
     282           0 :             if (ret == 0) goto lab0;
     283           0 :             if (ret < 0) return ret;
     284             :         }
     285             :     lab0:
     286           0 :         z->c = c1;
     287             :     }
     288           0 :     z->lb = z->c; z->c = z->l; /* backwards, line 87 */
     289             : 
     290           0 :     {   int m2 = z->l - z->c; (void)m2; /* do, line 88 */
     291           0 :         {   int ret = r_main_suffix(z); /* call main_suffix, line 88 */
     292           0 :             if (ret == 0) goto lab1;
     293           0 :             if (ret < 0) return ret;
     294             :         }
     295             :     lab1:
     296           0 :         z->c = z->l - m2;
     297             :     }
     298           0 :     {   int m3 = z->l - z->c; (void)m3; /* do, line 89 */
     299           0 :         {   int ret = r_consonant_pair(z); /* call consonant_pair, line 89 */
     300           0 :             if (ret == 0) goto lab2;
     301           0 :             if (ret < 0) return ret;
     302             :         }
     303             :     lab2:
     304           0 :         z->c = z->l - m3;
     305             :     }
     306           0 :     {   int m4 = z->l - z->c; (void)m4; /* do, line 90 */
     307           0 :         {   int ret = r_other_suffix(z); /* call other_suffix, line 90 */
     308           0 :             if (ret == 0) goto lab3;
     309           0 :             if (ret < 0) return ret;
     310             :         }
     311             :     lab3:
     312           0 :         z->c = z->l - m4;
     313             :     }
     314           0 :     {   int m5 = z->l - z->c; (void)m5; /* do, line 91 */
     315           0 :         {   int ret = r_undouble(z); /* call undouble, line 91 */
     316           0 :             if (ret == 0) goto lab4;
     317           0 :             if (ret < 0) return ret;
     318             :         }
     319             :     lab4:
     320           0 :         z->c = z->l - m5;
     321             :     }
     322           0 :     z->c = z->lb;
     323           0 :     return 1;
     324             : }
     325             : 
     326           0 : extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2, 0); }
     327             : 
     328           0 : extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); }
     329             : 

Generated by: LCOV version 1.13