]> arthur.barton.de Git - netatalk.git/commitdiff
Add lots of mappings and dont ignore case stuff
authorFrank Lahm <franklahm@googlemail.com>
Thu, 1 Nov 2012 22:10:26 +0000 (23:10 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Thu, 1 Nov 2012 22:10:26 +0000 (23:10 +0100)
etc/afpd/spotlight_SPARQL_map.c
etc/afpd/spotlight_SPARQL_map.h
etc/afpd/spotlight_rawquery_lexer.c
etc/afpd/spotlight_rawquery_lexer.l
etc/afpd/spotlight_rawquery_parser.c
etc/afpd/spotlight_rawquery_parser.y

index d69b7a31fd99c8bec4206c4ab0ad3b3a7b8bbd4d..a39305509235dc9f7dd8d09a2a4ce9a8a251ce10 100644 (file)
 #include "spotlight_SPARQL_map.h"
 
 struct spotlight_sparql_map spotlight_sparql_map[] = {
-/*   ssm_spotlight_attr                 ssm_type,   ssm_sparql_attr */
+    /* ssm_spotlight_attr               ssm_type,   ssm_sparql_attr */
     {"*",                               ssmt_fts,   "fts:match"},
-    {"kMDItemTextContent",              ssmt_fts,   "fts:match"},
+
+    /* Filesystem metadata */
+    {"kMDItemFSLabel", ssmt_num, ""},
     {"kMDItemDisplayName",              ssmt_str,   "nfo:fileName"},
-    {"kMDItemContentCreationDate",      ssmt_date,  "nfo:fileCreated"},
+    {"kMDItemFSName",                   ssmt_str,   "nfo:fileName"},
     {"kMDItemFSContentChangeDate",      ssmt_date,  "nfo:fileLastModified"},
+
+    /* Common metadata */
+    {"kMDItemTextContent",              ssmt_fts,   "fts:match"},
+    {"kMDItemContentCreationDate",      ssmt_date,  "nie:contentCreated"},
     {"kMDItemContentModificationDate",  ssmt_date,  "nfo:fileLastModified"},
+    {"kMDItemAttributeChangeDate",      ssmt_date,  "nfo:fileLastModified"},
+    {"kMDItemAuthors",                  ssmt_str,   "dc:creator"},
+    {"kMDItemContentType",              ssmt_cnt,   "nie:mimeType"},
+    {"kMDItemCopyright",                ssmt_str,   "nie:copyright"},
+    {"kMDItemCountry",                  ssmt_str,   "nco:country"},
+    {"kMDItemCreator",                  ssmt_str,   "dc:creator"},
+    {"kMDItemDurationSeconds",          ssmt_num,   "nfo:duration"},
+    {"kMDItemNumberOfPages",            ssmt_num,   "nfo:pageCount"},
+    {"kMDItemTitle",                    ssmt_str,   "nie:title"},
+
+    /* Image metadata */
     {"kMDItemPixelWidth",               ssmt_num,   "nfo:width"},
     {"kMDItemPixelHeight",              ssmt_num,   "nfo:height"},
+    {"kMDItemColorSpace",               ssmt_str,   "nexif:colorSpace"},
+    {"kMDItemBitsPerSample",            ssmt_num,   "nfo:colorDepth"},
+    {"kMDItemFocalLength",              ssmt_num,   "nmm:focalLength"},
+    {"kMDItemISOSpeed",                 ssmt_num,   "nmm:isoSpeed"},
+    {"kMDItemOrientation",              ssmt_bool,  "nfo:orientation"},
+    {"kMDItemResolutionWidthDPI",       ssmt_num,   "nfo:horizontalResolution"},
+    {"kMDItemResolutionHeightDPI",      ssmt_num,   "nfo:verticalResolution"},
+    {"kMDItemExposureTimeSeconds",      ssmt_num,   "nmm:exposureTime"},
+
+    /* Audio metadata */
+    {"kMDItemComposer",                 ssmt_str,   "nmm:composer"},
+    {"kMDItemMusicalGenre",             ssmt_str,   "nfo:genre"},
+
     {NULL, ssmt_str, NULL}
 };
index 1ea6736fc47f057748ea791d5b65a3845f9dcef3..2922241d5717f05e963f7f568d62c39b4a1be393 100644 (file)
@@ -24,7 +24,8 @@ enum ssm_type {
     ssmt_num,    /* a numeric value that requires a SPARQL FILTER */
     ssmt_str,    /* a string value that requieres a SPARQL FILTER */
     ssmt_fts,    /* a string value that will be queried with SPARQL 'fts:match' */
-    ssmt_date    /* date values are handled in a special map function map_daterange() */
+    ssmt_date,   /* date values are handled in a special map function map_daterange() */
+    ssmt_cnt     /* kMDItemContentType, requires special mapping */
 };
 
 struct spotlight_sparql_map {
index c3f60f3890a473d56d853000689929ab941d42ff..a34e296b7929b8a51cebbe7e07342db3491acaf2 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 19
-#define YY_END_OF_BUFFER 20
+#define YY_NUM_RULES 17
+#define YY_END_OF_BUFFER 18
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -368,14 +368,13 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[52] =
+static yyconst flex_int16_t yy_accept[48] =
     {   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
+        0,    0,   18,   17,   16,   17,    6,   17,   17,    7,
+        8,    5,   15,   13,   17,   14,    5,    5,    5,   17,
+       12,    0,    9,    5,   11,    5,    5,    5,   10,    0,
+        5,    5,    5,    0,    5,    5,    4,    0,    5,    3,
+        0,    5,    0,    1,    0,    2,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -389,11 +388,11 @@ static yyconst flex_int32_t yy_ec[256] =
        13,   14,    1,    1,    9,    9,    9,    9,    9,    9,
         9,    9,   15,    9,    9,    9,    9,    9,    9,    9,
         9,   16,    9,    9,    9,    9,    9,    9,    9,    9,
-        1,    1,    1,    1,    1,    1,   17,    9,   18,   19,
+        1,    1,    1,    1,    1,    1,   17,    9,    9,    9,
 
-       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,
+       18,   19,   20,    9,   21,    9,    9,   22,   23,   24,
+       25,    9,    9,   26,   27,   28,   29,    9,    9,    9,
+        9,    9,    1,   30,    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,62 +409,55 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[34] =
+static yyconst flex_int32_t yy_meta[31] =
     {   0,
         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
+        2,    2,    2,    2,    2,    2,    2,    2,    2,    1
     } ;
 
-static yyconst flex_int16_t yy_base[53] =
+static yyconst flex_int16_t yy_base[49] =
     {   0,
-        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
+        0,    0,   57,   58,   58,   43,   58,   27,   48,   58,
+       58,    0,   58,   58,   40,   58,   28,   34,   24,   19,
+       58,   27,   58,    0,   58,   31,   24,   16,   58,   21,
+       26,   15,   23,   22,   15,   20,    0,   26,   16,    0,
+       14,   16,    6,    0,    7,   58,   58,   29
     } ;
 
-static yyconst flex_int16_t yy_def[53] =
+static yyconst flex_int16_t yy_def[49] =
     {   0,
-       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
+       47,    1,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   48,   47,   47,   47,   47,   48,   48,   48,   47,
+       47,   47,   47,   48,   47,   48,   48,   48,   47,   47,
+       48,   48,   48,   47,   48,   48,   48,   47,   48,   48,
+       47,   48,   47,   48,   47,   47,    0,   47
     } ;
 
-static yyconst flex_int16_t yy_nxt[98] =
+static yyconst flex_int16_t yy_nxt[89] =
     {   0,
         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       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
-
+       12,   14,   15,   16,   17,   12,   12,   12,   18,   12,
+       12,   12,   12,   12,   12,   12,   12,   19,   12,   20,
+       24,   46,   45,   44,   43,   42,   41,   40,   39,   38,
+       37,   36,   35,   34,   33,   32,   31,   30,   29,   28,
+       27,   26,   25,   23,   22,   21,   47,    3,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47
     } ;
 
-static yyconst flex_int16_t yy_chk[98] =
+static yyconst flex_int16_t yy_chk[89] =
     {   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,    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
-
+       48,   45,   43,   42,   41,   39,   38,   36,   35,   34,
+       33,   32,   31,   30,   28,   27,   26,   22,   20,   19,
+       18,   17,   15,    9,    8,    6,    3,   47,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47,   47,   47,
+       47,   47,   47,   47,   47,   47,   47,   47
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -490,7 +482,7 @@ char *yytext;
 #include <atalk/talloc.h>
 #include "spotlight.h"
 #include "spotlight_rawquery_parser.h"
-#line 494 "spotlight_rawquery_lexer.c"
+#line 486 "spotlight_rawquery_lexer.c"
 
 #define INITIAL 0
 
@@ -674,7 +666,7 @@ YY_DECL
     
 #line 10 "spotlight_rawquery_lexer.l"
 
-#line 678 "spotlight_rawquery_lexer.c"
+#line 670 "spotlight_rawquery_lexer.c"
 
        if ( !(yy_init) )
                {
@@ -727,13 +719,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 >= 52 )
+                               if ( yy_current_state >= 48 )
                                        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] != 64 );
+               while ( yy_base[yy_current_state] != 58 );
 
 yy_find_action:
                yy_act = yy_accept[yy_current_state];
@@ -770,90 +762,80 @@ return DATE_ISO;
 case 3:
 YY_RULE_SETUP
 #line 13 "spotlight_rawquery_lexer.l"
-/* ignore case specifier */
+{yylval.bval = false; return BOOL;}
        YY_BREAK
 case 4:
 YY_RULE_SETUP
 #line 14 "spotlight_rawquery_lexer.l"
-/* ignore */
+{yylval.bval = true; return BOOL;}
        YY_BREAK
 case 5:
 YY_RULE_SETUP
 #line 15 "spotlight_rawquery_lexer.l"
-{yylval.bval = false; return BOOL;}
+{yylval.sval = talloc_strdup(ssp_slq, yytext); return WORD;}
        YY_BREAK
 case 6:
 YY_RULE_SETUP
 #line 16 "spotlight_rawquery_lexer.l"
-{yylval.bval = true; return BOOL;}
+return QUOTE;
        YY_BREAK
 case 7:
 YY_RULE_SETUP
 #line 17 "spotlight_rawquery_lexer.l"
-{yylval.sval = talloc_strdup(ssp_slq, yytext); return WORD;}
+return OBRACE;
        YY_BREAK
 case 8:
 YY_RULE_SETUP
 #line 18 "spotlight_rawquery_lexer.l"
-return QUOTE;
+return CBRACE;
        YY_BREAK
 case 9:
 YY_RULE_SETUP
 #line 19 "spotlight_rawquery_lexer.l"
-return OBRACE;
+return AND;
        YY_BREAK
 case 10:
 YY_RULE_SETUP
 #line 20 "spotlight_rawquery_lexer.l"
-return CBRACE;
+return OR;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
 #line 21 "spotlight_rawquery_lexer.l"
-return AND;
+return EQUAL;
        YY_BREAK
 case 12:
 YY_RULE_SETUP
 #line 22 "spotlight_rawquery_lexer.l"
-return OR;
+return UNEQUAL;
        YY_BREAK
 case 13:
 YY_RULE_SETUP
 #line 23 "spotlight_rawquery_lexer.l"
-return EQUAL;
+return LT;
        YY_BREAK
 case 14:
 YY_RULE_SETUP
 #line 24 "spotlight_rawquery_lexer.l"
-return UNEQUAL;
+return GT;
        YY_BREAK
 case 15:
 YY_RULE_SETUP
 #line 25 "spotlight_rawquery_lexer.l"
-return LT;
+return COMMA;
        YY_BREAK
 case 16:
+/* rule 16 can match eol */
 YY_RULE_SETUP
 #line 26 "spotlight_rawquery_lexer.l"
-return GT;
+/* ignore */
        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 857 "spotlight_rawquery_lexer.c"
+#line 839 "spotlight_rawquery_lexer.c"
 case YY_STATE_EOF(INITIAL):
        yyterminate();
 
@@ -1145,7 +1127,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 >= 52 )
+                       if ( yy_current_state >= 48 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1173,11 +1155,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 >= 52 )
+               if ( yy_current_state >= 48 )
                        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 == 51);
+       yy_is_jam = (yy_current_state == 47);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -1851,7 +1833,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 29 "spotlight_rawquery_lexer.l"
+#line 27 "spotlight_rawquery_lexer.l"
 
 
 
index 5b013c8e27d50dacc76d10296fd057a685683e35..81e02bcbb51e7a9dfcf7e8a8e7884e52c8e5d1d5 100644 (file)
@@ -10,8 +10,6 @@
 %%
 InRange                               return FUNC_INRANGE;
 \$time\.iso                           return DATE_ISO;
-cwd                                   /* ignore case specifier */
-cd                                    /* ignore */
 false                                 {yylval.bval = false; return BOOL;}
 true                                  {yylval.bval = true; return BOOL;}
 [a-zA-Z0-9\*\:\-\.]+                  {yylval.sval = talloc_strdup(ssp_slq, yytext); return WORD;}
index 5679a0c38b620b7598f24e07685162eaecedd677..7a70abc96fb287b11d86f67814f1fafe3992b707 100644 (file)
@@ -427,16 +427,16 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  2
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   56
+#define YYLAST   52
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  17
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  7
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  18
+#define YYNRULES  22
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  47
+#define YYNSTATES  51
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -484,7 +484,8 @@ static const yytype_uint8 yytranslate[] =
 static const yytype_uint8 yyprhs[] =
 {
        0,     0,     3,     4,     7,     9,    11,    15,    17,    19,
-      23,    27,    31,    37,    43,    49,    55,    64,    69
+      23,    27,    31,    37,    43,    49,    55,    62,    69,    76,
+      83,    92,    97
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
@@ -495,16 +496,19 @@ static const yytype_int8 yyrhs[] =
       20,     8,    -1,    20,    15,    20,    -1,    20,    16,    20,
       -1,     3,     9,    14,     3,    14,    -1,     3,    10,    14,
        3,    14,    -1,     3,    12,    14,     3,    14,    -1,     3,
-      11,    14,     3,    14,    -1,     5,     7,     3,    13,    23,
-      13,    23,     8,    -1,     6,     7,     3,     8,    -1,     3,
-      -1
+      11,    14,     3,    14,    -1,     3,     9,    14,     3,    14,
+       3,    -1,     3,    10,    14,     3,    14,     3,    -1,     3,
+      12,    14,     3,    14,     3,    -1,     3,    11,    14,     3,
+      14,     3,    -1,     5,     7,     3,    13,    23,    13,    23,
+       8,    -1,     6,     7,     3,     8,    -1,     3,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
        0,    67,    67,    69,    73,    83,    89,    95,    96,    97,
-      98,    99,   108,   109,   110,   111,   115,   119,   120
+      98,    99,   108,   109,   110,   111,   112,   113,   114,   115,
+     119,   123,   124
 };
 #endif
 
@@ -534,14 +538,16 @@ static const yytype_uint16 yytoknum[] =
 static const yytype_uint8 yyr1[] =
 {
        0,    17,    18,    18,    19,    20,    20,    20,    20,    20,
-      20,    20,    21,    21,    21,    21,    22,    23,    23
+      20,    20,    21,    21,    21,    21,    21,    21,    21,    21,
+      22,    23,    23
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
        0,     2,     0,     2,     1,     1,     3,     1,     1,     3,
-       3,     3,     5,     5,     5,     5,     8,     4,     1
+       3,     3,     5,     5,     5,     5,     6,     6,     6,     6,
+       8,     4,     1
 };
 
 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -552,8 +558,9 @@ static const yytype_uint8 yydefact[] =
        2,     0,     1,     0,     5,     0,     0,     3,     4,     7,
        8,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     9,    10,    11,     6,     0,
-       0,     0,     0,     0,    12,    13,    15,    14,    18,     0,
-       0,     0,     0,     0,     0,    17,    16
+       0,     0,     0,     0,    12,    13,    15,    14,    22,     0,
+       0,    16,    17,    19,    18,     0,     0,     0,     0,    21,
+      20
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
@@ -570,14 +577,15 @@ static const yytype_int8 yypact[] =
      -10,    10,   -10,     9,   -10,    -2,    -1,   -10,     8,    -9,
      -10,     2,    12,    13,    14,    26,    -7,    -1,    -1,    27,
       28,    29,    30,    31,    22,   -10,    20,   -10,   -10,    23,
-      24,    25,    32,    19,   -10,   -10,   -10,   -10,   -10,    33,
-      34,    38,    19,    35,    36,   -10,   -10
+      24,    25,    32,    19,    37,    38,    39,    40,   -10,    41,
+      34,   -10,   -10,   -10,   -10,    42,    19,    36,    43,   -10,
+     -10
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -10,   -10,   -10,    -6,    37,   -10,     0
+     -10,   -10,   -10,    -6,    33,   -10,     3
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -590,8 +598,8 @@ static const yytype_uint8 yytable[] =
        2,    26,    27,     3,     4,     5,    20,     6,    11,    12,
       13,    14,    38,    17,    18,    39,    21,    22,    23,    24,
        3,    29,    30,    31,    32,    33,    18,    34,    35,    36,
-      41,    43,    44,    45,    46,     0,    37,    42,     0,     0,
-       0,     0,     0,     0,     0,     0,    28
+      41,    42,    43,    44,    49,    47,    37,    46,    45,    48,
+       0,    50,    28
 };
 
 #define yypact_value_is_default(yystate) \
@@ -606,8 +614,8 @@ static const yytype_int8 yycheck[] =
        0,    17,    18,     3,     4,     5,    14,     7,     9,    10,
       11,    12,     3,    15,    16,     6,    14,    14,    14,     3,
        3,     3,     3,     3,     3,    13,    16,    14,    14,    14,
-       7,     3,    42,     8,     8,    -1,    14,    13,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    19
+       3,     3,     3,     3,     8,     3,    14,    13,     7,    46,
+      -1,     8,    19
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -618,7 +626,8 @@ static const yytype_uint8 yystos[] =
       22,     9,    10,    11,    12,     7,    20,    15,    16,    16,
       14,    14,    14,    14,     3,     8,    20,    20,    21,     3,
        3,     3,     3,    13,    14,    14,    14,    14,     3,     6,
-      23,     7,    13,     3,    23,     8,     8
+      23,     3,     3,     3,     3,     7,    13,     3,    23,     8,
+       8
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -1560,28 +1569,56 @@ yyreduce:
   case 16:
 
 /* Line 1806 of yacc.c  */
-#line 115 "spotlight_rawquery_parser.y"
-    {(yyval.sval) = map_daterange((yyvsp[(3) - (8)].sval), (yyvsp[(5) - (8)].tval), (yyvsp[(7) - (8)].tval));}
+#line 112 "spotlight_rawquery_parser.y"
+    {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '=', (yyvsp[(4) - (6)].sval));}
     break;
 
   case 17:
 
+/* Line 1806 of yacc.c  */
+#line 113 "spotlight_rawquery_parser.y"
+    {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '!', (yyvsp[(4) - (6)].sval));}
+    break;
+
+  case 18:
+
+/* Line 1806 of yacc.c  */
+#line 114 "spotlight_rawquery_parser.y"
+    {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '<', (yyvsp[(4) - (6)].sval));}
+    break;
+
+  case 19:
+
+/* Line 1806 of yacc.c  */
+#line 115 "spotlight_rawquery_parser.y"
+    {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '>', (yyvsp[(4) - (6)].sval));}
+    break;
+
+  case 20:
+
 /* Line 1806 of yacc.c  */
 #line 119 "spotlight_rawquery_parser.y"
+    {(yyval.sval) = map_daterange((yyvsp[(3) - (8)].sval), (yyvsp[(5) - (8)].tval), (yyvsp[(7) - (8)].tval));}
+    break;
+
+  case 21:
+
+/* Line 1806 of yacc.c  */
+#line 123 "spotlight_rawquery_parser.y"
     {(yyval.tval) = isodate2unix((yyvsp[(3) - (4)].sval));}
     break;
 
-  case 18:
+  case 22:
 
 /* Line 1806 of yacc.c  */
-#line 120 "spotlight_rawquery_parser.y"
+#line 124 "spotlight_rawquery_parser.y"
     {(yyval.tval) = atoi((yyvsp[(1) - (1)].sval)) + SPRAW_TIME_OFFSET;}
     break;
 
 
 
 /* Line 1806 of yacc.c  */
-#line 1585 "spotlight_rawquery_parser.c"
+#line 1622 "spotlight_rawquery_parser.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1812,7 +1849,7 @@ yyreturn:
 
 
 /* Line 2067 of yacc.c  */
-#line 123 "spotlight_rawquery_parser.y"
+#line 127 "spotlight_rawquery_parser.y"
 
 
 static time_t isodate2unix(const char *s)
index e4f4ed0ab5c887df1b802e3937ae11328f898d57..dc12dd3c6b4e3d9b2dce3e7b4a9dc7bd77bffa7a 100644 (file)
@@ -49,7 +49,7 @@
     time_t tval;
 }
 
-%expect 1
+%expect 5
 %error-verbose
 
 %type <sval> match expr line function
@@ -109,6 +109,10 @@ WORD EQUAL QUOTE WORD QUOTE     {$$ = map_expr($1, '=', $4);}
 | WORD UNEQUAL QUOTE WORD QUOTE {$$ = map_expr($1, '!', $4);}
 | WORD LT QUOTE WORD QUOTE      {$$ = map_expr($1, '<', $4);}
 | WORD GT QUOTE WORD QUOTE      {$$ = map_expr($1, '>', $4);}
+| WORD EQUAL QUOTE WORD QUOTE WORD    {$$ = map_expr($1, '=', $4);}
+| WORD UNEQUAL QUOTE WORD QUOTE WORD {$$ = map_expr($1, '!', $4);}
+| WORD LT QUOTE WORD QUOTE WORD     {$$ = map_expr($1, '<', $4);}
+| WORD GT QUOTE WORD QUOTE WORD     {$$ = map_expr($1, '>', $4);}
 ;
 
 function: