1 /* A Bison parser, made by GNU Bison 2.7. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.7"
50 #define YYSKELETON_NAME "yacc.c"
61 /* "%code top" blocks. */
62 /* Line 349 of yacc.c */
63 #line 1 "slmod_tracker_0_6_parser.y"
65 #include <atalk/standards.h>
75 #include <atalk/talloc.h>
76 #include <atalk/logger.h>
77 #include <atalk/errchk.h>
78 #include <atalk/spotlight.h>
80 #include "slmod_tracker_0_6_map.h"
82 struct yy_buffer_state;
83 typedef struct yy_buffer_state *YY_BUFFER_STATE;
84 extern int yylex (void);
85 extern void yyerror (char const *);
86 extern void *yyterminate(void);
87 extern YY_BUFFER_STATE yy_scan_string( const char *str);
88 extern void yy_delete_buffer ( YY_BUFFER_STATE buffer );
90 /* forward declarations */
91 static char *map_expr(const char *attr, char op, const char *val);
92 static time_t isodate2unix(const char *s);
94 /* global vars, eg needed by the lexer */
98 static ServiceType ts_type; /* Tracker query object type */
99 static gchar *ts_search; /* Tracker query search term */
102 /* Line 349 of yacc.c */
103 #line 104 "slmod_tracker_0_6_parser.c"
107 /* Copy the first part of user declarations. */
109 /* Line 371 of yacc.c */
110 #line 111 "slmod_tracker_0_6_parser.c"
113 # if defined __cplusplus && 201103L <= __cplusplus
114 # define YY_NULL nullptr
120 /* Enabling verbose error messages. */
121 #ifdef YYERROR_VERBOSE
122 # undef YYERROR_VERBOSE
123 # define YYERROR_VERBOSE 1
125 # define YYERROR_VERBOSE 1
128 /* In a future release of Bison, this section will be replaced
129 by #include "y.tab.h". */
130 #ifndef YY_YY_Y_TAB_H_INCLUDED
131 # define YY_YY_Y_TAB_H_INCLUDED
132 /* Enabling traces. */
143 /* Put the tokens into the symbol table, so that GDB and other debuggers
165 #define FUNC_INRANGE 260
180 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
181 typedef union YYSTYPE
183 /* Line 387 of yacc.c */
184 #line 45 "slmod_tracker_0_6_parser.y"
192 /* Line 387 of yacc.c */
193 #line 194 "slmod_tracker_0_6_parser.c"
195 # define YYSTYPE_IS_TRIVIAL 1
196 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
197 # define YYSTYPE_IS_DECLARED 1
200 extern YYSTYPE yylval;
203 #if defined __STDC__ || defined __cplusplus
204 int yyparse (void *YYPARSE_PARAM);
208 #else /* ! YYPARSE_PARAM */
209 #if defined __STDC__ || defined __cplusplus
214 #endif /* ! YYPARSE_PARAM */
215 /* "%code provides" blocks. */
216 /* Line 387 of yacc.c */
217 #line 39 "slmod_tracker_0_6_parser.y"
219 #define SPRAW_TIME_OFFSET 978307200
220 extern int map_spotlight_to_tracker_0_6_query(slq_t *slq, ServiceType *type, gchar **search);
221 extern slq_t *ts_slq;
224 /* Line 387 of yacc.c */
225 #line 226 "slmod_tracker_0_6_parser.c"
227 #endif /* !YY_YY_Y_TAB_H_INCLUDED */
229 /* Copy the second part of user declarations. */
231 /* Line 390 of yacc.c */
232 #line 233 "slmod_tracker_0_6_parser.c"
239 typedef YYTYPE_UINT8 yytype_uint8;
241 typedef unsigned char yytype_uint8;
245 typedef YYTYPE_INT8 yytype_int8;
246 #elif (defined __STDC__ || defined __C99__FUNC__ \
247 || defined __cplusplus || defined _MSC_VER)
248 typedef signed char yytype_int8;
250 typedef short int yytype_int8;
254 typedef YYTYPE_UINT16 yytype_uint16;
256 typedef unsigned short int yytype_uint16;
260 typedef YYTYPE_INT16 yytype_int16;
262 typedef short int yytype_int16;
266 # ifdef __SIZE_TYPE__
267 # define YYSIZE_T __SIZE_TYPE__
268 # elif defined size_t
269 # define YYSIZE_T size_t
270 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
271 || defined __cplusplus || defined _MSC_VER)
272 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
273 # define YYSIZE_T size_t
275 # define YYSIZE_T unsigned int
279 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
282 # if defined YYENABLE_NLS && YYENABLE_NLS
284 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
285 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
289 # define YY_(Msgid) Msgid
293 /* Suppress unused-variable warnings by "using" E. */
294 #if ! defined lint || defined __GNUC__
295 # define YYUSE(E) ((void) (E))
297 # define YYUSE(E) /* empty */
300 /* Identity function, used to suppress warnings about constant conditions. */
304 #if (defined __STDC__ || defined __C99__FUNC__ \
305 || defined __cplusplus || defined _MSC_VER)
318 #if ! defined yyoverflow || YYERROR_VERBOSE
320 /* The parser invokes alloca or malloc; define the necessary symbols. */
322 # ifdef YYSTACK_USE_ALLOCA
323 # if YYSTACK_USE_ALLOCA
325 # define YYSTACK_ALLOC __builtin_alloca
326 # elif defined __BUILTIN_VA_ARG_INCR
327 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
329 # define YYSTACK_ALLOC __alloca
330 # elif defined _MSC_VER
331 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
332 # define alloca _alloca
334 # define YYSTACK_ALLOC alloca
335 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
336 || defined __cplusplus || defined _MSC_VER)
337 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
338 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
339 # ifndef EXIT_SUCCESS
340 # define EXIT_SUCCESS 0
347 # ifdef YYSTACK_ALLOC
348 /* Pacify GCC's `empty if-body' warning. */
349 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
350 # ifndef YYSTACK_ALLOC_MAXIMUM
351 /* The OS might guarantee only one guard page at the bottom of the stack,
352 and a page size can be as small as 4096 bytes. So we cannot safely
353 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
354 to allow for a few compiler-allocated temporary stack slots. */
355 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
358 # define YYSTACK_ALLOC YYMALLOC
359 # define YYSTACK_FREE YYFREE
360 # ifndef YYSTACK_ALLOC_MAXIMUM
361 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
363 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
364 && ! ((defined YYMALLOC || defined malloc) \
365 && (defined YYFREE || defined free)))
366 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
367 # ifndef EXIT_SUCCESS
368 # define EXIT_SUCCESS 0
372 # define YYMALLOC malloc
373 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
374 || defined __cplusplus || defined _MSC_VER)
375 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
380 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
381 || defined __cplusplus || defined _MSC_VER)
382 void free (void *); /* INFRINGES ON USER NAME SPACE */
386 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
389 #if (! defined yyoverflow \
390 && (! defined __cplusplus \
391 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
393 /* A type that is properly aligned for any stack member. */
396 yytype_int16 yyss_alloc;
400 /* The size of the maximum gap between one aligned stack and the next. */
401 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
403 /* The size of an array large to enough to hold all stacks, each with
405 # define YYSTACK_BYTES(N) \
406 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
407 + YYSTACK_GAP_MAXIMUM)
409 # define YYCOPY_NEEDED 1
411 /* Relocate STACK from its old location to the new one. The
412 local variables YYSIZE and YYSTACKSIZE give the old and new number of
413 elements in the stack, and YYPTR gives the new location of the
414 stack. Advance YYPTR to a properly aligned location for the next
416 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
419 YYSIZE_T yynewbytes; \
420 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
421 Stack = &yyptr->Stack_alloc; \
422 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
423 yyptr += yynewbytes / sizeof (*yyptr); \
429 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
430 /* Copy COUNT objects from SRC to DST. The source and destination do
433 # if defined __GNUC__ && 1 < __GNUC__
434 # define YYCOPY(Dst, Src, Count) \
435 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
437 # define YYCOPY(Dst, Src, Count) \
441 for (yyi = 0; yyi < (Count); yyi++) \
442 (Dst)[yyi] = (Src)[yyi]; \
447 #endif /* !YYCOPY_NEEDED */
449 /* YYFINAL -- State number of the termination state. */
451 /* YYLAST -- Last index in YYTABLE. */
454 /* YYNTOKENS -- Number of terminals. */
456 /* YYNNTS -- Number of nonterminals. */
458 /* YYNRULES -- Number of rules. */
460 /* YYNRULES -- Number of states. */
463 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
465 #define YYMAXUTOK 271
467 #define YYTRANSLATE(YYX) \
468 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
470 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
471 static const yytype_uint8 yytranslate[] =
473 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
499 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
504 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
506 static const yytype_uint8 yyprhs[] =
508 0, 0, 3, 4, 7, 9, 11, 15, 17, 19,
509 23, 27, 31, 37, 43, 49, 55, 62, 69, 76,
513 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
514 static const yytype_int8 yyrhs[] =
516 18, 0, -1, -1, 18, 19, -1, 20, -1, 4,
517 -1, 21, 16, 21, -1, 21, -1, 22, -1, 7,
518 20, 8, -1, 20, 15, 20, -1, 20, 16, 20,
519 -1, 3, 9, 14, 3, 14, -1, 3, 10, 14,
520 3, 14, -1, 3, 12, 14, 3, 14, -1, 3,
521 11, 14, 3, 14, -1, 3, 9, 14, 3, 14,
522 3, -1, 3, 10, 14, 3, 14, 3, -1, 3,
523 12, 14, 3, 14, 3, -1, 3, 11, 14, 3,
524 14, 3, -1, 5, 7, 3, 13, 23, 13, 23,
525 8, -1, 6, 7, 3, 8, -1, 3, -1
528 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
529 static const yytype_uint8 yyrline[] =
531 0, 67, 67, 69, 73, 80, 86, 92, 93, 94,
532 95, 103, 107, 108, 109, 110, 111, 112, 113, 114,
537 #if YYDEBUG || YYERROR_VERBOSE || 1
538 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
539 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
540 static const char *const yytname[] =
542 "$end", "error", "$undefined", "WORD", "BOOL", "FUNC_INRANGE",
543 "DATE_ISO", "OBRACE", "CBRACE", "EQUAL", "UNEQUAL", "GT", "LT", "COMMA",
544 "QUOTE", "AND", "OR", "$accept", "input", "line", "expr", "match",
545 "function", "date", YY_NULL
550 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
552 static const yytype_uint16 yytoknum[] =
554 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
555 265, 266, 267, 268, 269, 270, 271
559 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
560 static const yytype_uint8 yyr1[] =
562 0, 17, 18, 18, 19, 20, 20, 20, 20, 20,
563 20, 20, 21, 21, 21, 21, 21, 21, 21, 21,
567 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
568 static const yytype_uint8 yyr2[] =
570 0, 2, 0, 2, 1, 1, 3, 1, 1, 3,
571 3, 3, 5, 5, 5, 5, 6, 6, 6, 6,
575 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
576 Performed when YYTABLE doesn't specify something else to do. Zero
577 means the default is an error. */
578 static const yytype_uint8 yydefact[] =
580 2, 0, 1, 0, 5, 0, 0, 3, 4, 7,
581 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
582 0, 0, 0, 0, 0, 9, 10, 11, 6, 0,
583 0, 0, 0, 0, 12, 13, 15, 14, 22, 0,
584 0, 16, 17, 19, 18, 0, 0, 0, 0, 21,
588 /* YYDEFGOTO[NTERM-NUM]. */
589 static const yytype_int8 yydefgoto[] =
591 -1, 1, 7, 8, 9, 10, 40
594 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
596 #define YYPACT_NINF -10
597 static const yytype_int8 yypact[] =
599 -10, 10, -10, 9, -10, -2, -1, -10, 8, -9,
600 -10, 2, 12, 13, 14, 26, -7, -1, -1, 27,
601 28, 29, 30, 31, 22, -10, 20, -10, -10, 23,
602 24, 25, 32, 19, 37, 38, 39, 40, -10, 41,
603 34, -10, -10, -10, -10, 42, 19, 36, 43, -10,
607 /* YYPGOTO[NTERM-NUM]. */
608 static const yytype_int8 yypgoto[] =
610 -10, -10, -10, -6, 33, -10, 3
613 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
614 positive, shift that token. If negative, reduce the rule which
615 number is the opposite. If YYTABLE_NINF, syntax error. */
616 #define YYTABLE_NINF -1
617 static const yytype_uint8 yytable[] =
619 16, 25, 3, 4, 5, 15, 6, 19, 17, 18,
620 2, 26, 27, 3, 4, 5, 20, 6, 11, 12,
621 13, 14, 38, 17, 18, 39, 21, 22, 23, 24,
622 3, 29, 30, 31, 32, 33, 18, 34, 35, 36,
623 41, 42, 43, 44, 49, 47, 37, 46, 45, 48,
627 #define yypact_value_is_default(Yystate) \
628 (!!((Yystate) == (-10)))
630 #define yytable_value_is_error(Yytable_value) \
633 static const yytype_int8 yycheck[] =
635 6, 8, 3, 4, 5, 7, 7, 16, 15, 16,
636 0, 17, 18, 3, 4, 5, 14, 7, 9, 10,
637 11, 12, 3, 15, 16, 6, 14, 14, 14, 3,
638 3, 3, 3, 3, 3, 13, 16, 14, 14, 14,
639 3, 3, 3, 3, 8, 3, 14, 13, 7, 46,
643 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
644 symbol of state STATE-NUM. */
645 static const yytype_uint8 yystos[] =
647 0, 18, 0, 3, 4, 5, 7, 19, 20, 21,
648 22, 9, 10, 11, 12, 7, 20, 15, 16, 16,
649 14, 14, 14, 14, 3, 8, 20, 20, 21, 3,
650 3, 3, 3, 13, 14, 14, 14, 14, 3, 6,
651 23, 3, 3, 3, 3, 7, 13, 3, 23, 8,
655 #define yyerrok (yyerrstatus = 0)
656 #define yyclearin (yychar = YYEMPTY)
660 #define YYACCEPT goto yyacceptlab
661 #define YYABORT goto yyabortlab
662 #define YYERROR goto yyerrorlab
665 /* Like YYERROR except do call yyerror. This remains here temporarily
666 to ease the transition to the new meaning of YYERROR, for GCC.
667 Once GCC version 2 has supplanted version 1, this can go. However,
668 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
669 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
672 #define YYFAIL goto yyerrlab
674 /* This is here to suppress warnings from the GCC cpp's
675 -Wunused-macros. Normally we don't worry about that warning, but
676 some users do, and we want to make it easy for users to remove
677 YYFAIL uses, which will produce warnings from Bison 2.5. */
680 #define YYRECOVERING() (!!yyerrstatus)
682 #define YYBACKUP(Token, Value) \
684 if (yychar == YYEMPTY) \
688 YYPOPSTACK (yylen); \
694 yyerror (YY_("syntax error: cannot back up")); \
699 /* Error token number */
701 #define YYERRCODE 256
704 /* This macro is provided for backward compatibility. */
705 #ifndef YY_LOCATION_PRINT
706 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
710 /* YYLEX -- calling `yylex' with the right arguments. */
712 # define YYLEX yylex (YYLEX_PARAM)
714 # define YYLEX yylex ()
717 /* Enable debugging if requested. */
721 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
722 # define YYFPRINTF fprintf
725 # define YYDPRINTF(Args) \
731 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
735 YYFPRINTF (stderr, "%s ", Title); \
736 yy_symbol_print (stderr, \
738 YYFPRINTF (stderr, "\n"); \
743 /*--------------------------------.
744 | Print this symbol on YYOUTPUT. |
745 `--------------------------------*/
748 #if (defined __STDC__ || defined __C99__FUNC__ \
749 || defined __cplusplus || defined _MSC_VER)
751 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
754 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
757 YYSTYPE const * const yyvaluep;
760 FILE *yyo = yyoutput;
765 if (yytype < YYNTOKENS)
766 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
778 /*--------------------------------.
779 | Print this symbol on YYOUTPUT. |
780 `--------------------------------*/
782 #if (defined __STDC__ || defined __C99__FUNC__ \
783 || defined __cplusplus || defined _MSC_VER)
785 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
788 yy_symbol_print (yyoutput, yytype, yyvaluep)
791 YYSTYPE const * const yyvaluep;
794 if (yytype < YYNTOKENS)
795 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
797 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
799 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
800 YYFPRINTF (yyoutput, ")");
803 /*------------------------------------------------------------------.
804 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
806 `------------------------------------------------------------------*/
808 #if (defined __STDC__ || defined __C99__FUNC__ \
809 || defined __cplusplus || defined _MSC_VER)
811 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
814 yy_stack_print (yybottom, yytop)
815 yytype_int16 *yybottom;
819 YYFPRINTF (stderr, "Stack now");
820 for (; yybottom <= yytop; yybottom++)
822 int yybot = *yybottom;
823 YYFPRINTF (stderr, " %d", yybot);
825 YYFPRINTF (stderr, "\n");
828 # define YY_STACK_PRINT(Bottom, Top) \
831 yy_stack_print ((Bottom), (Top)); \
835 /*------------------------------------------------.
836 | Report that the YYRULE is going to be reduced. |
837 `------------------------------------------------*/
839 #if (defined __STDC__ || defined __C99__FUNC__ \
840 || defined __cplusplus || defined _MSC_VER)
842 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
845 yy_reduce_print (yyvsp, yyrule)
850 int yynrhs = yyr2[yyrule];
852 unsigned long int yylno = yyrline[yyrule];
853 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
855 /* The symbols being reduced. */
856 for (yyi = 0; yyi < yynrhs; yyi++)
858 YYFPRINTF (stderr, " $%d = ", yyi + 1);
859 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
860 &(yyvsp[(yyi + 1) - (yynrhs)])
862 YYFPRINTF (stderr, "\n");
866 # define YY_REDUCE_PRINT(Rule) \
869 yy_reduce_print (yyvsp, Rule); \
872 /* Nonzero means print parse trace. It is left uninitialized so that
873 multiple parsers can coexist. */
876 # define YYDPRINTF(Args)
877 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
878 # define YY_STACK_PRINT(Bottom, Top)
879 # define YY_REDUCE_PRINT(Rule)
880 #endif /* !YYDEBUG */
883 /* YYINITDEPTH -- initial size of the parser's stacks. */
885 # define YYINITDEPTH 200
888 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
889 if the built-in stack extension method is used).
891 Do not make this value too large; the results are undefined if
892 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
893 evaluated with infinite-precision integer arithmetic. */
896 # define YYMAXDEPTH 10000
903 # if defined __GLIBC__ && defined _STRING_H
904 # define yystrlen strlen
906 /* Return the length of YYSTR. */
907 #if (defined __STDC__ || defined __C99__FUNC__ \
908 || defined __cplusplus || defined _MSC_VER)
910 yystrlen (const char *yystr)
918 for (yylen = 0; yystr[yylen]; yylen++)
926 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
927 # define yystpcpy stpcpy
929 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
931 #if (defined __STDC__ || defined __C99__FUNC__ \
932 || defined __cplusplus || defined _MSC_VER)
934 yystpcpy (char *yydest, const char *yysrc)
937 yystpcpy (yydest, yysrc)
943 const char *yys = yysrc;
945 while ((*yyd++ = *yys++) != '\0')
954 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
955 quotes and backslashes, so that it's suitable for yyerror. The
956 heuristic is that double-quoting is unnecessary unless the string
957 contains an apostrophe, a comma, or backslash (other than
958 backslash-backslash). YYSTR is taken from yytname. If YYRES is
959 null, do not copy; instead, return the length of what the result
962 yytnamerr (char *yyres, const char *yystr)
967 char const *yyp = yystr;
974 goto do_not_strip_quotes;
978 goto do_not_strip_quotes;
991 do_not_strip_quotes: ;
995 return yystrlen (yystr);
997 return yystpcpy (yyres, yystr) - yyres;
1001 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1002 about the unexpected token YYTOKEN for the state stack whose top is
1005 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1006 not large enough to hold the message. In that case, also set
1007 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1008 required number of bytes is too large to store. */
1010 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1011 yytype_int16 *yyssp, int yytoken)
1013 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1014 YYSIZE_T yysize = yysize0;
1015 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1016 /* Internationalized format string. */
1017 const char *yyformat = YY_NULL;
1018 /* Arguments of yyformat. */
1019 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1020 /* Number of reported tokens (one for the "unexpected", one per
1024 /* There are many possibilities here to consider:
1025 - Assume YYFAIL is not used. It's too flawed to consider. See
1026 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1027 for details. YYERROR is fine as it does not invoke this
1029 - If this state is a consistent state with a default action, then
1030 the only way this function was invoked is if the default action
1031 is an error action. In that case, don't check for expected
1032 tokens because there are none.
1033 - The only way there can be no lookahead present (in yychar) is if
1034 this state is a consistent state with a default action. Thus,
1035 detecting the absence of a lookahead is sufficient to determine
1036 that there is no unexpected or expected token to report. In that
1037 case, just report a simple "syntax error".
1038 - Don't assume there isn't a lookahead just because this state is a
1039 consistent state with a default action. There might have been a
1040 previous inconsistent state, consistent state with a non-default
1041 action, or user semantic action that manipulated yychar.
1042 - Of course, the expected token list depends on states to have
1043 correct lookahead information, and it depends on the parser not
1044 to perform extra reductions after fetching a lookahead from the
1045 scanner and before detecting a syntax error. Thus, state merging
1046 (from LALR or IELR) and default reductions corrupt the expected
1047 token list. However, the list is correct for canonical LR with
1048 one exception: it will still contain any token that will not be
1049 accepted due to an error action in a later state.
1051 if (yytoken != YYEMPTY)
1053 int yyn = yypact[*yyssp];
1054 yyarg[yycount++] = yytname[yytoken];
1055 if (!yypact_value_is_default (yyn))
1057 /* Start YYX at -YYN if negative to avoid negative indexes in
1058 YYCHECK. In other words, skip the first -YYN actions for
1059 this state because they are default actions. */
1060 int yyxbegin = yyn < 0 ? -yyn : 0;
1061 /* Stay within bounds of both yycheck and yytname. */
1062 int yychecklim = YYLAST - yyn + 1;
1063 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1066 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1067 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1068 && !yytable_value_is_error (yytable[yyx + yyn]))
1070 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1076 yyarg[yycount++] = yytname[yyx];
1078 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1079 if (! (yysize <= yysize1
1080 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1090 # define YYCASE_(N, S) \
1094 YYCASE_(0, YY_("syntax error"));
1095 YYCASE_(1, YY_("syntax error, unexpected %s"));
1096 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1097 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1098 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1099 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1104 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1105 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1110 if (*yymsg_alloc < yysize)
1112 *yymsg_alloc = 2 * yysize;
1113 if (! (yysize <= *yymsg_alloc
1114 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1115 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1119 /* Avoid sprintf, as that infringes on the user's name space.
1120 Don't have undefined behavior even if the translation
1121 produced a string with the wrong number of "%s"s. */
1125 while ((*yyp = *yyformat) != '\0')
1126 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1128 yyp += yytnamerr (yyp, yyarg[yyi++]);
1139 #endif /* YYERROR_VERBOSE */
1141 /*-----------------------------------------------.
1142 | Release the memory associated to this symbol. |
1143 `-----------------------------------------------*/
1146 #if (defined __STDC__ || defined __C99__FUNC__ \
1147 || defined __cplusplus || defined _MSC_VER)
1149 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1152 yydestruct (yymsg, yytype, yyvaluep)
1162 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1175 /* The lookahead symbol. */
1179 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1180 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1181 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1183 #ifndef YY_INITIAL_VALUE
1184 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1187 /* The semantic value of the lookahead symbol. */
1188 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1190 /* Number of syntax errors so far. */
1198 #ifdef YYPARSE_PARAM
1199 #if (defined __STDC__ || defined __C99__FUNC__ \
1200 || defined __cplusplus || defined _MSC_VER)
1202 yyparse (void *YYPARSE_PARAM)
1205 yyparse (YYPARSE_PARAM)
1206 void *YYPARSE_PARAM;
1208 #else /* ! YYPARSE_PARAM */
1209 #if (defined __STDC__ || defined __C99__FUNC__ \
1210 || defined __cplusplus || defined _MSC_VER)
1221 /* Number of tokens to shift before error messages enabled. */
1224 /* The stacks and their tools:
1225 `yyss': related to states.
1226 `yyvs': related to semantic values.
1228 Refer to the stacks through separate pointers, to allow yyoverflow
1229 to reallocate them elsewhere. */
1231 /* The state stack. */
1232 yytype_int16 yyssa[YYINITDEPTH];
1234 yytype_int16 *yyssp;
1236 /* The semantic value stack. */
1237 YYSTYPE yyvsa[YYINITDEPTH];
1241 YYSIZE_T yystacksize;
1245 /* Lookahead token as an internal (translated) token number. */
1247 /* The variables used to return semantic value and location from the
1252 /* Buffer for error messages, and its allocated size. */
1254 char *yymsg = yymsgbuf;
1255 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1258 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1260 /* The number of symbols on the RHS of the reduced rule.
1261 Keep to zero when no symbol should be popped. */
1264 yyssp = yyss = yyssa;
1265 yyvsp = yyvs = yyvsa;
1266 yystacksize = YYINITDEPTH;
1268 YYDPRINTF ((stderr, "Starting parse\n"));
1273 yychar = YYEMPTY; /* Cause a token to be read. */
1276 /*------------------------------------------------------------.
1277 | yynewstate -- Push a new state, which is found in yystate. |
1278 `------------------------------------------------------------*/
1280 /* In all cases, when you get here, the value and location stacks
1281 have just been pushed. So pushing a state here evens the stacks. */
1287 if (yyss + yystacksize - 1 <= yyssp)
1289 /* Get the current used size of the three stacks, in elements. */
1290 YYSIZE_T yysize = yyssp - yyss + 1;
1294 /* Give user a chance to reallocate the stack. Use copies of
1295 these so that the &'s don't force the real ones into
1297 YYSTYPE *yyvs1 = yyvs;
1298 yytype_int16 *yyss1 = yyss;
1300 /* Each stack pointer address is followed by the size of the
1301 data in use in that stack, in bytes. This used to be a
1302 conditional around just the two extra args, but that might
1303 be undefined if yyoverflow is a macro. */
1304 yyoverflow (YY_("memory exhausted"),
1305 &yyss1, yysize * sizeof (*yyssp),
1306 &yyvs1, yysize * sizeof (*yyvsp),
1312 #else /* no yyoverflow */
1313 # ifndef YYSTACK_RELOCATE
1314 goto yyexhaustedlab;
1316 /* Extend the stack our own way. */
1317 if (YYMAXDEPTH <= yystacksize)
1318 goto yyexhaustedlab;
1320 if (YYMAXDEPTH < yystacksize)
1321 yystacksize = YYMAXDEPTH;
1324 yytype_int16 *yyss1 = yyss;
1325 union yyalloc *yyptr =
1326 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1328 goto yyexhaustedlab;
1329 YYSTACK_RELOCATE (yyss_alloc, yyss);
1330 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1331 # undef YYSTACK_RELOCATE
1333 YYSTACK_FREE (yyss1);
1336 #endif /* no yyoverflow */
1338 yyssp = yyss + yysize - 1;
1339 yyvsp = yyvs + yysize - 1;
1341 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1342 (unsigned long int) yystacksize));
1344 if (yyss + yystacksize - 1 <= yyssp)
1348 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1350 if (yystate == YYFINAL)
1360 /* Do appropriate processing given the current state. Read a
1361 lookahead token if we need one and don't already have one. */
1363 /* First try to decide what to do without reference to lookahead token. */
1364 yyn = yypact[yystate];
1365 if (yypact_value_is_default (yyn))
1368 /* Not known => get a lookahead token if don't already have one. */
1370 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1371 if (yychar == YYEMPTY)
1373 YYDPRINTF ((stderr, "Reading a token: "));
1377 if (yychar <= YYEOF)
1379 yychar = yytoken = YYEOF;
1380 YYDPRINTF ((stderr, "Now at end of input.\n"));
1384 yytoken = YYTRANSLATE (yychar);
1385 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1388 /* If the proper action on seeing token YYTOKEN is to reduce or to
1389 detect an error, take that action. */
1391 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1396 if (yytable_value_is_error (yyn))
1402 /* Count tokens shifted since error; after three, turn off error
1407 /* Shift the lookahead token. */
1408 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1410 /* Discard the shifted token. */
1414 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1416 YY_IGNORE_MAYBE_UNINITIALIZED_END
1421 /*-----------------------------------------------------------.
1422 | yydefault -- do the default action for the current state. |
1423 `-----------------------------------------------------------*/
1425 yyn = yydefact[yystate];
1431 /*-----------------------------.
1432 | yyreduce -- Do a reduction. |
1433 `-----------------------------*/
1435 /* yyn is the number of a rule to reduce with. */
1438 /* If YYLEN is nonzero, implement the default value of the action:
1441 Otherwise, the following line sets YYVAL to garbage.
1442 This behavior is undocumented and Bison
1443 users should not rely upon it. Assigning to YYVAL
1444 unconditionally makes the parser a bit smaller, and it avoids a
1445 GCC warning that YYVAL may be used uninitialized. */
1446 yyval = yyvsp[1-yylen];
1449 YY_REDUCE_PRINT (yyn);
1453 /* Line 1792 of yacc.c */
1454 #line 73 "slmod_tracker_0_6_parser.y"
1456 ts_search = (yyvsp[(1) - (1)].sval);
1457 (yyval.sval) = (yyvsp[(1) - (1)].sval);
1462 /* Line 1792 of yacc.c */
1463 #line 80 "slmod_tracker_0_6_parser.y"
1465 if ((yyvsp[(1) - (1)].bval) == false)
1473 /* Line 1792 of yacc.c */
1474 #line 86 "slmod_tracker_0_6_parser.y"
1476 if (strcmp((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)) != 0)
1479 (yyval.sval) = (yyvsp[(1) - (3)].sval);
1484 /* Line 1792 of yacc.c */
1485 #line 92 "slmod_tracker_0_6_parser.y"
1486 {(yyval.sval) = (yyvsp[(1) - (1)].sval);}
1490 /* Line 1792 of yacc.c */
1491 #line 93 "slmod_tracker_0_6_parser.y"
1492 {(yyval.sval) = (yyvsp[(1) - (1)].sval);}
1496 /* Line 1792 of yacc.c */
1497 #line 94 "slmod_tracker_0_6_parser.y"
1498 {(yyval.sval) = (yyvsp[(2) - (3)].sval);}
1502 /* Line 1792 of yacc.c */
1503 #line 95 "slmod_tracker_0_6_parser.y"
1505 if ((yyvsp[(1) - (3)].sval))
1506 (yyval.sval) = (yyvsp[(1) - (3)].sval);
1507 else if ((yyvsp[(3) - (3)].sval))
1508 (yyval.sval) = (yyvsp[(3) - (3)].sval);
1515 /* Line 1792 of yacc.c */
1516 #line 103 "slmod_tracker_0_6_parser.y"
1521 /* Line 1792 of yacc.c */
1522 #line 107 "slmod_tracker_0_6_parser.y"
1523 {(yyval.sval) = map_expr((yyvsp[(1) - (5)].sval), '=', (yyvsp[(4) - (5)].sval));}
1527 /* Line 1792 of yacc.c */
1528 #line 108 "slmod_tracker_0_6_parser.y"
1533 /* Line 1792 of yacc.c */
1534 #line 109 "slmod_tracker_0_6_parser.y"
1539 /* Line 1792 of yacc.c */
1540 #line 110 "slmod_tracker_0_6_parser.y"
1545 /* Line 1792 of yacc.c */
1546 #line 111 "slmod_tracker_0_6_parser.y"
1547 {(yyval.sval) = map_expr((yyvsp[(1) - (6)].sval), '=', (yyvsp[(4) - (6)].sval));}
1551 /* Line 1792 of yacc.c */
1552 #line 112 "slmod_tracker_0_6_parser.y"
1557 /* Line 1792 of yacc.c */
1558 #line 113 "slmod_tracker_0_6_parser.y"
1563 /* Line 1792 of yacc.c */
1564 #line 114 "slmod_tracker_0_6_parser.y"
1569 /* Line 1792 of yacc.c */
1570 #line 118 "slmod_tracker_0_6_parser.y"
1575 /* Line 1792 of yacc.c */
1576 #line 122 "slmod_tracker_0_6_parser.y"
1577 {(yyval.tval) = isodate2unix((yyvsp[(3) - (4)].sval));}
1581 /* Line 1792 of yacc.c */
1582 #line 123 "slmod_tracker_0_6_parser.y"
1583 {(yyval.tval) = atoi((yyvsp[(1) - (1)].sval)) + SPRAW_TIME_OFFSET;}
1587 /* Line 1792 of yacc.c */
1588 #line 1589 "slmod_tracker_0_6_parser.c"
1591 /* User semantic actions sometimes alter yychar, and that requires
1592 that yytoken be updated with the new translation. We take the
1593 approach of translating immediately before every use of yytoken.
1594 One alternative is translating here after every semantic action,
1595 but that translation would be missed if the semantic action invokes
1596 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1597 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1598 incorrect destructor might then be invoked immediately. In the
1599 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1600 to an incorrect destructor call or verbose syntax error message
1601 before the lookahead is translated. */
1602 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1606 YY_STACK_PRINT (yyss, yyssp);
1610 /* Now `shift' the result of the reduction. Determine what state
1611 that goes to, based on the state we popped back to and the rule
1612 number reduced by. */
1616 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1617 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1618 yystate = yytable[yystate];
1620 yystate = yydefgoto[yyn - YYNTOKENS];
1625 /*------------------------------------.
1626 | yyerrlab -- here on detecting error |
1627 `------------------------------------*/
1629 /* Make sure we have latest lookahead translation. See comments at
1630 user semantic actions for why this is necessary. */
1631 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1633 /* If not already recovering from an error, report this error. */
1637 #if ! YYERROR_VERBOSE
1638 yyerror (YY_("syntax error"));
1640 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1643 char const *yymsgp = YY_("syntax error");
1644 int yysyntax_error_status;
1645 yysyntax_error_status = YYSYNTAX_ERROR;
1646 if (yysyntax_error_status == 0)
1648 else if (yysyntax_error_status == 1)
1650 if (yymsg != yymsgbuf)
1651 YYSTACK_FREE (yymsg);
1652 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1656 yymsg_alloc = sizeof yymsgbuf;
1657 yysyntax_error_status = 2;
1661 yysyntax_error_status = YYSYNTAX_ERROR;
1666 if (yysyntax_error_status == 2)
1667 goto yyexhaustedlab;
1669 # undef YYSYNTAX_ERROR
1675 if (yyerrstatus == 3)
1677 /* If just tried and failed to reuse lookahead token after an
1678 error, discard it. */
1680 if (yychar <= YYEOF)
1682 /* Return failure if at end of input. */
1683 if (yychar == YYEOF)
1688 yydestruct ("Error: discarding",
1694 /* Else will try to reuse lookahead token after shifting the error
1699 /*---------------------------------------------------.
1700 | yyerrorlab -- error raised explicitly by YYERROR. |
1701 `---------------------------------------------------*/
1704 /* Pacify compilers like GCC when the user code never invokes
1705 YYERROR and the label yyerrorlab therefore never appears in user
1707 if (/*CONSTCOND*/ 0)
1710 /* Do not reclaim the symbols of the rule which action triggered
1714 YY_STACK_PRINT (yyss, yyssp);
1719 /*-------------------------------------------------------------.
1720 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1721 `-------------------------------------------------------------*/
1723 yyerrstatus = 3; /* Each real token shifted decrements this. */
1727 yyn = yypact[yystate];
1728 if (!yypact_value_is_default (yyn))
1731 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1739 /* Pop the current state because it cannot handle the error token. */
1744 yydestruct ("Error: popping",
1745 yystos[yystate], yyvsp);
1748 YY_STACK_PRINT (yyss, yyssp);
1751 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1753 YY_IGNORE_MAYBE_UNINITIALIZED_END
1756 /* Shift the error token. */
1757 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1763 /*-------------------------------------.
1764 | yyacceptlab -- YYACCEPT comes here. |
1765 `-------------------------------------*/
1770 /*-----------------------------------.
1771 | yyabortlab -- YYABORT comes here. |
1772 `-----------------------------------*/
1777 #if !defined yyoverflow || YYERROR_VERBOSE
1778 /*-------------------------------------------------.
1779 | yyexhaustedlab -- memory exhaustion comes here. |
1780 `-------------------------------------------------*/
1782 yyerror (YY_("memory exhausted"));
1788 if (yychar != YYEMPTY)
1790 /* Make sure we have latest lookahead translation. See comments at
1791 user semantic actions for why this is necessary. */
1792 yytoken = YYTRANSLATE (yychar);
1793 yydestruct ("Cleanup: discarding lookahead",
1796 /* Do not reclaim the symbols of the rule which action triggered
1797 this YYABORT or YYACCEPT. */
1799 YY_STACK_PRINT (yyss, yyssp);
1800 while (yyssp != yyss)
1802 yydestruct ("Cleanup: popping",
1803 yystos[*yyssp], yyvsp);
1808 YYSTACK_FREE (yyss);
1811 if (yymsg != yymsgbuf)
1812 YYSTACK_FREE (yymsg);
1814 /* Make sure YYID is used. */
1815 return YYID (yyresult);
1819 /* Line 2055 of yacc.c */
1820 #line 126 "slmod_tracker_0_6_parser.y"
1823 static time_t isodate2unix(const char *s)
1827 if (strptime(s, "%Y-%m-%dT%H:%M:%SZ", &tm) == NULL)
1832 static void map_type_search(const char *val)
1834 for (struct MDTypeMap *p = MDTypeMap; p->mdtm_value; p++) {
1835 if (strcmp(p->mdtm_value, val) == 0) {
1836 if (p->mdtm_type == -1)
1837 ts_type = SERVICE_OTHER_FILES;
1839 ts_type = p->mdtm_type;
1843 ts_type = SERVICE_OTHER_FILES;
1846 static char *map_expr(const char *attr, char op, const char *val)
1849 bstring q, search, replace;
1850 char *result = NULL;
1852 for (struct spotlight_tracker_map *p = spotlight_tracker_map; p->stm_spotlight_attr; p++) {
1853 if (strcmp(p->stm_spotlight_attr, attr) == 0) {
1854 switch (p->stm_type) {
1858 search = bfromcstr("*");
1859 replace = bfromcstr("");
1860 bfindreplace(q, search, replace, 0);
1861 result = talloc_strdup(ts_slq, bdata(q));
1868 map_type_search(val);
1872 yyerror("unknown Spotlight attribute type");
1885 void yyerror(const char *str)
1888 printf("yyerror: %s\n", str);
1890 LOG(log_error, logtype_sl, "yyerror: %s", str);
1900 * Map a Spotlight RAW query string to a Tracker 0.6 query
1902 * @param[in] slq Spotlight query handle
1903 * @param[out] type mapped file type
1904 * @param[out] search mapped search term
1905 * @return 0 on success, -1 on error
1907 int map_spotlight_to_tracker_0_6_query(slq_t *slq_in,
1912 YY_BUFFER_STATE s = NULL;
1915 s = yy_scan_string(ts_slq->slq_qstring);
1917 /* Default object type is file */
1918 *type = SERVICE_FILES;
1921 EC_ZERO( yyparse() );
1923 *search = ts_search;
1927 yy_delete_buffer(s);
1932 int main(int argc, char **argv)
1938 printf("usage: %s QUERY\n", argv[0]);
1942 ts_slq = talloc_zero(NULL, slq_t);
1943 struct vol *vol = talloc_zero(ts_slq, struct vol);
1944 vol->v_path = "/Volumes/test";
1945 ts_slq->slq_vol = vol;
1947 s = yy_scan_string(argv[1]);
1951 yy_delete_buffer(s);
1954 printf("Tracker 0.6 query: service: %s, searchterm: %s\n",
1955 tracker_type_to_service_name(ts_type), ts_search);