1 /* A Bison parser, made by GNU Bison 3.0.4.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 
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.
11 
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.
16 
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/>.  */
19 
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.
29 
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35 
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.  */
42 
43 /* Identify Bison output.  */
44 #define YYBISON 1
45 
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.0.4"
48 
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers.  */
53 #define YYPURE 0
54 
55 /* Push parsers.  */
56 #define YYPUSH 0
57 
58 /* Pull parsers.  */
59 #define YYPULL 1
60 
61 
62 
63 
64 /* Copy the first part of user declarations.  */
65 #line 1 "./Parser.y" /* yacc.c:339  */
66 
67 #include "SearchExpr.h"
68 #include "Scanner.h"
69 #include "OtherFunctions.h"
70 
71 #include "libs/common/StringFunctions.h"
72 
73 #ifdef _DEBUG
74 #undef THIS_FILE
75 static char THIS_FILE[] = __FILE__;
76 #endif
77 
78 extern wxArrayString _astrParserErrors;
79 
80 int yyerror(const char* errstr);
81 int yyerror(wxString errstr);
82 
83 
84 #line 85 "Parser.cpp" /* yacc.c:339  */
85 
86 # ifndef YY_NULLPTR
87 #  if defined __cplusplus && 201103L <= __cplusplus
88 #   define YY_NULLPTR nullptr
89 #  else
90 #   define YY_NULLPTR 0
91 #  endif
92 # endif
93 
94 /* Enabling verbose error messages.  */
95 #ifdef YYERROR_VERBOSE
96 # undef YYERROR_VERBOSE
97 # define YYERROR_VERBOSE 1
98 #else
99 # define YYERROR_VERBOSE 0
100 #endif
101 
102 /* In a future release of Bison, this section will be replaced
103    by #include "Parser.hpp".  */
104 #ifndef YY_YY_PARSER_HPP_INCLUDED
105 # define YY_YY_PARSER_HPP_INCLUDED
106 /* Debug traces.  */
107 #ifndef YYDEBUG
108 # define YYDEBUG 1
109 #endif
110 #if YYDEBUG
111 extern int yydebug;
112 #endif
113 
114 /* Token type.  */
115 #ifndef YYTOKENTYPE
116 # define YYTOKENTYPE
117   enum yytokentype
118   {
119     TOK_STRING = 258,
120     TOK_AND = 259,
121     TOK_OR = 260,
122     TOK_NOT = 261,
123     TOK_ED2K_LINK = 262
124   };
125 #endif
126 
127 /* Value type.  */
128 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
129 
130 union YYSTYPE
131 {
132 #line 20 "./Parser.y" /* yacc.c:355  */
133 
134 	wxString*		pstr;
135 	CSearchExpr*	pexpr;
136 
137 #line 138 "Parser.cpp" /* yacc.c:355  */
138 };
139 
140 typedef union YYSTYPE YYSTYPE;
141 # define YYSTYPE_IS_TRIVIAL 1
142 # define YYSTYPE_IS_DECLARED 1
143 #endif
144 
145 
146 extern YYSTYPE yylval;
147 
148 int yyparse (void);
149 
150 #endif /* !YY_YY_PARSER_HPP_INCLUDED  */
151 
152 /* Copy the second part of user declarations.  */
153 
154 #line 155 "Parser.cpp" /* yacc.c:358  */
155 
156 #ifdef short
157 # undef short
158 #endif
159 
160 #ifdef YYTYPE_UINT8
161 typedef YYTYPE_UINT8 yytype_uint8;
162 #else
163 typedef unsigned char yytype_uint8;
164 #endif
165 
166 #ifdef YYTYPE_INT8
167 typedef YYTYPE_INT8 yytype_int8;
168 #else
169 typedef signed char yytype_int8;
170 #endif
171 
172 #ifdef YYTYPE_UINT16
173 typedef YYTYPE_UINT16 yytype_uint16;
174 #else
175 typedef unsigned short int yytype_uint16;
176 #endif
177 
178 #ifdef YYTYPE_INT16
179 typedef YYTYPE_INT16 yytype_int16;
180 #else
181 typedef short int yytype_int16;
182 #endif
183 
184 #ifndef YYSIZE_T
185 # ifdef __SIZE_TYPE__
186 #  define YYSIZE_T __SIZE_TYPE__
187 # elif defined size_t
188 #  define YYSIZE_T size_t
189 # elif ! defined YYSIZE_T
190 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
191 #  define YYSIZE_T size_t
192 # else
193 #  define YYSIZE_T unsigned int
194 # endif
195 #endif
196 
197 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
198 
199 #ifndef YY_
200 # if defined YYENABLE_NLS && YYENABLE_NLS
201 #  if ENABLE_NLS
202 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
203 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
204 #  endif
205 # endif
206 # ifndef YY_
207 #  define YY_(Msgid) Msgid
208 # endif
209 #endif
210 
211 #ifndef YY_ATTRIBUTE
212 # if (defined __GNUC__                                               \
213       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
214      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
215 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
216 # else
217 #  define YY_ATTRIBUTE(Spec) /* empty */
218 # endif
219 #endif
220 
221 #ifndef YY_ATTRIBUTE_PURE
222 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
223 #endif
224 
225 #ifndef YY_ATTRIBUTE_UNUSED
226 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
227 #endif
228 
229 #if !defined _Noreturn \
230      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
231 # if defined _MSC_VER && 1200 <= _MSC_VER
232 #  define _Noreturn __declspec (noreturn)
233 # else
234 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
235 # endif
236 #endif
237 
238 /* Suppress unused-variable warnings by "using" E.  */
239 #if ! defined lint || defined __GNUC__
240 # define YYUSE(E) ((void) (E))
241 #else
242 # define YYUSE(E) /* empty */
243 #endif
244 
245 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
246 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
247 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
248     _Pragma ("GCC diagnostic push") \
249     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
250     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
251 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
252     _Pragma ("GCC diagnostic pop")
253 #else
254 # define YY_INITIAL_VALUE(Value) Value
255 #endif
256 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
257 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
258 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
259 #endif
260 #ifndef YY_INITIAL_VALUE
261 # define YY_INITIAL_VALUE(Value) /* Nothing. */
262 #endif
263 
264 
265 #if ! defined yyoverflow || YYERROR_VERBOSE
266 
267 /* The parser invokes alloca or malloc; define the necessary symbols.  */
268 
269 # ifdef YYSTACK_USE_ALLOCA
270 #  if YYSTACK_USE_ALLOCA
271 #   ifdef __GNUC__
272 #    define YYSTACK_ALLOC __builtin_alloca
273 #   elif defined __BUILTIN_VA_ARG_INCR
274 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
275 #   elif defined _AIX
276 #    define YYSTACK_ALLOC __alloca
277 #   elif defined _MSC_VER
278 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
279 #    define alloca _alloca
280 #   else
281 #    define YYSTACK_ALLOC alloca
282 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
283 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
285 #     ifndef EXIT_SUCCESS
286 #      define EXIT_SUCCESS 0
287 #     endif
288 #    endif
289 #   endif
290 #  endif
291 # endif
292 
293 # ifdef YYSTACK_ALLOC
294    /* Pacify GCC's 'empty if-body' warning.  */
295 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
296 #  ifndef YYSTACK_ALLOC_MAXIMUM
297     /* The OS might guarantee only one guard page at the bottom of the stack,
298        and a page size can be as small as 4096 bytes.  So we cannot safely
299        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
300        to allow for a few compiler-allocated temporary stack slots.  */
301 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
302 #  endif
303 # else
304 #  define YYSTACK_ALLOC YYMALLOC
305 #  define YYSTACK_FREE YYFREE
306 #  ifndef YYSTACK_ALLOC_MAXIMUM
307 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
308 #  endif
309 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
310        && ! ((defined YYMALLOC || defined malloc) \
311              && (defined YYFREE || defined free)))
312 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
313 #   ifndef EXIT_SUCCESS
314 #    define EXIT_SUCCESS 0
315 #   endif
316 #  endif
317 #  ifndef YYMALLOC
318 #   define YYMALLOC malloc
319 #   if ! defined malloc && ! defined EXIT_SUCCESS
320 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
321 #   endif
322 #  endif
323 #  ifndef YYFREE
324 #   define YYFREE free
325 #   if ! defined free && ! defined EXIT_SUCCESS
326 void free (void *); /* INFRINGES ON USER NAME SPACE */
327 #   endif
328 #  endif
329 # endif
330 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
331 
332 
333 #if (! defined yyoverflow \
334      && (! defined __cplusplus \
335          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
336 
337 /* A type that is properly aligned for any stack member.  */
338 union yyalloc
339 {
340   yytype_int16 yyss_alloc;
341   YYSTYPE yyvs_alloc;
342 };
343 
344 /* The size of the maximum gap between one aligned stack and the next.  */
345 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
346 
347 /* The size of an array large to enough to hold all stacks, each with
348    N elements.  */
349 # define YYSTACK_BYTES(N) \
350      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
351       + YYSTACK_GAP_MAXIMUM)
352 
353 # define YYCOPY_NEEDED 1
354 
355 /* Relocate STACK from its old location to the new one.  The
356    local variables YYSIZE and YYSTACKSIZE give the old and new number of
357    elements in the stack, and YYPTR gives the new location of the
358    stack.  Advance YYPTR to a properly aligned location for the next
359    stack.  */
360 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
361     do                                                                  \
362       {                                                                 \
363         YYSIZE_T yynewbytes;                                            \
364         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
365         Stack = &yyptr->Stack_alloc;                                    \
366         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
367         yyptr += yynewbytes / sizeof (*yyptr);                          \
368       }                                                                 \
369     while (0)
370 
371 #endif
372 
373 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
374 /* Copy COUNT objects from SRC to DST.  The source and destination do
375    not overlap.  */
376 # ifndef YYCOPY
377 #  if defined __GNUC__ && 1 < __GNUC__
378 #   define YYCOPY(Dst, Src, Count) \
379       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
380 #  else
381 #   define YYCOPY(Dst, Src, Count)              \
382       do                                        \
383         {                                       \
384           YYSIZE_T yyi;                         \
385           for (yyi = 0; yyi < (Count); yyi++)   \
386             (Dst)[yyi] = (Src)[yyi];            \
387         }                                       \
388       while (0)
389 #  endif
390 # endif
391 #endif /* !YYCOPY_NEEDED */
392 
393 /* YYFINAL -- State number of the termination state.  */
394 #define YYFINAL  15
395 /* YYLAST -- Last index in YYTABLE.  */
396 #define YYLAST   52
397 
398 /* YYNTOKENS -- Number of terminals.  */
399 #define YYNTOKENS  10
400 /* YYNNTS -- Number of nonterminals.  */
401 #define YYNNTS  4
402 /* YYNRULES -- Number of rules.  */
403 #define YYNRULES  18
404 /* YYNSTATES -- Number of states.  */
405 #define YYNSTATES  28
406 
407 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
408    by yylex, with out-of-bounds checking.  */
409 #define YYUNDEFTOK  2
410 #define YYMAXUTOK   262
411 
412 #define YYTRANSLATE(YYX)                                                \
413   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
414 
415 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
416    as returned by yylex, without out-of-bounds checking.  */
417 static const yytype_uint8 yytranslate[] =
418 {
419        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
422        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
423        8,     9,     2,     2,     2,     2,     2,     2,     2,     2,
424        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
425        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
426        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
427        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
428        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
429        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
430        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
431        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
432        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
433        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
434        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
435        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
436        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
437        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
438        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
444        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
445        5,     6,     7
446 };
447 
448 #if YYDEBUG
449   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
450 static const yytype_uint8 yyrline[] =
451 {
452        0,    39,    39,    45,    54,    63,    64,    74,    84,    94,
453       99,   105,   111,   116,   122,   127,   132,   139,   144
454 };
455 #endif
456 
457 #if YYDEBUG || YYERROR_VERBOSE || 0
458 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
459    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
460 static const char *const yytname[] =
461 {
462   "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
463   "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
464   "searchexpr", "and_strings", YY_NULLPTR
465 };
466 #endif
467 
468 # ifdef YYPRINT
469 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
470    (internal) symbol number NUM (which must be that of a token).  */
471 static const yytype_uint16 yytoknum[] =
472 {
473        0,   256,   257,   258,   259,   260,   261,   262,    40,    41
474 };
475 # endif
476 
477 #define YYPACT_NINF -7
478 
479 #define yypact_value_is_default(Yystate) \
480   (!!((Yystate) == (-7)))
481 
482 #define YYTABLE_NINF -3
483 
484 #define yytable_value_is_error(Yytable_value) \
485   0
486 
487   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
488      STATE-NUM.  */
489 static const yytype_int8 yypact[] =
490 {
491       38,    -7,     1,     2,     6,    -7,    13,    15,    34,    29,
492       -7,    -7,    -7,    -7,     0,    -7,    -7,    44,    19,    25,
493       -7,    -7,    -7,    30,    -7,     4,    -7,    -7
494 };
495 
496   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
497      Performed when YYTABLE does not specify something else to do.  Zero
498      means the default is an error.  */
499 static const yytype_uint8 yydefact[] =
500 {
501        0,    17,     0,     0,     0,     3,     0,     0,     0,     5,
502       14,    15,    16,    12,     0,     1,     4,     0,     0,     0,
503       18,    13,     9,     6,    10,     7,    11,     8
504 };
505 
506   /* YYPGOTO[NTERM-NUM].  */
507 static const yytype_int8 yypgoto[] =
508 {
509       -7,    -7,    -6,    -7
510 };
511 
512   /* YYDEFGOTO[NTERM-NUM].  */
513 static const yytype_int8 yydefgoto[] =
514 {
515       -1,     7,     8,     9
516 };
517 
518   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
519      positive, shift that token.  If negative, reduce the rule whose
520      number is the opposite.  If YYTABLE_NINF, syntax error.  */
521 static const yytype_int8 yytable[] =
522 {
523       14,    21,    10,    11,    17,    18,    19,    12,    17,    22,
524       19,    23,    25,    27,    13,    15,     1,     2,     3,     4,
525       24,     6,     1,     2,     3,     4,    26,     6,     1,     2,
526        3,     4,    20,     6,    -2,    16,    19,     0,    17,    18,
527       19,     1,     2,     3,     4,     5,     6,     1,     2,     3,
528        4,     0,     6
529 };
530 
531 static const yytype_int8 yycheck[] =
532 {
533        6,     1,     1,     1,     4,     5,     6,     1,     4,     9,
534        6,    17,    18,    19,     1,     0,     3,     4,     5,     6,
535        1,     8,     3,     4,     5,     6,     1,     8,     3,     4,
536        5,     6,     3,     8,     0,     1,     6,    -1,     4,     5,
537        6,     3,     4,     5,     6,     7,     8,     3,     4,     5,
538        6,    -1,     8
539 };
540 
541   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
542      symbol of state STATE-NUM.  */
543 static const yytype_uint8 yystos[] =
544 {
545        0,     3,     4,     5,     6,     7,     8,    11,    12,    13,
546        1,     1,     1,     1,    12,     0,     1,     4,     5,     6,
547        3,     1,     9,    12,     1,    12,     1,    12
548 };
549 
550   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
551 static const yytype_uint8 yyr1[] =
552 {
553        0,    10,    11,    11,    11,    12,    12,    12,    12,    12,
554       12,    12,    12,    12,    12,    12,    12,    13,    13
555 };
556 
557   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
558 static const yytype_uint8 yyr2[] =
559 {
560        0,     2,     1,     1,     2,     1,     3,     3,     3,     3,
561        3,     3,     2,     3,     2,     2,     2,     1,     2
562 };
563 
564 
565 #define yyerrok         (yyerrstatus = 0)
566 #define yyclearin       (yychar = YYEMPTY)
567 #define YYEMPTY         (-2)
568 #define YYEOF           0
569 
570 #define YYACCEPT        goto yyacceptlab
571 #define YYABORT         goto yyabortlab
572 #define YYERROR         goto yyerrorlab
573 
574 
575 #define YYRECOVERING()  (!!yyerrstatus)
576 
577 #define YYBACKUP(Token, Value)                                  \
578 do                                                              \
579   if (yychar == YYEMPTY)                                        \
580     {                                                           \
581       yychar = (Token);                                         \
582       yylval = (Value);                                         \
583       YYPOPSTACK (yylen);                                       \
584       yystate = *yyssp;                                         \
585       goto yybackup;                                            \
586     }                                                           \
587   else                                                          \
588     {                                                           \
589       yyerror (YY_("syntax error: cannot back up")); \
590       YYERROR;                                                  \
591     }                                                           \
592 while (0)
593 
594 /* Error token number */
595 #define YYTERROR        1
596 #define YYERRCODE       256
597 
598 
599 
600 /* Enable debugging if requested.  */
601 #if YYDEBUG
602 
603 # ifndef YYFPRINTF
604 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
605 #  define YYFPRINTF fprintf
606 # endif
607 
608 # define YYDPRINTF(Args)                        \
609 do {                                            \
610   if (yydebug)                                  \
611     YYFPRINTF Args;                             \
612 } while (0)
613 
614 /* This macro is provided for backward compatibility. */
615 #ifndef YY_LOCATION_PRINT
616 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
617 #endif
618 
619 
620 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
621 do {                                                                      \
622   if (yydebug)                                                            \
623     {                                                                     \
624       YYFPRINTF (stderr, "%s ", Title);                                   \
625       yy_symbol_print (stderr,                                            \
626                   Type, Value); \
627       YYFPRINTF (stderr, "\n");                                           \
628     }                                                                     \
629 } while (0)
630 
631 
632 /*----------------------------------------.
633 | Print this symbol's value on YYOUTPUT.  |
634 `----------------------------------------*/
635 
636 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)637 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
638 {
639   FILE *yyo = yyoutput;
640   YYUSE (yyo);
641   if (!yyvaluep)
642     return;
643 # ifdef YYPRINT
644   if (yytype < YYNTOKENS)
645     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
646 # endif
647   YYUSE (yytype);
648 }
649 
650 
651 /*--------------------------------.
652 | Print this symbol on YYOUTPUT.  |
653 `--------------------------------*/
654 
655 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)656 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
657 {
658   YYFPRINTF (yyoutput, "%s %s (",
659              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
660 
661   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
662   YYFPRINTF (yyoutput, ")");
663 }
664 
665 /*------------------------------------------------------------------.
666 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
667 | TOP (included).                                                   |
668 `------------------------------------------------------------------*/
669 
670 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)671 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
672 {
673   YYFPRINTF (stderr, "Stack now");
674   for (; yybottom <= yytop; yybottom++)
675     {
676       int yybot = *yybottom;
677       YYFPRINTF (stderr, " %d", yybot);
678     }
679   YYFPRINTF (stderr, "\n");
680 }
681 
682 # define YY_STACK_PRINT(Bottom, Top)                            \
683 do {                                                            \
684   if (yydebug)                                                  \
685     yy_stack_print ((Bottom), (Top));                           \
686 } while (0)
687 
688 
689 /*------------------------------------------------.
690 | Report that the YYRULE is going to be reduced.  |
691 `------------------------------------------------*/
692 
693 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)694 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
695 {
696   unsigned long int yylno = yyrline[yyrule];
697   int yynrhs = yyr2[yyrule];
698   int yyi;
699   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
700              yyrule - 1, yylno);
701   /* The symbols being reduced.  */
702   for (yyi = 0; yyi < yynrhs; yyi++)
703     {
704       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
705       yy_symbol_print (stderr,
706                        yystos[yyssp[yyi + 1 - yynrhs]],
707                        &(yyvsp[(yyi + 1) - (yynrhs)])
708                                               );
709       YYFPRINTF (stderr, "\n");
710     }
711 }
712 
713 # define YY_REDUCE_PRINT(Rule)          \
714 do {                                    \
715   if (yydebug)                          \
716     yy_reduce_print (yyssp, yyvsp, Rule); \
717 } while (0)
718 
719 /* Nonzero means print parse trace.  It is left uninitialized so that
720    multiple parsers can coexist.  */
721 int yydebug;
722 #else /* !YYDEBUG */
723 # define YYDPRINTF(Args)
724 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
725 # define YY_STACK_PRINT(Bottom, Top)
726 # define YY_REDUCE_PRINT(Rule)
727 #endif /* !YYDEBUG */
728 
729 
730 /* YYINITDEPTH -- initial size of the parser's stacks.  */
731 #ifndef YYINITDEPTH
732 # define YYINITDEPTH 200
733 #endif
734 
735 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
736    if the built-in stack extension method is used).
737 
738    Do not make this value too large; the results are undefined if
739    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
740    evaluated with infinite-precision integer arithmetic.  */
741 
742 #ifndef YYMAXDEPTH
743 # define YYMAXDEPTH 10000
744 #endif
745 
746 
747 #if YYERROR_VERBOSE
748 
749 # ifndef yystrlen
750 #  if defined __GLIBC__ && defined _STRING_H
751 #   define yystrlen strlen
752 #  else
753 /* Return the length of YYSTR.  */
754 static YYSIZE_T
yystrlen(const char * yystr)755 yystrlen (const char *yystr)
756 {
757   YYSIZE_T yylen;
758   for (yylen = 0; yystr[yylen]; yylen++)
759     continue;
760   return yylen;
761 }
762 #  endif
763 # endif
764 
765 # ifndef yystpcpy
766 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
767 #   define yystpcpy stpcpy
768 #  else
769 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
770    YYDEST.  */
771 static char *
yystpcpy(char * yydest,const char * yysrc)772 yystpcpy (char *yydest, const char *yysrc)
773 {
774   char *yyd = yydest;
775   const char *yys = yysrc;
776 
777   while ((*yyd++ = *yys++) != '\0')
778     continue;
779 
780   return yyd - 1;
781 }
782 #  endif
783 # endif
784 
785 # ifndef yytnamerr
786 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
787    quotes and backslashes, so that it's suitable for yyerror.  The
788    heuristic is that double-quoting is unnecessary unless the string
789    contains an apostrophe, a comma, or backslash (other than
790    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
791    null, do not copy; instead, return the length of what the result
792    would have been.  */
793 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)794 yytnamerr (char *yyres, const char *yystr)
795 {
796   if (*yystr == '"')
797     {
798       YYSIZE_T yyn = 0;
799       char const *yyp = yystr;
800 
801       for (;;)
802         switch (*++yyp)
803           {
804           case '\'':
805           case ',':
806             goto do_not_strip_quotes;
807 
808           case '\\':
809             if (*++yyp != '\\')
810               goto do_not_strip_quotes;
811             /* Fall through.  */
812           default:
813             if (yyres)
814               yyres[yyn] = *yyp;
815             yyn++;
816             break;
817 
818           case '"':
819             if (yyres)
820               yyres[yyn] = '\0';
821             return yyn;
822           }
823     do_not_strip_quotes: ;
824     }
825 
826   if (! yyres)
827     return yystrlen (yystr);
828 
829   return yystpcpy (yyres, yystr) - yyres;
830 }
831 # endif
832 
833 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
834    about the unexpected token YYTOKEN for the state stack whose top is
835    YYSSP.
836 
837    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
838    not large enough to hold the message.  In that case, also set
839    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
840    required number of bytes is too large to store.  */
841 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)842 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
843                 yytype_int16 *yyssp, int yytoken)
844 {
845   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
846   YYSIZE_T yysize = yysize0;
847   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
848   /* Internationalized format string. */
849   const char *yyformat = YY_NULLPTR;
850   /* Arguments of yyformat. */
851   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
852   /* Number of reported tokens (one for the "unexpected", one per
853      "expected"). */
854   int yycount = 0;
855 
856   /* There are many possibilities here to consider:
857      - If this state is a consistent state with a default action, then
858        the only way this function was invoked is if the default action
859        is an error action.  In that case, don't check for expected
860        tokens because there are none.
861      - The only way there can be no lookahead present (in yychar) is if
862        this state is a consistent state with a default action.  Thus,
863        detecting the absence of a lookahead is sufficient to determine
864        that there is no unexpected or expected token to report.  In that
865        case, just report a simple "syntax error".
866      - Don't assume there isn't a lookahead just because this state is a
867        consistent state with a default action.  There might have been a
868        previous inconsistent state, consistent state with a non-default
869        action, or user semantic action that manipulated yychar.
870      - Of course, the expected token list depends on states to have
871        correct lookahead information, and it depends on the parser not
872        to perform extra reductions after fetching a lookahead from the
873        scanner and before detecting a syntax error.  Thus, state merging
874        (from LALR or IELR) and default reductions corrupt the expected
875        token list.  However, the list is correct for canonical LR with
876        one exception: it will still contain any token that will not be
877        accepted due to an error action in a later state.
878   */
879   if (yytoken != YYEMPTY)
880     {
881       int yyn = yypact[*yyssp];
882       yyarg[yycount++] = yytname[yytoken];
883       if (!yypact_value_is_default (yyn))
884         {
885           /* Start YYX at -YYN if negative to avoid negative indexes in
886              YYCHECK.  In other words, skip the first -YYN actions for
887              this state because they are default actions.  */
888           int yyxbegin = yyn < 0 ? -yyn : 0;
889           /* Stay within bounds of both yycheck and yytname.  */
890           int yychecklim = YYLAST - yyn + 1;
891           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
892           int yyx;
893 
894           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
895             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
896                 && !yytable_value_is_error (yytable[yyx + yyn]))
897               {
898                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
899                   {
900                     yycount = 1;
901                     yysize = yysize0;
902                     break;
903                   }
904                 yyarg[yycount++] = yytname[yyx];
905                 {
906                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
907                   if (! (yysize <= yysize1
908                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
909                     return 2;
910                   yysize = yysize1;
911                 }
912               }
913         }
914     }
915 
916   switch (yycount)
917     {
918 # define YYCASE_(N, S)                      \
919       case N:                               \
920         yyformat = S;                       \
921       break
922       YYCASE_(0, YY_("syntax error"));
923       YYCASE_(1, YY_("syntax error, unexpected %s"));
924       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
925       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
926       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
927       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
928 # undef YYCASE_
929     }
930 
931   {
932     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
933     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
934       return 2;
935     yysize = yysize1;
936   }
937 
938   if (*yymsg_alloc < yysize)
939     {
940       *yymsg_alloc = 2 * yysize;
941       if (! (yysize <= *yymsg_alloc
942              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
943         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
944       return 1;
945     }
946 
947   /* Avoid sprintf, as that infringes on the user's name space.
948      Don't have undefined behavior even if the translation
949      produced a string with the wrong number of "%s"s.  */
950   {
951     char *yyp = *yymsg;
952     int yyi = 0;
953     while ((*yyp = *yyformat) != '\0')
954       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
955         {
956           yyp += yytnamerr (yyp, yyarg[yyi++]);
957           yyformat += 2;
958         }
959       else
960         {
961           yyp++;
962           yyformat++;
963         }
964   }
965   return 0;
966 }
967 #endif /* YYERROR_VERBOSE */
968 
969 /*-----------------------------------------------.
970 | Release the memory associated to this symbol.  |
971 `-----------------------------------------------*/
972 
973 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)974 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
975 {
976   YYUSE (yyvaluep);
977   if (!yymsg)
978     yymsg = "Deleting";
979   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
980 
981   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
982   YYUSE (yytype);
983   YY_IGNORE_MAYBE_UNINITIALIZED_END
984 }
985 
986 
987 
988 
989 /* The lookahead symbol.  */
990 int yychar;
991 
992 /* The semantic value of the lookahead symbol.  */
993 YYSTYPE yylval;
994 /* Number of syntax errors so far.  */
995 int yynerrs;
996 
997 
998 /*----------.
999 | yyparse.  |
1000 `----------*/
1001 
1002 int
yyparse(void)1003 yyparse (void)
1004 {
1005     int yystate;
1006     /* Number of tokens to shift before error messages enabled.  */
1007     int yyerrstatus;
1008 
1009     /* The stacks and their tools:
1010        'yyss': related to states.
1011        'yyvs': related to semantic values.
1012 
1013        Refer to the stacks through separate pointers, to allow yyoverflow
1014        to reallocate them elsewhere.  */
1015 
1016     /* The state stack.  */
1017     yytype_int16 yyssa[YYINITDEPTH];
1018     yytype_int16 *yyss;
1019     yytype_int16 *yyssp;
1020 
1021     /* The semantic value stack.  */
1022     YYSTYPE yyvsa[YYINITDEPTH];
1023     YYSTYPE *yyvs;
1024     YYSTYPE *yyvsp;
1025 
1026     YYSIZE_T yystacksize;
1027 
1028   int yyn;
1029   int yyresult;
1030   /* Lookahead token as an internal (translated) token number.  */
1031   int yytoken = 0;
1032   /* The variables used to return semantic value and location from the
1033      action routines.  */
1034   YYSTYPE yyval;
1035 
1036 #if YYERROR_VERBOSE
1037   /* Buffer for error messages, and its allocated size.  */
1038   char yymsgbuf[128];
1039   char *yymsg = yymsgbuf;
1040   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1041 #endif
1042 
1043 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1044 
1045   /* The number of symbols on the RHS of the reduced rule.
1046      Keep to zero when no symbol should be popped.  */
1047   int yylen = 0;
1048 
1049   yyssp = yyss = yyssa;
1050   yyvsp = yyvs = yyvsa;
1051   yystacksize = YYINITDEPTH;
1052 
1053   YYDPRINTF ((stderr, "Starting parse\n"));
1054 
1055   yystate = 0;
1056   yyerrstatus = 0;
1057   yynerrs = 0;
1058   yychar = YYEMPTY; /* Cause a token to be read.  */
1059   goto yysetstate;
1060 
1061 /*------------------------------------------------------------.
1062 | yynewstate -- Push a new state, which is found in yystate.  |
1063 `------------------------------------------------------------*/
1064  yynewstate:
1065   /* In all cases, when you get here, the value and location stacks
1066      have just been pushed.  So pushing a state here evens the stacks.  */
1067   yyssp++;
1068 
1069  yysetstate:
1070   *yyssp = yystate;
1071 
1072   if (yyss + yystacksize - 1 <= yyssp)
1073     {
1074       /* Get the current used size of the three stacks, in elements.  */
1075       YYSIZE_T yysize = yyssp - yyss + 1;
1076 
1077 #ifdef yyoverflow
1078       {
1079         /* Give user a chance to reallocate the stack.  Use copies of
1080            these so that the &'s don't force the real ones into
1081            memory.  */
1082         YYSTYPE *yyvs1 = yyvs;
1083         yytype_int16 *yyss1 = yyss;
1084 
1085         /* Each stack pointer address is followed by the size of the
1086            data in use in that stack, in bytes.  This used to be a
1087            conditional around just the two extra args, but that might
1088            be undefined if yyoverflow is a macro.  */
1089         yyoverflow (YY_("memory exhausted"),
1090                     &yyss1, yysize * sizeof (*yyssp),
1091                     &yyvs1, yysize * sizeof (*yyvsp),
1092                     &yystacksize);
1093 
1094         yyss = yyss1;
1095         yyvs = yyvs1;
1096       }
1097 #else /* no yyoverflow */
1098 # ifndef YYSTACK_RELOCATE
1099       goto yyexhaustedlab;
1100 # else
1101       /* Extend the stack our own way.  */
1102       if (YYMAXDEPTH <= yystacksize)
1103         goto yyexhaustedlab;
1104       yystacksize *= 2;
1105       if (YYMAXDEPTH < yystacksize)
1106         yystacksize = YYMAXDEPTH;
1107 
1108       {
1109         yytype_int16 *yyss1 = yyss;
1110         union yyalloc *yyptr =
1111           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1112         if (! yyptr)
1113           goto yyexhaustedlab;
1114         YYSTACK_RELOCATE (yyss_alloc, yyss);
1115         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1116 #  undef YYSTACK_RELOCATE
1117         if (yyss1 != yyssa)
1118           YYSTACK_FREE (yyss1);
1119       }
1120 # endif
1121 #endif /* no yyoverflow */
1122 
1123       yyssp = yyss + yysize - 1;
1124       yyvsp = yyvs + yysize - 1;
1125 
1126       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1127                   (unsigned long int) yystacksize));
1128 
1129       if (yyss + yystacksize - 1 <= yyssp)
1130         YYABORT;
1131     }
1132 
1133   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1134 
1135   if (yystate == YYFINAL)
1136     YYACCEPT;
1137 
1138   goto yybackup;
1139 
1140 /*-----------.
1141 | yybackup.  |
1142 `-----------*/
1143 yybackup:
1144 
1145   /* Do appropriate processing given the current state.  Read a
1146      lookahead token if we need one and don't already have one.  */
1147 
1148   /* First try to decide what to do without reference to lookahead token.  */
1149   yyn = yypact[yystate];
1150   if (yypact_value_is_default (yyn))
1151     goto yydefault;
1152 
1153   /* Not known => get a lookahead token if don't already have one.  */
1154 
1155   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1156   if (yychar == YYEMPTY)
1157     {
1158       YYDPRINTF ((stderr, "Reading a token: "));
1159       yychar = yylex ();
1160     }
1161 
1162   if (yychar <= YYEOF)
1163     {
1164       yychar = yytoken = YYEOF;
1165       YYDPRINTF ((stderr, "Now at end of input.\n"));
1166     }
1167   else
1168     {
1169       yytoken = YYTRANSLATE (yychar);
1170       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1171     }
1172 
1173   /* If the proper action on seeing token YYTOKEN is to reduce or to
1174      detect an error, take that action.  */
1175   yyn += yytoken;
1176   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1177     goto yydefault;
1178   yyn = yytable[yyn];
1179   if (yyn <= 0)
1180     {
1181       if (yytable_value_is_error (yyn))
1182         goto yyerrlab;
1183       yyn = -yyn;
1184       goto yyreduce;
1185     }
1186 
1187   /* Count tokens shifted since error; after three, turn off error
1188      status.  */
1189   if (yyerrstatus)
1190     yyerrstatus--;
1191 
1192   /* Shift the lookahead token.  */
1193   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1194 
1195   /* Discard the shifted token.  */
1196   yychar = YYEMPTY;
1197 
1198   yystate = yyn;
1199   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1200   *++yyvsp = yylval;
1201   YY_IGNORE_MAYBE_UNINITIALIZED_END
1202 
1203   goto yynewstate;
1204 
1205 
1206 /*-----------------------------------------------------------.
1207 | yydefault -- do the default action for the current state.  |
1208 `-----------------------------------------------------------*/
1209 yydefault:
1210   yyn = yydefact[yystate];
1211   if (yyn == 0)
1212     goto yyerrlab;
1213   goto yyreduce;
1214 
1215 
1216 /*-----------------------------.
1217 | yyreduce -- Do a reduction.  |
1218 `-----------------------------*/
1219 yyreduce:
1220   /* yyn is the number of a rule to reduce with.  */
1221   yylen = yyr2[yyn];
1222 
1223   /* If YYLEN is nonzero, implement the default value of the action:
1224      '$$ = $1'.
1225 
1226      Otherwise, the following line sets YYVAL to garbage.
1227      This behavior is undocumented and Bison
1228      users should not rely upon it.  Assigning to YYVAL
1229      unconditionally makes the parser a bit smaller, and it avoids a
1230      GCC warning that YYVAL may be used uninitialized.  */
1231   yyval = yyvsp[1-yylen];
1232 
1233 
1234   YY_REDUCE_PRINT (yyn);
1235   switch (yyn)
1236     {
1237         case 2:
1238 #line 40 "./Parser.y" /* yacc.c:1646  */
1239     {
1240 						ParsedSearchExpression((yyvsp[0].pexpr));
1241 						delete (yyvsp[0].pexpr);
1242 						return 0;
1243 					}
1244 #line 1245 "Parser.cpp" /* yacc.c:1646  */
1245     break;
1246 
1247   case 3:
1248 #line 46 "./Parser.y" /* yacc.c:1646  */
1249     {
1250 						CSearchExpr* pexpr = new CSearchExpr(*(yyvsp[0].pstr));
1251 						ParsedSearchExpression(pexpr);
1252 						delete pexpr;
1253 						delete (yyvsp[0].pstr);
1254 						return 0;
1255 					}
1256 #line 1257 "Parser.cpp" /* yacc.c:1646  */
1257     break;
1258 
1259   case 4:
1260 #line 55 "./Parser.y" /* yacc.c:1646  */
1261     {
1262 						yyerror(wxT("Undefined search expression error"));
1263 						delete (yyvsp[-1].pexpr);
1264 						return 1;
1265 					}
1266 #line 1267 "Parser.cpp" /* yacc.c:1646  */
1267     break;
1268 
1269   case 6:
1270 #line 65 "./Parser.y" /* yacc.c:1646  */
1271     {
1272 						CSearchExpr* pexpr = new CSearchExpr;
1273 						pexpr->Add(SEARCHOP_AND);
1274 						pexpr->Add((yyvsp[-2].pexpr));
1275 						pexpr->Add((yyvsp[0].pexpr));
1276 						(yyval.pexpr) = pexpr;
1277 						delete (yyvsp[-2].pexpr);
1278 						delete (yyvsp[0].pexpr);
1279 					}
1280 #line 1281 "Parser.cpp" /* yacc.c:1646  */
1281     break;
1282 
1283   case 7:
1284 #line 75 "./Parser.y" /* yacc.c:1646  */
1285     {
1286 						CSearchExpr* pexpr = new CSearchExpr;
1287 						pexpr->Add(SEARCHOP_OR);
1288 						pexpr->Add((yyvsp[-2].pexpr));
1289 						pexpr->Add((yyvsp[0].pexpr));
1290 						(yyval.pexpr) = pexpr;
1291 						delete (yyvsp[-2].pexpr);
1292 						delete (yyvsp[0].pexpr);
1293 					}
1294 #line 1295 "Parser.cpp" /* yacc.c:1646  */
1295     break;
1296 
1297   case 8:
1298 #line 85 "./Parser.y" /* yacc.c:1646  */
1299     {
1300 						CSearchExpr* pexpr = new CSearchExpr;
1301 						pexpr->Add(SEARCHOP_NOT);
1302 						pexpr->Add((yyvsp[-2].pexpr));
1303 						pexpr->Add((yyvsp[0].pexpr));
1304 						(yyval.pexpr) = pexpr;
1305 						delete (yyvsp[-2].pexpr);
1306 						delete (yyvsp[0].pexpr);
1307 					}
1308 #line 1309 "Parser.cpp" /* yacc.c:1646  */
1309     break;
1310 
1311   case 9:
1312 #line 95 "./Parser.y" /* yacc.c:1646  */
1313     {
1314 						(yyval.pexpr) = (yyvsp[-1].pexpr);
1315 					}
1316 #line 1317 "Parser.cpp" /* yacc.c:1646  */
1317     break;
1318 
1319   case 10:
1320 #line 100 "./Parser.y" /* yacc.c:1646  */
1321     {
1322 						yyerror(wxT("Missing right operand for OR on search expression"));
1323 						delete (yyvsp[-2].pexpr);
1324 						return 1;
1325 					}
1326 #line 1327 "Parser.cpp" /* yacc.c:1646  */
1327     break;
1328 
1329   case 11:
1330 #line 106 "./Parser.y" /* yacc.c:1646  */
1331     {
1332 						yyerror(wxT("Missing operand for NOT on search expression"));
1333 						delete (yyvsp[-2].pexpr);
1334 						return 1;
1335 					}
1336 #line 1337 "Parser.cpp" /* yacc.c:1646  */
1337     break;
1338 
1339   case 12:
1340 #line 112 "./Parser.y" /* yacc.c:1646  */
1341     {
1342 						yyerror(wxT("Missing left parenthesis on search expression"));
1343 						return 1;
1344 					}
1345 #line 1346 "Parser.cpp" /* yacc.c:1646  */
1346     break;
1347 
1348   case 13:
1349 #line 117 "./Parser.y" /* yacc.c:1646  */
1350     {
1351 						yyerror(wxT("Missing closing parenthesis on search expression"));
1352 						delete (yyvsp[-1].pexpr);
1353 						return 1;
1354 					}
1355 #line 1356 "Parser.cpp" /* yacc.c:1646  */
1356     break;
1357 
1358   case 14:
1359 #line 123 "./Parser.y" /* yacc.c:1646  */
1360     {
1361 						yyerror(wxT("Missing left operand for AND on search expression"));
1362 						return 1;
1363 					}
1364 #line 1365 "Parser.cpp" /* yacc.c:1646  */
1365     break;
1366 
1367   case 15:
1368 #line 128 "./Parser.y" /* yacc.c:1646  */
1369     {
1370 						yyerror(wxT("Missing left operand for OR on search expression"));
1371 						return 1;
1372 					}
1373 #line 1374 "Parser.cpp" /* yacc.c:1646  */
1374     break;
1375 
1376   case 16:
1377 #line 133 "./Parser.y" /* yacc.c:1646  */
1378     {
1379 						yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1380 						return 1;
1381 					}
1382 #line 1383 "Parser.cpp" /* yacc.c:1646  */
1383     break;
1384 
1385   case 17:
1386 #line 140 "./Parser.y" /* yacc.c:1646  */
1387     {
1388 						(yyval.pexpr) = new CSearchExpr(*(yyvsp[0].pstr));
1389 						delete (yyvsp[0].pstr);
1390 					}
1391 #line 1392 "Parser.cpp" /* yacc.c:1646  */
1392     break;
1393 
1394   case 18:
1395 #line 145 "./Parser.y" /* yacc.c:1646  */
1396     {
1397 						/*$1->Concatenate($2);
1398 						delete $2;*/
1399 						CSearchExpr* pexpr = new CSearchExpr;
1400 						pexpr->Add(SEARCHOP_AND);
1401 						pexpr->Add((yyvsp[-1].pexpr));
1402 						pexpr->Add(*(yyvsp[0].pstr));
1403 						(yyval.pexpr) = pexpr;
1404 						delete (yyvsp[-1].pexpr);
1405 						delete (yyvsp[0].pstr);
1406 					}
1407 #line 1408 "Parser.cpp" /* yacc.c:1646  */
1408     break;
1409 
1410 
1411 #line 1412 "Parser.cpp" /* yacc.c:1646  */
1412       default: break;
1413     }
1414   /* User semantic actions sometimes alter yychar, and that requires
1415      that yytoken be updated with the new translation.  We take the
1416      approach of translating immediately before every use of yytoken.
1417      One alternative is translating here after every semantic action,
1418      but that translation would be missed if the semantic action invokes
1419      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1420      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1421      incorrect destructor might then be invoked immediately.  In the
1422      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1423      to an incorrect destructor call or verbose syntax error message
1424      before the lookahead is translated.  */
1425   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1426 
1427   YYPOPSTACK (yylen);
1428   yylen = 0;
1429   YY_STACK_PRINT (yyss, yyssp);
1430 
1431   *++yyvsp = yyval;
1432 
1433   /* Now 'shift' the result of the reduction.  Determine what state
1434      that goes to, based on the state we popped back to and the rule
1435      number reduced by.  */
1436 
1437   yyn = yyr1[yyn];
1438 
1439   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1440   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1441     yystate = yytable[yystate];
1442   else
1443     yystate = yydefgoto[yyn - YYNTOKENS];
1444 
1445   goto yynewstate;
1446 
1447 
1448 /*--------------------------------------.
1449 | yyerrlab -- here on detecting error.  |
1450 `--------------------------------------*/
1451 yyerrlab:
1452   /* Make sure we have latest lookahead translation.  See comments at
1453      user semantic actions for why this is necessary.  */
1454   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1455 
1456   /* If not already recovering from an error, report this error.  */
1457   if (!yyerrstatus)
1458     {
1459       ++yynerrs;
1460 #if ! YYERROR_VERBOSE
1461       yyerror (YY_("syntax error"));
1462 #else
1463 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1464                                         yyssp, yytoken)
1465       {
1466         char const *yymsgp = YY_("syntax error");
1467         int yysyntax_error_status;
1468         yysyntax_error_status = YYSYNTAX_ERROR;
1469         if (yysyntax_error_status == 0)
1470           yymsgp = yymsg;
1471         else if (yysyntax_error_status == 1)
1472           {
1473             if (yymsg != yymsgbuf)
1474               YYSTACK_FREE (yymsg);
1475             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1476             if (!yymsg)
1477               {
1478                 yymsg = yymsgbuf;
1479                 yymsg_alloc = sizeof yymsgbuf;
1480                 yysyntax_error_status = 2;
1481               }
1482             else
1483               {
1484                 yysyntax_error_status = YYSYNTAX_ERROR;
1485                 yymsgp = yymsg;
1486               }
1487           }
1488         yyerror (yymsgp);
1489         if (yysyntax_error_status == 2)
1490           goto yyexhaustedlab;
1491       }
1492 # undef YYSYNTAX_ERROR
1493 #endif
1494     }
1495 
1496 
1497 
1498   if (yyerrstatus == 3)
1499     {
1500       /* If just tried and failed to reuse lookahead token after an
1501          error, discard it.  */
1502 
1503       if (yychar <= YYEOF)
1504         {
1505           /* Return failure if at end of input.  */
1506           if (yychar == YYEOF)
1507             YYABORT;
1508         }
1509       else
1510         {
1511           yydestruct ("Error: discarding",
1512                       yytoken, &yylval);
1513           yychar = YYEMPTY;
1514         }
1515     }
1516 
1517   /* Else will try to reuse lookahead token after shifting the error
1518      token.  */
1519   goto yyerrlab1;
1520 
1521 
1522 /*---------------------------------------------------.
1523 | yyerrorlab -- error raised explicitly by YYERROR.  |
1524 `---------------------------------------------------*/
1525 yyerrorlab:
1526 
1527   /* Pacify compilers like GCC when the user code never invokes
1528      YYERROR and the label yyerrorlab therefore never appears in user
1529      code.  */
1530   if (/*CONSTCOND*/ 0)
1531      goto yyerrorlab;
1532 
1533   /* Do not reclaim the symbols of the rule whose action triggered
1534      this YYERROR.  */
1535   YYPOPSTACK (yylen);
1536   yylen = 0;
1537   YY_STACK_PRINT (yyss, yyssp);
1538   yystate = *yyssp;
1539   goto yyerrlab1;
1540 
1541 
1542 /*-------------------------------------------------------------.
1543 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1544 `-------------------------------------------------------------*/
1545 yyerrlab1:
1546   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1547 
1548   for (;;)
1549     {
1550       yyn = yypact[yystate];
1551       if (!yypact_value_is_default (yyn))
1552         {
1553           yyn += YYTERROR;
1554           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1555             {
1556               yyn = yytable[yyn];
1557               if (0 < yyn)
1558                 break;
1559             }
1560         }
1561 
1562       /* Pop the current state because it cannot handle the error token.  */
1563       if (yyssp == yyss)
1564         YYABORT;
1565 
1566 
1567       yydestruct ("Error: popping",
1568                   yystos[yystate], yyvsp);
1569       YYPOPSTACK (1);
1570       yystate = *yyssp;
1571       YY_STACK_PRINT (yyss, yyssp);
1572     }
1573 
1574   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1575   *++yyvsp = yylval;
1576   YY_IGNORE_MAYBE_UNINITIALIZED_END
1577 
1578 
1579   /* Shift the error token.  */
1580   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1581 
1582   yystate = yyn;
1583   goto yynewstate;
1584 
1585 
1586 /*-------------------------------------.
1587 | yyacceptlab -- YYACCEPT comes here.  |
1588 `-------------------------------------*/
1589 yyacceptlab:
1590   yyresult = 0;
1591   goto yyreturn;
1592 
1593 /*-----------------------------------.
1594 | yyabortlab -- YYABORT comes here.  |
1595 `-----------------------------------*/
1596 yyabortlab:
1597   yyresult = 1;
1598   goto yyreturn;
1599 
1600 #if !defined yyoverflow || YYERROR_VERBOSE
1601 /*-------------------------------------------------.
1602 | yyexhaustedlab -- memory exhaustion comes here.  |
1603 `-------------------------------------------------*/
1604 yyexhaustedlab:
1605   yyerror (YY_("memory exhausted"));
1606   yyresult = 2;
1607   /* Fall through.  */
1608 #endif
1609 
1610 yyreturn:
1611   if (yychar != YYEMPTY)
1612     {
1613       /* Make sure we have latest lookahead translation.  See comments at
1614          user semantic actions for why this is necessary.  */
1615       yytoken = YYTRANSLATE (yychar);
1616       yydestruct ("Cleanup: discarding lookahead",
1617                   yytoken, &yylval);
1618     }
1619   /* Do not reclaim the symbols of the rule whose action triggered
1620      this YYABORT or YYACCEPT.  */
1621   YYPOPSTACK (yylen);
1622   YY_STACK_PRINT (yyss, yyssp);
1623   while (yyssp != yyss)
1624     {
1625       yydestruct ("Cleanup: popping",
1626                   yystos[*yyssp], yyvsp);
1627       YYPOPSTACK (1);
1628     }
1629 #ifndef yyoverflow
1630   if (yyss != yyssa)
1631     YYSTACK_FREE (yyss);
1632 #endif
1633 #if YYERROR_VERBOSE
1634   if (yymsg != yymsgbuf)
1635     YYSTACK_FREE (yymsg);
1636 #endif
1637   return yyresult;
1638 }
1639 #line 158 "./Parser.y" /* yacc.c:1906  */
1640 
1641 
yyerror(const char * errstr)1642 int yyerror(const char* errstr)
1643 {
1644 	// Errors created by yacc generated code
1645 	//yyerror ("syntax error: cannot back up");
1646 	//yyerror ("syntax error; also virtual memory exhausted");
1647 	//yyerror ("syntax error");
1648 	//yyerror ("parser stack overflow");
1649 
1650 	_astrParserErrors.Add(char2unicode(errstr));
1651 	return EXIT_FAILURE;
1652 }
1653 
yyerror(wxString errstr)1654 int yyerror(wxString errstr)
1655 {
1656 	_astrParserErrors.Add(errstr);
1657 	return EXIT_FAILURE;
1658 }
1659