1 /* A Bison parser, made by GNU Bison 2.4.2. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Identify Bison output. */
48 #define YYBISON_VERSION "2.4.2"
51 #define YYSKELETON_NAME "yacc.c"
62 /* Using locations. */
63 #define YYLSP_NEEDED 0
67 /* Copy the first part of user declarations. */
69 /* Line 189 of yacc.c */
72 #include "SearchExpr.h"
73 #include "Scanner.h.in"
75 #include "OtherFunctions.h"
77 #include "libs/common/StringFunctions.h"
81 static char THIS_FILE
[] = __FILE__
;
84 extern wxArrayString _astrParserErrors
;
86 void ParsedSearchExpression(const CSearchExpr
* pexpr
);
87 int yyerror(const char* errstr
);
88 int yyerror(wxString errstr
);
92 /* Line 189 of yacc.c */
95 /* Enabling traces. */
100 /* Enabling verbose error messages. */
101 #ifdef YYERROR_VERBOSE
102 # undef YYERROR_VERBOSE
103 # define YYERROR_VERBOSE 1
105 # define YYERROR_VERBOSE 0
108 /* Enabling the token table. */
109 #ifndef YYTOKEN_TABLE
110 # define YYTOKEN_TABLE 0
117 /* Put the tokens into the symbol table, so that GDB and other debuggers
130 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
131 typedef union YYSTYPE
134 /* Line 214 of yacc.c */
135 #line 22 "./Parser.y"
142 /* Line 214 of yacc.c */
143 #line 144 "Parser.cpp"
145 # define YYSTYPE_IS_TRIVIAL 1
146 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
147 # define YYSTYPE_IS_DECLARED 1
151 /* Copy the second part of user declarations. */
154 /* Line 264 of yacc.c */
155 #line 156 "Parser.cpp"
162 typedef YYTYPE_UINT8 yytype_uint8
;
164 typedef unsigned char yytype_uint8
;
168 typedef YYTYPE_INT8 yytype_int8
;
169 #elif (defined __STDC__ || defined __C99__FUNC__ \
170 || defined __cplusplus || defined _MSC_VER)
171 typedef signed char yytype_int8
;
173 typedef short int yytype_int8
;
177 typedef YYTYPE_UINT16 yytype_uint16
;
179 typedef unsigned short int yytype_uint16
;
183 typedef YYTYPE_INT16 yytype_int16
;
185 typedef short int yytype_int16
;
189 # ifdef __SIZE_TYPE__
190 # define YYSIZE_T __SIZE_TYPE__
191 # elif defined size_t
192 # define YYSIZE_T size_t
193 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
194 || defined __cplusplus || defined _MSC_VER)
195 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
196 # define YYSIZE_T size_t
198 # define YYSIZE_T unsigned int
202 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
205 # if defined YYENABLE_NLS && YYENABLE_NLS
207 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
208 # define YY_(msgid) dgettext ("bison-runtime", msgid)
212 # define YY_(msgid) msgid
216 /* Suppress unused-variable warnings by "using" E. */
217 #if ! defined lint || defined __GNUC__
218 # define YYUSE(e) ((void) (e))
220 # define YYUSE(e) /* empty */
223 /* Identity function, used to suppress warnings about constant conditions. */
227 #if (defined __STDC__ || defined __C99__FUNC__ \
228 || defined __cplusplus || defined _MSC_VER)
241 #if ! defined yyoverflow || YYERROR_VERBOSE
243 /* The parser invokes alloca or malloc; define the necessary symbols. */
245 # ifdef YYSTACK_USE_ALLOCA
246 # if YYSTACK_USE_ALLOCA
248 # define YYSTACK_ALLOC __builtin_alloca
249 # elif defined __BUILTIN_VA_ARG_INCR
250 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
252 # define YYSTACK_ALLOC __alloca
253 # elif defined _MSC_VER
254 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
255 # define alloca _alloca
257 # define YYSTACK_ALLOC alloca
258 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
259 || defined __cplusplus || defined _MSC_VER)
260 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
269 # ifdef YYSTACK_ALLOC
270 /* Pacify GCC's `empty if-body' warning. */
271 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
272 # ifndef YYSTACK_ALLOC_MAXIMUM
273 /* The OS might guarantee only one guard page at the bottom of the stack,
274 and a page size can be as small as 4096 bytes. So we cannot safely
275 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
276 to allow for a few compiler-allocated temporary stack slots. */
277 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
280 # define YYSTACK_ALLOC YYMALLOC
281 # define YYSTACK_FREE YYFREE
282 # ifndef YYSTACK_ALLOC_MAXIMUM
283 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
285 # if (defined __cplusplus && ! defined _STDLIB_H \
286 && ! ((defined YYMALLOC || defined malloc) \
287 && (defined YYFREE || defined free)))
288 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
294 # define YYMALLOC malloc
295 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
296 || defined __cplusplus || defined _MSC_VER)
297 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
302 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
303 || defined __cplusplus || defined _MSC_VER)
304 void free (void *); /* INFRINGES ON USER NAME SPACE */
308 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
311 #if (! defined yyoverflow \
312 && (! defined __cplusplus \
313 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
315 /* A type that is properly aligned for any stack member. */
318 yytype_int16 yyss_alloc
;
322 /* The size of the maximum gap between one aligned stack and the next. */
323 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
325 /* The size of an array large to enough to hold all stacks, each with
327 # define YYSTACK_BYTES(N) \
328 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
329 + YYSTACK_GAP_MAXIMUM)
331 /* Copy COUNT objects from FROM to TO. The source and destination do
334 # if defined __GNUC__ && 1 < __GNUC__
335 # define YYCOPY(To, From, Count) \
336 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
338 # define YYCOPY(To, From, Count) \
342 for (yyi = 0; yyi < (Count); yyi++) \
343 (To)[yyi] = (From)[yyi]; \
349 /* Relocate STACK from its old location to the new one. The
350 local variables YYSIZE and YYSTACKSIZE give the old and new number of
351 elements in the stack, and YYPTR gives the new location of the
352 stack. Advance YYPTR to a properly aligned location for the next
354 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
357 YYSIZE_T yynewbytes; \
358 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
359 Stack = &yyptr->Stack_alloc; \
360 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
361 yyptr += yynewbytes / sizeof (*yyptr); \
367 /* YYFINAL -- State number of the termination state. */
369 /* YYLAST -- Last index in YYTABLE. */
372 /* YYNTOKENS -- Number of terminals. */
374 /* YYNNTS -- Number of nonterminals. */
376 /* YYNRULES -- Number of rules. */
378 /* YYNRULES -- Number of states. */
381 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
383 #define YYMAXUTOK 262
385 #define YYTRANSLATE(YYX) \
386 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
388 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
389 static const yytype_uint8 yytranslate
[] =
391 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 8, 9, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
421 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
423 static const yytype_uint8 yyprhs
[] =
425 0, 0, 3, 5, 7, 10, 12, 16, 20, 24,
426 28, 32, 36, 39, 43, 46, 49, 52, 54
429 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
430 static const yytype_int8 yyrhs
[] =
432 11, 0, -1, 12, -1, 7, -1, 12, 1, -1,
433 13, -1, 12, 4, 12, -1, 12, 5, 12, -1,
434 12, 6, 12, -1, 8, 12, 9, -1, 12, 5,
435 1, -1, 12, 6, 1, -1, 8, 1, -1, 8,
436 12, 1, -1, 4, 1, -1, 5, 1, -1, 6,
437 1, -1, 3, -1, 13, 3, -1
440 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
441 static const yytype_uint8 yyrline
[] =
443 0, 41, 41, 47, 56, 65, 66, 76, 86, 96,
444 101, 107, 113, 118, 124, 129, 134, 141, 146
448 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
449 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
450 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
451 static const char *const yytname
[] =
453 "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
454 "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
455 "searchexpr", "and_strings", 0
460 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
462 static const yytype_uint16 yytoknum
[] =
464 0, 256, 257, 258, 259, 260, 261, 262, 40, 41
468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
469 static const yytype_uint8 yyr1
[] =
471 0, 10, 11, 11, 11, 12, 12, 12, 12, 12,
472 12, 12, 12, 12, 12, 12, 12, 13, 13
475 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
476 static const yytype_uint8 yyr2
[] =
478 0, 2, 1, 1, 2, 1, 3, 3, 3, 3,
479 3, 3, 2, 3, 2, 2, 2, 1, 2
482 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
483 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
484 means the default is an error. */
485 static const yytype_uint8 yydefact
[] =
487 0, 17, 0, 0, 0, 3, 0, 0, 0, 5,
488 14, 15, 16, 12, 0, 1, 4, 0, 0, 0,
489 18, 13, 9, 6, 10, 7, 11, 8
492 /* YYDEFGOTO[NTERM-NUM]. */
493 static const yytype_int8 yydefgoto
[] =
498 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
500 #define YYPACT_NINF -7
501 static const yytype_int8 yypact
[] =
503 38, -7, 1, 2, 6, -7, 13, 15, 34, 29,
504 -7, -7, -7, -7, 0, -7, -7, 44, 19, 25,
505 -7, -7, -7, 30, -7, 4, -7, -7
508 /* YYPGOTO[NTERM-NUM]. */
509 static const yytype_int8 yypgoto
[] =
514 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
515 positive, shift that token. If negative, reduce the rule which
516 number is the opposite. If zero, do what YYDEFACT says.
517 If YYTABLE_NINF, syntax error. */
518 #define YYTABLE_NINF -3
519 static const yytype_int8 yytable
[] =
521 14, 21, 10, 11, 17, 18, 19, 12, 17, 22,
522 19, 23, 25, 27, 13, 15, 1, 2, 3, 4,
523 24, 6, 1, 2, 3, 4, 26, 6, 1, 2,
524 3, 4, 20, 6, -2, 16, 19, 0, 17, 18,
525 19, 1, 2, 3, 4, 5, 6, 1, 2, 3,
529 static const yytype_int8 yycheck
[] =
531 6, 1, 1, 1, 4, 5, 6, 1, 4, 9,
532 6, 17, 18, 19, 1, 0, 3, 4, 5, 6,
533 1, 8, 3, 4, 5, 6, 1, 8, 3, 4,
534 5, 6, 3, 8, 0, 1, 6, -1, 4, 5,
535 6, 3, 4, 5, 6, 7, 8, 3, 4, 5,
539 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
540 symbol of state STATE-NUM. */
541 static const yytype_uint8 yystos
[] =
543 0, 3, 4, 5, 6, 7, 8, 11, 12, 13,
544 1, 1, 1, 1, 12, 0, 1, 4, 5, 6,
545 3, 1, 9, 12, 1, 12, 1, 12
548 #define yyerrok (yyerrstatus = 0)
549 #define yyclearin (yychar = YYEMPTY)
553 #define YYACCEPT goto yyacceptlab
554 #define YYABORT goto yyabortlab
555 #define YYERROR goto yyerrorlab
558 /* Like YYERROR except do call yyerror. This remains here temporarily
559 to ease the transition to the new meaning of YYERROR, for GCC.
560 Once GCC version 2 has supplanted version 1, this can go. However,
561 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
562 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
565 #define YYFAIL goto yyerrlab
567 /* This is here to suppress warnings from the GCC cpp's
568 -Wunused-macros. Normally we don't worry about that warning, but
569 some users do, and we want to make it easy for users to remove
570 YYFAIL uses, which will produce warnings from Bison 2.5. */
573 #define YYRECOVERING() (!!yyerrstatus)
575 #define YYBACKUP(Token, Value) \
577 if (yychar == YYEMPTY && yylen == 1) \
581 yytoken = YYTRANSLATE (yychar); \
587 yyerror (YY_("syntax error: cannot back up")); \
594 #define YYERRCODE 256
597 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
598 If N is 0, then set CURRENT to the empty location which ends
599 the previous symbol: RHS[0] (always defined). */
601 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
602 #ifndef YYLLOC_DEFAULT
603 # define YYLLOC_DEFAULT(Current, Rhs, N) \
607 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
608 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
609 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
610 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
614 (Current).first_line = (Current).last_line = \
615 YYRHSLOC (Rhs, 0).last_line; \
616 (Current).first_column = (Current).last_column = \
617 YYRHSLOC (Rhs, 0).last_column; \
623 /* YY_LOCATION_PRINT -- Print the location on the stream.
624 This macro was not mandated originally: define only if we know
625 we won't break user code: when these are the locations we know. */
627 #ifndef YY_LOCATION_PRINT
628 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
629 # define YY_LOCATION_PRINT(File, Loc) \
630 fprintf (File, "%d.%d-%d.%d", \
631 (Loc).first_line, (Loc).first_column, \
632 (Loc).last_line, (Loc).last_column)
634 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
639 /* YYLEX -- calling `yylex' with the right arguments. */
642 # define YYLEX yylex (YYLEX_PARAM)
644 # define YYLEX yylex ()
647 /* Enable debugging if requested. */
651 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
652 # define YYFPRINTF fprintf
655 # define YYDPRINTF(Args) \
661 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
665 YYFPRINTF (stderr, "%s ", Title); \
666 yy_symbol_print (stderr, \
668 YYFPRINTF (stderr, "\n"); \
673 /*--------------------------------.
674 | Print this symbol on YYOUTPUT. |
675 `--------------------------------*/
678 #if (defined __STDC__ || defined __C99__FUNC__ \
679 || defined __cplusplus || defined _MSC_VER)
681 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
684 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
687 YYSTYPE
const * const yyvaluep
;
693 if (yytype
< YYNTOKENS
)
694 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
706 /*--------------------------------.
707 | Print this symbol on YYOUTPUT. |
708 `--------------------------------*/
710 #if (defined __STDC__ || defined __C99__FUNC__ \
711 || defined __cplusplus || defined _MSC_VER)
713 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
716 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
719 YYSTYPE
const * const yyvaluep
;
722 if (yytype
< YYNTOKENS
)
723 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
725 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
727 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
728 YYFPRINTF (yyoutput
, ")");
731 /*------------------------------------------------------------------.
732 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
734 `------------------------------------------------------------------*/
736 #if (defined __STDC__ || defined __C99__FUNC__ \
737 || defined __cplusplus || defined _MSC_VER)
739 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
742 yy_stack_print (yybottom
, yytop
)
743 yytype_int16
*yybottom
;
747 YYFPRINTF (stderr
, "Stack now");
748 for (; yybottom
<= yytop
; yybottom
++)
750 int yybot
= *yybottom
;
751 YYFPRINTF (stderr
, " %d", yybot
);
753 YYFPRINTF (stderr
, "\n");
756 # define YY_STACK_PRINT(Bottom, Top) \
759 yy_stack_print ((Bottom), (Top)); \
763 /*------------------------------------------------.
764 | Report that the YYRULE is going to be reduced. |
765 `------------------------------------------------*/
767 #if (defined __STDC__ || defined __C99__FUNC__ \
768 || defined __cplusplus || defined _MSC_VER)
770 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
773 yy_reduce_print (yyvsp
, yyrule
)
778 int yynrhs
= yyr2
[yyrule
];
780 unsigned long int yylno
= yyrline
[yyrule
];
781 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
783 /* The symbols being reduced. */
784 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
786 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
787 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
788 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
790 YYFPRINTF (stderr
, "\n");
794 # define YY_REDUCE_PRINT(Rule) \
797 yy_reduce_print (yyvsp, Rule); \
800 /* Nonzero means print parse trace. It is left uninitialized so that
801 multiple parsers can coexist. */
804 # define YYDPRINTF(Args)
805 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
806 # define YY_STACK_PRINT(Bottom, Top)
807 # define YY_REDUCE_PRINT(Rule)
808 #endif /* !YYDEBUG */
811 /* YYINITDEPTH -- initial size of the parser's stacks. */
813 # define YYINITDEPTH 200
816 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
817 if the built-in stack extension method is used).
819 Do not make this value too large; the results are undefined if
820 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
821 evaluated with infinite-precision integer arithmetic. */
824 # define YYMAXDEPTH 10000
832 # if defined __GLIBC__ && defined _STRING_H
833 # define yystrlen strlen
835 /* Return the length of YYSTR. */
836 #if (defined __STDC__ || defined __C99__FUNC__ \
837 || defined __cplusplus || defined _MSC_VER)
839 yystrlen (const char *yystr
)
847 for (yylen
= 0; yystr
[yylen
]; yylen
++)
855 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
856 # define yystpcpy stpcpy
858 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
860 #if (defined __STDC__ || defined __C99__FUNC__ \
861 || defined __cplusplus || defined _MSC_VER)
863 yystpcpy (char *yydest
, const char *yysrc
)
866 yystpcpy (yydest
, yysrc
)
872 const char *yys
= yysrc
;
874 while ((*yyd
++ = *yys
++) != '\0')
883 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
884 quotes and backslashes, so that it's suitable for yyerror. The
885 heuristic is that double-quoting is unnecessary unless the string
886 contains an apostrophe, a comma, or backslash (other than
887 backslash-backslash). YYSTR is taken from yytname. If YYRES is
888 null, do not copy; instead, return the length of what the result
891 yytnamerr (char *yyres
, const char *yystr
)
896 char const *yyp
= yystr
;
903 goto do_not_strip_quotes
;
907 goto do_not_strip_quotes
;
920 do_not_strip_quotes
: ;
924 return yystrlen (yystr
);
926 return yystpcpy (yyres
, yystr
) - yyres
;
930 /* Copy into YYRESULT an error message about the unexpected token
931 YYCHAR while in state YYSTATE. Return the number of bytes copied,
932 including the terminating null byte. If YYRESULT is null, do not
933 copy anything; just return the number of bytes that would be
934 copied. As a special case, return 0 if an ordinary "syntax error"
935 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
938 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
940 int yyn
= yypact
[yystate
];
942 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
946 int yytype
= YYTRANSLATE (yychar
);
947 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
948 YYSIZE_T yysize
= yysize0
;
950 int yysize_overflow
= 0;
951 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
952 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
956 /* This is so xgettext sees the translatable formats that are
957 constructed on the fly. */
958 YY_("syntax error, unexpected %s");
959 YY_("syntax error, unexpected %s, expecting %s");
960 YY_("syntax error, unexpected %s, expecting %s or %s");
961 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
962 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
966 static char const yyunexpected
[] = "syntax error, unexpected %s";
967 static char const yyexpecting
[] = ", expecting %s";
968 static char const yyor
[] = " or %s";
969 char yyformat
[sizeof yyunexpected
970 + sizeof yyexpecting
- 1
971 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
972 * (sizeof yyor
- 1))];
973 char const *yyprefix
= yyexpecting
;
975 /* Start YYX at -YYN if negative to avoid negative indexes in
977 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
979 /* Stay within bounds of both yycheck and yytname. */
980 int yychecklim
= YYLAST
- yyn
+ 1;
981 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
984 yyarg
[0] = yytname
[yytype
];
985 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
987 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
988 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
990 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
994 yyformat
[sizeof yyunexpected
- 1] = '\0';
997 yyarg
[yycount
++] = yytname
[yyx
];
998 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
999 yysize_overflow
|= (yysize1
< yysize
);
1001 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1005 yyf
= YY_(yyformat
);
1006 yysize1
= yysize
+ yystrlen (yyf
);
1007 yysize_overflow
|= (yysize1
< yysize
);
1010 if (yysize_overflow
)
1011 return YYSIZE_MAXIMUM
;
1015 /* Avoid sprintf, as that infringes on the user's name space.
1016 Don't have undefined behavior even if the translation
1017 produced a string with the wrong number of "%s"s. */
1018 char *yyp
= yyresult
;
1020 while ((*yyp
= *yyf
) != '\0')
1022 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1024 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1037 #endif /* YYERROR_VERBOSE */
1040 /*-----------------------------------------------.
1041 | Release the memory associated to this symbol. |
1042 `-----------------------------------------------*/
1045 #if (defined __STDC__ || defined __C99__FUNC__ \
1046 || defined __cplusplus || defined _MSC_VER)
1048 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1051 yydestruct (yymsg
, yytype
, yyvaluep
)
1061 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1071 /* Prevent warnings from -Wmissing-prototypes. */
1072 #ifdef YYPARSE_PARAM
1073 #if defined __STDC__ || defined __cplusplus
1074 int yyparse (void *YYPARSE_PARAM
);
1078 #else /* ! YYPARSE_PARAM */
1079 #if defined __STDC__ || defined __cplusplus
1084 #endif /* ! YYPARSE_PARAM */
1087 /* The lookahead symbol. */
1090 /* The semantic value of the lookahead symbol. */
1093 /* Number of syntax errors so far. */
1098 /*-------------------------.
1099 | yyparse or yypush_parse. |
1100 `-------------------------*/
1102 #ifdef YYPARSE_PARAM
1103 #if (defined __STDC__ || defined __C99__FUNC__ \
1104 || defined __cplusplus || defined _MSC_VER)
1106 yyparse (void *YYPARSE_PARAM
)
1109 yyparse (YYPARSE_PARAM
)
1110 void *YYPARSE_PARAM
;
1112 #else /* ! YYPARSE_PARAM */
1113 #if (defined __STDC__ || defined __C99__FUNC__ \
1114 || defined __cplusplus || defined _MSC_VER)
1127 /* Number of tokens to shift before error messages enabled. */
1130 /* The stacks and their tools:
1131 `yyss': related to states.
1132 `yyvs': related to semantic values.
1134 Refer to the stacks thru separate pointers, to allow yyoverflow
1135 to reallocate them elsewhere. */
1137 /* The state stack. */
1138 yytype_int16 yyssa
[YYINITDEPTH
];
1140 yytype_int16
*yyssp
;
1142 /* The semantic value stack. */
1143 YYSTYPE yyvsa
[YYINITDEPTH
];
1147 YYSIZE_T yystacksize
;
1151 /* Lookahead token as an internal (translated) token number. */
1153 /* The variables used to return semantic value and location from the
1158 /* Buffer for error messages, and its allocated size. */
1160 char *yymsg
= yymsgbuf
;
1161 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1164 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1166 /* The number of symbols on the RHS of the reduced rule.
1167 Keep to zero when no symbol should be popped. */
1173 yystacksize
= YYINITDEPTH
;
1175 YYDPRINTF ((stderr
, "Starting parse\n"));
1180 yychar
= YYEMPTY
; /* Cause a token to be read. */
1182 /* Initialize stack pointers.
1183 Waste one element of value and location stack
1184 so that they stay on the same level as the state stack.
1185 The wasted elements are never initialized. */
1191 /*------------------------------------------------------------.
1192 | yynewstate -- Push a new state, which is found in yystate. |
1193 `------------------------------------------------------------*/
1195 /* In all cases, when you get here, the value and location stacks
1196 have just been pushed. So pushing a state here evens the stacks. */
1202 if (yyss
+ yystacksize
- 1 <= yyssp
)
1204 /* Get the current used size of the three stacks, in elements. */
1205 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1209 /* Give user a chance to reallocate the stack. Use copies of
1210 these so that the &'s don't force the real ones into
1212 YYSTYPE
*yyvs1
= yyvs
;
1213 yytype_int16
*yyss1
= yyss
;
1215 /* Each stack pointer address is followed by the size of the
1216 data in use in that stack, in bytes. This used to be a
1217 conditional around just the two extra args, but that might
1218 be undefined if yyoverflow is a macro. */
1219 yyoverflow (YY_("memory exhausted"),
1220 &yyss1
, yysize
* sizeof (*yyssp
),
1221 &yyvs1
, yysize
* sizeof (*yyvsp
),
1227 #else /* no yyoverflow */
1228 # ifndef YYSTACK_RELOCATE
1229 goto yyexhaustedlab
;
1231 /* Extend the stack our own way. */
1232 if (YYMAXDEPTH
<= yystacksize
)
1233 goto yyexhaustedlab
;
1235 if (YYMAXDEPTH
< yystacksize
)
1236 yystacksize
= YYMAXDEPTH
;
1239 yytype_int16
*yyss1
= yyss
;
1240 union yyalloc
*yyptr
=
1241 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1243 goto yyexhaustedlab
;
1244 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1245 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1246 # undef YYSTACK_RELOCATE
1248 YYSTACK_FREE (yyss1
);
1251 #endif /* no yyoverflow */
1253 yyssp
= yyss
+ yysize
- 1;
1254 yyvsp
= yyvs
+ yysize
- 1;
1256 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1257 (unsigned long int) yystacksize
));
1259 if (yyss
+ yystacksize
- 1 <= yyssp
)
1263 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1265 if (yystate
== YYFINAL
)
1275 /* Do appropriate processing given the current state. Read a
1276 lookahead token if we need one and don't already have one. */
1278 /* First try to decide what to do without reference to lookahead token. */
1279 yyn
= yypact
[yystate
];
1280 if (yyn
== YYPACT_NINF
)
1283 /* Not known => get a lookahead token if don't already have one. */
1285 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1286 if (yychar
== YYEMPTY
)
1288 YYDPRINTF ((stderr
, "Reading a token: "));
1292 if (yychar
<= YYEOF
)
1294 yychar
= yytoken
= YYEOF
;
1295 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1299 yytoken
= YYTRANSLATE (yychar
);
1300 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1303 /* If the proper action on seeing token YYTOKEN is to reduce or to
1304 detect an error, take that action. */
1306 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1311 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1317 /* Count tokens shifted since error; after three, turn off error
1322 /* Shift the lookahead token. */
1323 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1325 /* Discard the shifted token. */
1334 /*-----------------------------------------------------------.
1335 | yydefault -- do the default action for the current state. |
1336 `-----------------------------------------------------------*/
1338 yyn
= yydefact
[yystate
];
1344 /*-----------------------------.
1345 | yyreduce -- Do a reduction. |
1346 `-----------------------------*/
1348 /* yyn is the number of a rule to reduce with. */
1351 /* If YYLEN is nonzero, implement the default value of the action:
1354 Otherwise, the following line sets YYVAL to garbage.
1355 This behavior is undocumented and Bison
1356 users should not rely upon it. Assigning to YYVAL
1357 unconditionally makes the parser a bit smaller, and it avoids a
1358 GCC warning that YYVAL may be used uninitialized. */
1359 yyval
= yyvsp
[1-yylen
];
1362 YY_REDUCE_PRINT (yyn
);
1367 /* Line 1464 of yacc.c */
1368 #line 42 "./Parser.y"
1370 ParsedSearchExpression((yyvsp
[(1) - (1)].pexpr
));
1371 delete (yyvsp
[(1) - (1)].pexpr
);
1378 /* Line 1464 of yacc.c */
1379 #line 48 "./Parser.y"
1381 CSearchExpr
* pexpr
= new CSearchExpr(*(yyvsp
[(1) - (1)].pstr
));
1382 ParsedSearchExpression(pexpr
);
1384 delete (yyvsp
[(1) - (1)].pstr
);
1391 /* Line 1464 of yacc.c */
1392 #line 57 "./Parser.y"
1394 yyerror(wxT("Undefined search expression error"));
1395 delete (yyvsp
[(1) - (2)].pexpr
);
1402 /* Line 1464 of yacc.c */
1403 #line 67 "./Parser.y"
1405 CSearchExpr
* pexpr
= new CSearchExpr
;
1406 pexpr
->Add(SEARCHOP_AND
);
1407 pexpr
->Add((yyvsp
[(1) - (3)].pexpr
));
1408 pexpr
->Add((yyvsp
[(3) - (3)].pexpr
));
1409 (yyval
.pexpr
) = pexpr
;
1410 delete (yyvsp
[(1) - (3)].pexpr
);
1411 delete (yyvsp
[(3) - (3)].pexpr
);
1417 /* Line 1464 of yacc.c */
1418 #line 77 "./Parser.y"
1420 CSearchExpr
* pexpr
= new CSearchExpr
;
1421 pexpr
->Add(SEARCHOP_OR
);
1422 pexpr
->Add((yyvsp
[(1) - (3)].pexpr
));
1423 pexpr
->Add((yyvsp
[(3) - (3)].pexpr
));
1424 (yyval
.pexpr
) = pexpr
;
1425 delete (yyvsp
[(1) - (3)].pexpr
);
1426 delete (yyvsp
[(3) - (3)].pexpr
);
1432 /* Line 1464 of yacc.c */
1433 #line 87 "./Parser.y"
1435 CSearchExpr
* pexpr
= new CSearchExpr
;
1436 pexpr
->Add(SEARCHOP_NOT
);
1437 pexpr
->Add((yyvsp
[(1) - (3)].pexpr
));
1438 pexpr
->Add((yyvsp
[(3) - (3)].pexpr
));
1439 (yyval
.pexpr
) = pexpr
;
1440 delete (yyvsp
[(1) - (3)].pexpr
);
1441 delete (yyvsp
[(3) - (3)].pexpr
);
1447 /* Line 1464 of yacc.c */
1448 #line 97 "./Parser.y"
1450 (yyval
.pexpr
) = (yyvsp
[(2) - (3)].pexpr
);
1456 /* Line 1464 of yacc.c */
1457 #line 102 "./Parser.y"
1459 yyerror(wxT("Missing right operand for OR on search expression"));
1460 delete (yyvsp
[(1) - (3)].pexpr
);
1467 /* Line 1464 of yacc.c */
1468 #line 108 "./Parser.y"
1470 yyerror(wxT("Missing operand for NOT on search expression"));
1471 delete (yyvsp
[(1) - (3)].pexpr
);
1478 /* Line 1464 of yacc.c */
1479 #line 114 "./Parser.y"
1481 yyerror(wxT("Missing left parenthesis on search expression"));
1488 /* Line 1464 of yacc.c */
1489 #line 119 "./Parser.y"
1491 yyerror(wxT("Missing closing parenthesis on search expression"));
1492 delete (yyvsp
[(2) - (3)].pexpr
);
1499 /* Line 1464 of yacc.c */
1500 #line 125 "./Parser.y"
1502 yyerror(wxT("Missing left operand for AND on search expression"));
1509 /* Line 1464 of yacc.c */
1510 #line 130 "./Parser.y"
1512 yyerror(wxT("Missing left operand for OR on search expression"));
1519 /* Line 1464 of yacc.c */
1520 #line 135 "./Parser.y"
1522 yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1529 /* Line 1464 of yacc.c */
1530 #line 142 "./Parser.y"
1532 (yyval
.pexpr
) = new CSearchExpr(*(yyvsp
[(1) - (1)].pstr
));
1533 delete (yyvsp
[(1) - (1)].pstr
);
1539 /* Line 1464 of yacc.c */
1540 #line 147 "./Parser.y"
1542 /*$1->Concatenate($2);
1544 CSearchExpr
* pexpr
= new CSearchExpr
;
1545 pexpr
->Add(SEARCHOP_AND
);
1546 pexpr
->Add((yyvsp
[(1) - (2)].pexpr
));
1547 pexpr
->Add(*(yyvsp
[(2) - (2)].pstr
));
1548 (yyval
.pexpr
) = pexpr
;
1549 delete (yyvsp
[(1) - (2)].pexpr
);
1550 delete (yyvsp
[(2) - (2)].pstr
);
1556 /* Line 1464 of yacc.c */
1557 #line 1558 "Parser.cpp"
1560 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1564 YY_STACK_PRINT (yyss
, yyssp
);
1568 /* Now `shift' the result of the reduction. Determine what state
1569 that goes to, based on the state we popped back to and the rule
1570 number reduced by. */
1574 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1575 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1576 yystate
= yytable
[yystate
];
1578 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1583 /*------------------------------------.
1584 | yyerrlab -- here on detecting error |
1585 `------------------------------------*/
1587 /* If not already recovering from an error, report this error. */
1591 #if ! YYERROR_VERBOSE
1592 yyerror (YY_("syntax error"));
1595 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1596 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1598 YYSIZE_T yyalloc
= 2 * yysize
;
1599 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1600 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1601 if (yymsg
!= yymsgbuf
)
1602 YYSTACK_FREE (yymsg
);
1603 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1605 yymsg_alloc
= yyalloc
;
1609 yymsg_alloc
= sizeof yymsgbuf
;
1613 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1615 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1620 yyerror (YY_("syntax error"));
1622 goto yyexhaustedlab
;
1630 if (yyerrstatus
== 3)
1632 /* If just tried and failed to reuse lookahead token after an
1633 error, discard it. */
1635 if (yychar
<= YYEOF
)
1637 /* Return failure if at end of input. */
1638 if (yychar
== YYEOF
)
1643 yydestruct ("Error: discarding",
1649 /* Else will try to reuse lookahead token after shifting the error
1654 /*---------------------------------------------------.
1655 | yyerrorlab -- error raised explicitly by YYERROR. |
1656 `---------------------------------------------------*/
1659 /* Pacify compilers like GCC when the user code never invokes
1660 YYERROR and the label yyerrorlab therefore never appears in user
1662 if (/*CONSTCOND*/ 0)
1665 /* Do not reclaim the symbols of the rule which action triggered
1669 YY_STACK_PRINT (yyss
, yyssp
);
1674 /*-------------------------------------------------------------.
1675 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1676 `-------------------------------------------------------------*/
1678 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1682 yyn
= yypact
[yystate
];
1683 if (yyn
!= YYPACT_NINF
)
1686 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1694 /* Pop the current state because it cannot handle the error token. */
1699 yydestruct ("Error: popping",
1700 yystos
[yystate
], yyvsp
);
1703 YY_STACK_PRINT (yyss
, yyssp
);
1709 /* Shift the error token. */
1710 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1716 /*-------------------------------------.
1717 | yyacceptlab -- YYACCEPT comes here. |
1718 `-------------------------------------*/
1723 /*-----------------------------------.
1724 | yyabortlab -- YYABORT comes here. |
1725 `-----------------------------------*/
1730 #if !defined(yyoverflow) || YYERROR_VERBOSE
1731 /*-------------------------------------------------.
1732 | yyexhaustedlab -- memory exhaustion comes here. |
1733 `-------------------------------------------------*/
1735 yyerror (YY_("memory exhausted"));
1741 if (yychar
!= YYEMPTY
)
1742 yydestruct ("Cleanup: discarding lookahead",
1744 /* Do not reclaim the symbols of the rule which action triggered
1745 this YYABORT or YYACCEPT. */
1747 YY_STACK_PRINT (yyss
, yyssp
);
1748 while (yyssp
!= yyss
)
1750 yydestruct ("Cleanup: popping",
1751 yystos
[*yyssp
], yyvsp
);
1756 YYSTACK_FREE (yyss
);
1759 if (yymsg
!= yymsgbuf
)
1760 YYSTACK_FREE (yymsg
);
1762 /* Make sure YYID is used. */
1763 return YYID (yyresult
);
1768 /* Line 1684 of yacc.c */
1769 #line 160 "./Parser.y"
1772 int yyerror(const char* errstr
)
1774 // Errors created by yacc generated code
1775 //yyerror ("syntax error: cannot back up");
1776 //yyerror ("syntax error; also virtual memory exhausted");
1777 //yyerror ("syntax error");
1778 //yyerror ("parser stack overflow");
1780 _astrParserErrors
.Add(char2unicode(errstr
));
1781 return EXIT_FAILURE
;
1784 int yyerror(wxString errstr
)
1786 _astrParserErrors
.Add(errstr
);
1787 return EXIT_FAILURE
;