]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/spotlight_rawquery_lexer.c
Map Spotlight searchstring to regex format and allow dots in it
[netatalk.git] / etc / afpd / spotlight_rawquery_lexer.c
index 8cb944bbd6f504779e542a01d13b2800e96281b9..c3f60f3890a473d56d853000689929ab941d42ff 100644 (file)
@@ -359,8 +359,8 @@ static void yy_fatal_error (yyconst char msg[]  );
        *yy_cp = '\0'; \
        (yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 14
-#define YY_END_OF_BUFFER 15
+#define YY_NUM_RULES 19
+#define YY_END_OF_BUFFER 20
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -368,32 +368,32 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[61] =
+static yyconst flex_int16_t yy_accept[52] =
     {   0,
-        0,    0,   15,   14,   13,   13,    6,   14,   14,    7,
-        8,    5,   12,   14,    5,    5,   14,    0,    0,    9,
-        5,   11,    5,    5,   10,    0,    0,    5,    5,    4,
-        0,    0,    5,    5,    0,    0,    5,    5,    0,    0,
-        5,    0,    0,    1,    0,    0,    0,    2,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    3,    0
+        0,    0,   20,   19,   18,   19,    8,   19,   19,    9,
+       10,    7,   17,   15,   19,   16,    7,    7,    7,    7,
+       19,   14,    0,   11,    7,   13,    7,    4,    7,    7,
+        7,   12,    0,    7,    3,    7,    7,    0,    7,    7,
+        6,    0,    7,    5,    0,    7,    0,    1,    0,    2,
+        0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
     {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    2,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    1,    4,    1,    5,    1,    6,    1,    7,
-        8,    9,    1,   10,   11,   12,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,   13,    1,    1,
-       14,    1,    1,    1,    9,    9,    9,    9,    9,    9,
+        1,    2,    3,    4,    1,    5,    1,    6,    1,    7,
+        8,    9,    1,   10,    9,   11,    1,    9,    9,    9,
+        9,    9,    9,    9,    9,    9,    9,    9,    1,   12,
+       13,   14,    1,    1,    9,    9,    9,    9,    9,    9,
         9,    9,   15,    9,    9,    9,    9,    9,    9,    9,
-        9,   16,    9,   17,    9,    9,    9,    9,    9,   18,
-        1,    1,    1,    1,    1,    1,   19,    9,   20,   21,
+        9,   16,    9,    9,    9,    9,    9,    9,    9,    9,
+        1,    1,    1,    1,    1,    1,   17,    9,   18,   19,
 
-       22,    9,   23,    9,   24,    9,    9,    9,   25,   26,
-       27,    9,    9,    9,   28,   29,    9,    9,   30,    9,
-        9,    9,    1,   31,    1,    1,    1,    1,    1,    1,
+       20,   21,   22,    9,   23,    9,    9,   24,   25,   26,
+       27,    9,    9,   28,   29,   30,   31,    9,   32,    9,
+        9,    9,    1,   33,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -410,92 +410,62 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[32] =
+static yyconst flex_int32_t yy_meta[34] =
     {   0,
-        1,    1,    2,    1,    1,    1,    1,    1,    3,    1,
-        3,    1,    1,    1,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        1
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    1,
+        2,    1,    1,    1,    2,    2,    2,    2,    2,    2,
+        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+        2,    2,    1
     } ;
 
-static yyconst flex_int16_t yy_base[75] =
+static yyconst flex_int16_t yy_base[53] =
     {   0,
-        0,    0,  181,    0,    0,  182,    0,  150,  170,    0,
-        0,   31,    0,  159,  144,  137,  133,    0,  137,    0,
-       62,    0,  142,  134,    0,    0,  127,   93,  130,    0,
-      135,  114,  132,  115,    0,  126,  126,  116,    0,  111,
-      118,  123,  105,  121,    0,  104,    0,  182,  113,    0,
-        0,  115,    0,    0,   83,    0,    0,   47,  182,  182,
-      141,  144,  147,   31,  150,  153,  156,  159,  162,  165,
-      168,  171,  174,  177
+        0,    0,   63,   64,   64,   49,   64,   31,   54,   64,
+       64,    0,   64,   64,   46,   64,   32,   15,   40,   28,
+       22,   64,   31,   64,    0,   64,   37,    0,   33,   27,
+       19,   64,   24,   31,    0,   17,   25,   24,   17,   22,
+        0,   30,   18,    0,   16,   18,    8,    0,    9,   64,
+       64,   33
     } ;
 
-static yyconst flex_int16_t yy_def[75] =
+static yyconst flex_int16_t yy_def[53] =
     {   0,
-       60,    1,   60,   61,   61,   60,   61,   61,   61,   61,
-       61,   60,   61,   61,   12,   12,   61,   62,   62,   62,
-       60,   62,   21,   21,   62,   63,   63,   60,   28,   28,
-       60,   60,   64,   64,   65,   60,   64,   64,   66,   60,
-       64,   60,   60,   64,   67,   60,   68,   60,   60,   69,
-       70,   60,   71,   72,   60,   73,   74,   60,   60,    0,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60,   60
+       51,    1,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   52,   51,   51,   51,   51,   52,   52,   52,   52,
+       51,   51,   51,   51,   52,   51,   52,   52,   52,   52,
+       52,   51,   51,   52,   52,   52,   52,   51,   52,   52,
+       52,   51,   52,   52,   51,   52,   51,   52,   51,   51,
+        0,   51
     } ;
 
-static yyconst flex_int16_t yy_nxt[214] =
+static yyconst flex_int16_t yy_nxt[98] =
     {   0,
         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-        4,    4,    4,   14,   15,   12,   12,   12,   12,   16,
-       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       17,   18,   18,   37,   18,   18,   18,   18,   18,   21,
-       18,   18,   18,   18,   18,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   18,   26,   26,   59,   26,   26,   26,   26,   26,
-       28,   26,   26,   26,   26,   26,   28,   28,   28,   28,
-       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
-       28,   28,   26,   31,   31,   56,   31,   31,   31,   31,
-
-       31,   33,   31,   31,   31,   31,   31,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   31,   35,   35,   60,   53,   60,   50,
-       48,   60,   46,   45,   43,   36,   60,   40,   41,   44,
-       38,   18,   35,   18,   26,   35,   26,   31,   34,   31,
-       39,   32,   39,   42,   30,   42,   47,   29,   47,   49,
-       27,   49,   51,   25,   51,   52,   24,   52,   54,   23,
-       54,   55,   22,   55,   57,   20,   57,   58,   19,   58,
-       60,    3,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60
+       12,   14,   15,   16,   17,   12,   12,   18,   12,   12,
+       19,   12,   12,   12,   12,   12,   12,   12,   12,   20,
+       12,   12,   21,   28,   25,   50,   49,   48,   47,   46,
+       45,   44,   43,   42,   41,   40,   29,   39,   38,   37,
+       36,   35,   34,   33,   32,   31,   30,   27,   26,   24,
+       23,   22,   51,    3,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51
+
     } ;
 
-static yyconst flex_int16_t yy_chk[214] =
+static yyconst flex_int16_t yy_chk[98] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,   12,   12,   64,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   21,   21,   58,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-       21,   21,   21,   28,   28,   55,   28,   28,   28,   28,
-
-       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
-       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
-       28,   28,   28,   28,   32,   34,   38,   52,   41,   49,
-       46,   44,   43,   42,   40,   32,   37,   36,   38,   41,
-       34,   61,   33,   61,   62,   31,   62,   63,   29,   63,
-       65,   27,   65,   66,   24,   66,   67,   23,   67,   68,
-       19,   68,   69,   17,   69,   70,   16,   70,   71,   15,
-       71,   72,   14,   72,   73,    9,   73,   74,    8,   74,
-        3,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60
+        1,    1,    1,   18,   52,   49,   47,   46,   45,   43,
+       42,   40,   39,   38,   37,   36,   18,   34,   33,   31,
+       30,   29,   27,   23,   21,   20,   19,   17,   15,    9,
+        8,    6,    3,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51
+
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -515,11 +485,12 @@ char *yytext;
 #line 1 "spotlight_rawquery_lexer.l"
 #line 2 "spotlight_rawquery_lexer.l"
 #include <string.h>
+#include <stdbool.h>
 #include <gio/gio.h>
 #include <atalk/talloc.h>
 #include "spotlight.h"
 #include "spotlight_rawquery_parser.h"
-#line 523 "spotlight_rawquery_lexer.c"
+#line 494 "spotlight_rawquery_lexer.c"
 
 #define INITIAL 0
 
@@ -701,9 +672,9 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
     
-#line 9 "spotlight_rawquery_lexer.l"
+#line 10 "spotlight_rawquery_lexer.l"
 
-#line 707 "spotlight_rawquery_lexer.c"
+#line 678 "spotlight_rawquery_lexer.c"
 
        if ( !(yy_init) )
                {
@@ -756,13 +727,13 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 61 )
+                               if ( yy_current_state >= 52 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_base[yy_current_state] != 182 );
+               while ( yy_base[yy_current_state] != 64 );
 
 yy_find_action:
                yy_act = yy_accept[yy_current_state];
@@ -788,76 +759,101 @@ do_action:       /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 10 "spotlight_rawquery_lexer.l"
+#line 11 "spotlight_rawquery_lexer.l"
 return FUNC_INRANGE;
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 11 "spotlight_rawquery_lexer.l"
-return DATE_SPEC;
+#line 12 "spotlight_rawquery_lexer.l"
+return DATE_ISO;
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 12 "spotlight_rawquery_lexer.l"
-{yylval.sval = talloc_strdup(ssp_slq, yytext); return DATE;}
+#line 13 "spotlight_rawquery_lexer.l"
+/* ignore case specifier */
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 13 "spotlight_rawquery_lexer.l"
-/* ignore case specifier */
+#line 14 "spotlight_rawquery_lexer.l"
+/* ignore */
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 14 "spotlight_rawquery_lexer.l"
-{yylval.sval = talloc_strdup(ssp_slq, yytext); return WORD;}
+#line 15 "spotlight_rawquery_lexer.l"
+{yylval.bval = false; return BOOL;}
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 15 "spotlight_rawquery_lexer.l"
-return QUOTE;
+#line 16 "spotlight_rawquery_lexer.l"
+{yylval.bval = true; return BOOL;}
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 16 "spotlight_rawquery_lexer.l"
-return OBRACE;
+#line 17 "spotlight_rawquery_lexer.l"
+{yylval.sval = talloc_strdup(ssp_slq, yytext); return WORD;}
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 17 "spotlight_rawquery_lexer.l"
-return CBRACE;
+#line 18 "spotlight_rawquery_lexer.l"
+return QUOTE;
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 18 "spotlight_rawquery_lexer.l"
-return AND;
+#line 19 "spotlight_rawquery_lexer.l"
+return OBRACE;
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 19 "spotlight_rawquery_lexer.l"
-return OR;
+#line 20 "spotlight_rawquery_lexer.l"
+return CBRACE;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 20 "spotlight_rawquery_lexer.l"
-return EQUAL;
+#line 21 "spotlight_rawquery_lexer.l"
+return AND;
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 21 "spotlight_rawquery_lexer.l"
-return COMMA;
+#line 22 "spotlight_rawquery_lexer.l"
+return OR;
        YY_BREAK
 case 13:
-/* rule 13 can match eol */
 YY_RULE_SETUP
-#line 22 "spotlight_rawquery_lexer.l"
-/* ignore */
+#line 23 "spotlight_rawquery_lexer.l"
+return EQUAL;
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 23 "spotlight_rawquery_lexer.l"
+#line 24 "spotlight_rawquery_lexer.l"
+return UNEQUAL;
+       YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 25 "spotlight_rawquery_lexer.l"
+return LT;
+       YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 26 "spotlight_rawquery_lexer.l"
+return GT;
+       YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 27 "spotlight_rawquery_lexer.l"
+return COMMA;
+       YY_BREAK
+case 18:
+/* rule 18 can match eol */
+YY_RULE_SETUP
+#line 28 "spotlight_rawquery_lexer.l"
+/* ignore */
+       YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 29 "spotlight_rawquery_lexer.l"
 ECHO;
        YY_BREAK
-#line 861 "spotlight_rawquery_lexer.c"
+#line 857 "spotlight_rawquery_lexer.c"
 case YY_STATE_EOF(INITIAL):
        yyterminate();
 
@@ -1149,7 +1145,7 @@ static int yy_get_next_buffer (void)
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 61 )
+                       if ( yy_current_state >= 52 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1177,11 +1173,11 @@ static int yy_get_next_buffer (void)
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 61 )
+               if ( yy_current_state >= 52 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 60);
+       yy_is_jam = (yy_current_state == 51);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -1855,7 +1851,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 23 "spotlight_rawquery_lexer.l"
+#line 29 "spotlight_rawquery_lexer.l"