Improve speed of category tab title updates
[amule.git] / src / Parser.cpp
blob4306e2355d8c6f99dfb0d46e0abb7f4960637bdb
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (c) 1984-2008 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
46 #define YYBISON 1
48 /* Bison version. */
49 #define YYBISON_VERSION "2.3"
51 /* Skeleton name. */
52 #define YYSKELETON_NAME "yacc.c"
54 /* Pure parsers. */
55 #define YYPURE 0
57 /* Using locations. */
58 #define YYLSP_NEEDED 0
62 /* Tokens. */
63 #ifndef YYTOKENTYPE
64 # define YYTOKENTYPE
65 /* Put the tokens into the symbol table, so that GDB and other debuggers
66 know about them. */
67 enum yytokentype {
68 TOK_STRING = 258,
69 TOK_AND = 259,
70 TOK_OR = 260,
71 TOK_NOT = 261,
72 TOK_ED2K_LINK = 262
74 #endif
75 /* Tokens. */
76 #define TOK_STRING 258
77 #define TOK_AND 259
78 #define TOK_OR 260
79 #define TOK_NOT 261
80 #define TOK_ED2K_LINK 262
81 /* Copy the first part of user declarations. */
82 #line 1 "./Parser.y"
84 class wxString;
86 #include "Scanner.h.in"
87 #include "Scanner.h"
88 #include "OtherFunctions.h"
89 #include "SearchExpr.h"
91 #include "libs/common/StringFunctions.h"
93 #ifdef _DEBUG
94 #undef THIS_FILE
95 static char THIS_FILE[] = __FILE__;
96 #endif
98 extern wxArrayString _astrParserErrors;
100 void ParsedSearchExpression(const CSearchExpr* pexpr);
101 int yyerror(const char* errstr);
102 int yyerror(wxString errstr);
106 /* Enabling traces. */
107 #ifndef YYDEBUG
108 # define YYDEBUG 1
109 #endif
111 /* Enabling verbose error messages. */
112 #ifdef YYERROR_VERBOSE
113 # undef YYERROR_VERBOSE
114 # define YYERROR_VERBOSE 1
115 #else
116 # define YYERROR_VERBOSE 0
117 #endif
119 /* Enabling the token table. */
120 #ifndef YYTOKEN_TABLE
121 # define YYTOKEN_TABLE 0
122 #endif
124 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
125 typedef union YYSTYPE
126 #line 23 "./Parser.y"
128 wxString* pstr;
129 CSearchExpr* pexpr;
131 /* Line 187 of yacc.c. */
132 #line 137 "Parser.cpp"
133 YYSTYPE;
134 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
135 # define YYSTYPE_IS_DECLARED 1
136 # define YYSTYPE_IS_TRIVIAL 1
137 #endif
141 /* Copy the second part of user declarations. */
144 /* Line 216 of yacc.c. */
145 #line 150 "Parser.cpp"
147 #ifdef short
148 # undef short
149 #endif
151 #ifdef YYTYPE_UINT8
152 typedef YYTYPE_UINT8 yytype_uint8;
153 #else
154 typedef unsigned char yytype_uint8;
155 #endif
157 #ifdef YYTYPE_INT8
158 typedef YYTYPE_INT8 yytype_int8;
159 #elif (defined __STDC__ || defined __C99__FUNC__ \
160 || defined __cplusplus || defined _MSC_VER)
161 typedef signed char yytype_int8;
162 #else
163 typedef short int yytype_int8;
164 #endif
166 #ifdef YYTYPE_UINT16
167 typedef YYTYPE_UINT16 yytype_uint16;
168 #else
169 typedef unsigned short int yytype_uint16;
170 #endif
172 #ifdef YYTYPE_INT16
173 typedef YYTYPE_INT16 yytype_int16;
174 #else
175 typedef short int yytype_int16;
176 #endif
178 #ifndef YYSIZE_T
179 # ifdef __SIZE_TYPE__
180 # define YYSIZE_T __SIZE_TYPE__
181 # elif defined size_t
182 # define YYSIZE_T size_t
183 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
184 || defined __cplusplus || defined _MSC_VER)
185 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
186 # define YYSIZE_T size_t
187 # else
188 # define YYSIZE_T unsigned int
189 # endif
190 #endif
192 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
194 #ifndef YY_
195 # if YYENABLE_NLS
196 # if ENABLE_NLS
197 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
198 # define YY_(msgid) dgettext ("bison-runtime", msgid)
199 # endif
200 # endif
201 # ifndef YY_
202 # define YY_(msgid) msgid
203 # endif
204 #endif
206 /* Suppress unused-variable warnings by "using" E. */
207 #if ! defined lint || defined __GNUC__
208 # define YYUSE(e) ((void) (e))
209 #else
210 # define YYUSE(e) /* empty */
211 #endif
213 /* Identity function, used to suppress warnings about constant conditions. */
214 #ifndef lint
215 # define YYID(n) (n)
216 #else
217 #if (defined __STDC__ || defined __C99__FUNC__ \
218 || defined __cplusplus || defined _MSC_VER)
219 static int
220 YYID (int i)
221 #else
222 static int
223 YYID (i)
224 int i;
225 #endif
227 return i;
229 #endif
231 #if ! defined yyoverflow || YYERROR_VERBOSE
233 /* The parser invokes alloca or malloc; define the necessary symbols. */
235 # ifdef YYSTACK_USE_ALLOCA
236 # if YYSTACK_USE_ALLOCA
237 # ifdef __GNUC__
238 # define YYSTACK_ALLOC __builtin_alloca
239 # elif defined __BUILTIN_VA_ARG_INCR
240 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
241 # elif defined _AIX
242 # define YYSTACK_ALLOC __alloca
243 # elif defined _MSC_VER
244 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
245 # define alloca _alloca
246 # else
247 # define YYSTACK_ALLOC alloca
248 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
249 || defined __cplusplus || defined _MSC_VER)
250 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
251 # ifndef _STDLIB_H
252 # define _STDLIB_H 1
253 # endif
254 # endif
255 # endif
256 # endif
257 # endif
259 # ifdef YYSTACK_ALLOC
260 /* Pacify GCC's `empty if-body' warning. */
261 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
262 # ifndef YYSTACK_ALLOC_MAXIMUM
263 /* The OS might guarantee only one guard page at the bottom of the stack,
264 and a page size can be as small as 4096 bytes. So we cannot safely
265 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
266 to allow for a few compiler-allocated temporary stack slots. */
267 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
268 # endif
269 # else
270 # define YYSTACK_ALLOC YYMALLOC
271 # define YYSTACK_FREE YYFREE
272 # ifndef YYSTACK_ALLOC_MAXIMUM
273 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
274 # endif
275 # if (defined __cplusplus && ! defined _STDLIB_H \
276 && ! ((defined YYMALLOC || defined malloc) \
277 && (defined YYFREE || defined free)))
278 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
279 # ifndef _STDLIB_H
280 # define _STDLIB_H 1
281 # endif
282 # endif
283 # ifndef YYMALLOC
284 # define YYMALLOC malloc
285 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
286 || defined __cplusplus || defined _MSC_VER)
287 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
288 # endif
289 # endif
290 # ifndef YYFREE
291 # define YYFREE free
292 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
293 || defined __cplusplus || defined _MSC_VER)
294 void free (void *); /* INFRINGES ON USER NAME SPACE */
295 # endif
296 # endif
297 # endif
298 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
301 #if (! defined yyoverflow \
302 && (! defined __cplusplus \
303 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
305 /* A type that is properly aligned for any stack member. */
306 union yyalloc
308 yytype_int16 yyss;
309 YYSTYPE yyvs;
312 /* The size of the maximum gap between one aligned stack and the next. */
313 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
315 /* The size of an array large to enough to hold all stacks, each with
316 N elements. */
317 # define YYSTACK_BYTES(N) \
318 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
319 + YYSTACK_GAP_MAXIMUM)
321 /* Copy COUNT objects from FROM to TO. The source and destination do
322 not overlap. */
323 # ifndef YYCOPY
324 # if defined __GNUC__ && 1 < __GNUC__
325 # define YYCOPY(To, From, Count) \
326 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
327 # else
328 # define YYCOPY(To, From, Count) \
329 do \
331 YYSIZE_T yyi; \
332 for (yyi = 0; yyi < (Count); yyi++) \
333 (To)[yyi] = (From)[yyi]; \
335 while (YYID (0))
336 # endif
337 # endif
339 /* Relocate STACK from its old location to the new one. The
340 local variables YYSIZE and YYSTACKSIZE give the old and new number of
341 elements in the stack, and YYPTR gives the new location of the
342 stack. Advance YYPTR to a properly aligned location for the next
343 stack. */
344 # define YYSTACK_RELOCATE(Stack) \
345 do \
347 YYSIZE_T yynewbytes; \
348 YYCOPY (&yyptr->Stack, Stack, yysize); \
349 Stack = &yyptr->Stack; \
350 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
351 yyptr += yynewbytes / sizeof (*yyptr); \
353 while (YYID (0))
355 #endif
357 /* YYFINAL -- State number of the termination state. */
358 #define YYFINAL 15
359 /* YYLAST -- Last index in YYTABLE. */
360 #define YYLAST 52
362 /* YYNTOKENS -- Number of terminals. */
363 #define YYNTOKENS 10
364 /* YYNNTS -- Number of nonterminals. */
365 #define YYNNTS 4
366 /* YYNRULES -- Number of rules. */
367 #define YYNRULES 18
368 /* YYNRULES -- Number of states. */
369 #define YYNSTATES 28
371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
372 #define YYUNDEFTOK 2
373 #define YYMAXUTOK 262
375 #define YYTRANSLATE(YYX) \
376 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
378 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
379 static const yytype_uint8 yytranslate[] =
381 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 8, 9, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 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 2, 2, 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, 1, 2, 3, 4,
407 5, 6, 7
410 #if YYDEBUG
411 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
412 YYRHS. */
413 static const yytype_uint8 yyprhs[] =
415 0, 0, 3, 5, 7, 10, 12, 16, 20, 24,
416 28, 32, 36, 39, 43, 46, 49, 52, 54
419 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
420 static const yytype_int8 yyrhs[] =
422 11, 0, -1, 12, -1, 7, -1, 12, 1, -1,
423 13, -1, 12, 4, 12, -1, 12, 5, 12, -1,
424 12, 6, 12, -1, 8, 12, 9, -1, 12, 5,
425 1, -1, 12, 6, 1, -1, 8, 1, -1, 8,
426 12, 1, -1, 4, 1, -1, 5, 1, -1, 6,
427 1, -1, 3, -1, 13, 3, -1
430 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
431 static const yytype_uint8 yyrline[] =
433 0, 42, 42, 48, 57, 66, 67, 77, 87, 97,
434 102, 108, 114, 119, 125, 130, 135, 142, 147
436 #endif
438 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
439 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
440 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
441 static const char *const yytname[] =
443 "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
444 "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
445 "searchexpr", "and_strings", 0
447 #endif
449 # ifdef YYPRINT
450 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
451 token YYLEX-NUM. */
452 static const yytype_uint16 yytoknum[] =
454 0, 256, 257, 258, 259, 260, 261, 262, 40, 41
456 # endif
458 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
459 static const yytype_uint8 yyr1[] =
461 0, 10, 11, 11, 11, 12, 12, 12, 12, 12,
462 12, 12, 12, 12, 12, 12, 12, 13, 13
465 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
466 static const yytype_uint8 yyr2[] =
468 0, 2, 1, 1, 2, 1, 3, 3, 3, 3,
469 3, 3, 2, 3, 2, 2, 2, 1, 2
472 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
473 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
474 means the default is an error. */
475 static const yytype_uint8 yydefact[] =
477 0, 17, 0, 0, 0, 3, 0, 0, 0, 5,
478 14, 15, 16, 12, 0, 1, 4, 0, 0, 0,
479 18, 13, 9, 6, 10, 7, 11, 8
482 /* YYDEFGOTO[NTERM-NUM]. */
483 static const yytype_int8 yydefgoto[] =
485 -1, 7, 8, 9
488 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
489 STATE-NUM. */
490 #define YYPACT_NINF -7
491 static const yytype_int8 yypact[] =
493 38, -7, 1, 2, 6, -7, 13, 15, 34, 29,
494 -7, -7, -7, -7, 0, -7, -7, 44, 19, 25,
495 -7, -7, -7, 30, -7, 4, -7, -7
498 /* YYPGOTO[NTERM-NUM]. */
499 static const yytype_int8 yypgoto[] =
501 -7, -7, -6, -7
504 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
505 positive, shift that token. If negative, reduce the rule which
506 number is the opposite. If zero, do what YYDEFACT says.
507 If YYTABLE_NINF, syntax error. */
508 #define YYTABLE_NINF -3
509 static const yytype_int8 yytable[] =
511 14, 21, 10, 11, 17, 18, 19, 12, 17, 22,
512 19, 23, 25, 27, 13, 15, 1, 2, 3, 4,
513 24, 6, 1, 2, 3, 4, 26, 6, 1, 2,
514 3, 4, 20, 6, -2, 16, 19, 0, 17, 18,
515 19, 1, 2, 3, 4, 5, 6, 1, 2, 3,
516 4, 0, 6
519 static const yytype_int8 yycheck[] =
521 6, 1, 1, 1, 4, 5, 6, 1, 4, 9,
522 6, 17, 18, 19, 1, 0, 3, 4, 5, 6,
523 1, 8, 3, 4, 5, 6, 1, 8, 3, 4,
524 5, 6, 3, 8, 0, 1, 6, -1, 4, 5,
525 6, 3, 4, 5, 6, 7, 8, 3, 4, 5,
526 6, -1, 8
529 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
530 symbol of state STATE-NUM. */
531 static const yytype_uint8 yystos[] =
533 0, 3, 4, 5, 6, 7, 8, 11, 12, 13,
534 1, 1, 1, 1, 12, 0, 1, 4, 5, 6,
535 3, 1, 9, 12, 1, 12, 1, 12
538 #define yyerrok (yyerrstatus = 0)
539 #define yyclearin (yychar = YYEMPTY)
540 #define YYEMPTY (-2)
541 #define YYEOF 0
543 #define YYACCEPT goto yyacceptlab
544 #define YYABORT goto yyabortlab
545 #define YYERROR goto yyerrorlab
548 /* Like YYERROR except do call yyerror. This remains here temporarily
549 to ease the transition to the new meaning of YYERROR, for GCC.
550 Once GCC version 2 has supplanted version 1, this can go. */
552 #define YYFAIL goto yyerrlab
554 #define YYRECOVERING() (!!yyerrstatus)
556 #define YYBACKUP(Token, Value) \
557 do \
558 if (yychar == YYEMPTY && yylen == 1) \
560 yychar = (Token); \
561 yylval = (Value); \
562 yytoken = YYTRANSLATE (yychar); \
563 YYPOPSTACK (1); \
564 goto yybackup; \
566 else \
568 yyerror (YY_("syntax error: cannot back up")); \
569 YYERROR; \
571 while (YYID (0))
574 #define YYTERROR 1
575 #define YYERRCODE 256
578 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
579 If N is 0, then set CURRENT to the empty location which ends
580 the previous symbol: RHS[0] (always defined). */
582 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
583 #ifndef YYLLOC_DEFAULT
584 # define YYLLOC_DEFAULT(Current, Rhs, N) \
585 do \
586 if (YYID (N)) \
588 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
589 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
590 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
591 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
593 else \
595 (Current).first_line = (Current).last_line = \
596 YYRHSLOC (Rhs, 0).last_line; \
597 (Current).first_column = (Current).last_column = \
598 YYRHSLOC (Rhs, 0).last_column; \
600 while (YYID (0))
601 #endif
604 /* YY_LOCATION_PRINT -- Print the location on the stream.
605 This macro was not mandated originally: define only if we know
606 we won't break user code: when these are the locations we know. */
608 #ifndef YY_LOCATION_PRINT
609 # if YYLTYPE_IS_TRIVIAL
610 # define YY_LOCATION_PRINT(File, Loc) \
611 fprintf (File, "%d.%d-%d.%d", \
612 (Loc).first_line, (Loc).first_column, \
613 (Loc).last_line, (Loc).last_column)
614 # else
615 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
616 # endif
617 #endif
620 /* YYLEX -- calling `yylex' with the right arguments. */
622 #ifdef YYLEX_PARAM
623 # define YYLEX yylex (YYLEX_PARAM)
624 #else
625 # define YYLEX yylex ()
626 #endif
628 /* Enable debugging if requested. */
629 #if YYDEBUG
631 # ifndef YYFPRINTF
632 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
633 # define YYFPRINTF fprintf
634 # endif
636 # define YYDPRINTF(Args) \
637 do { \
638 if (yydebug) \
639 YYFPRINTF Args; \
640 } while (YYID (0))
642 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
643 do { \
644 if (yydebug) \
646 YYFPRINTF (stderr, "%s ", Title); \
647 yy_symbol_print (stderr, \
648 Type, Value); \
649 YYFPRINTF (stderr, "\n"); \
651 } while (YYID (0))
654 /*--------------------------------.
655 | Print this symbol on YYOUTPUT. |
656 `--------------------------------*/
658 /*ARGSUSED*/
659 #if (defined __STDC__ || defined __C99__FUNC__ \
660 || defined __cplusplus || defined _MSC_VER)
661 static void
662 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
663 #else
664 static void
665 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
666 FILE *yyoutput;
667 int yytype;
668 YYSTYPE const * const yyvaluep;
669 #endif
671 if (!yyvaluep)
672 return;
673 # ifdef YYPRINT
674 if (yytype < YYNTOKENS)
675 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
676 # else
677 YYUSE (yyoutput);
678 # endif
679 switch (yytype)
681 default:
682 break;
687 /*--------------------------------.
688 | Print this symbol on YYOUTPUT. |
689 `--------------------------------*/
691 #if (defined __STDC__ || defined __C99__FUNC__ \
692 || defined __cplusplus || defined _MSC_VER)
693 static void
694 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
695 #else
696 static void
697 yy_symbol_print (yyoutput, yytype, yyvaluep)
698 FILE *yyoutput;
699 int yytype;
700 YYSTYPE const * const yyvaluep;
701 #endif
703 if (yytype < YYNTOKENS)
704 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
705 else
706 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
708 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
709 YYFPRINTF (yyoutput, ")");
712 /*------------------------------------------------------------------.
713 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
714 | TOP (included). |
715 `------------------------------------------------------------------*/
717 #if (defined __STDC__ || defined __C99__FUNC__ \
718 || defined __cplusplus || defined _MSC_VER)
719 static void
720 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
721 #else
722 static void
723 yy_stack_print (bottom, top)
724 yytype_int16 *bottom;
725 yytype_int16 *top;
726 #endif
728 YYFPRINTF (stderr, "Stack now");
729 for (; bottom <= top; ++bottom)
730 YYFPRINTF (stderr, " %d", *bottom);
731 YYFPRINTF (stderr, "\n");
734 # define YY_STACK_PRINT(Bottom, Top) \
735 do { \
736 if (yydebug) \
737 yy_stack_print ((Bottom), (Top)); \
738 } while (YYID (0))
741 /*------------------------------------------------.
742 | Report that the YYRULE is going to be reduced. |
743 `------------------------------------------------*/
745 #if (defined __STDC__ || defined __C99__FUNC__ \
746 || defined __cplusplus || defined _MSC_VER)
747 static void
748 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
749 #else
750 static void
751 yy_reduce_print (yyvsp, yyrule)
752 YYSTYPE *yyvsp;
753 int yyrule;
754 #endif
756 int yynrhs = yyr2[yyrule];
757 int yyi;
758 unsigned long int yylno = yyrline[yyrule];
759 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
760 yyrule - 1, yylno);
761 /* The symbols being reduced. */
762 for (yyi = 0; yyi < yynrhs; yyi++)
764 fprintf (stderr, " $%d = ", yyi + 1);
765 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
766 &(yyvsp[(yyi + 1) - (yynrhs)])
768 fprintf (stderr, "\n");
772 # define YY_REDUCE_PRINT(Rule) \
773 do { \
774 if (yydebug) \
775 yy_reduce_print (yyvsp, Rule); \
776 } while (YYID (0))
778 /* Nonzero means print parse trace. It is left uninitialized so that
779 multiple parsers can coexist. */
780 int yydebug;
781 #else /* !YYDEBUG */
782 # define YYDPRINTF(Args)
783 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
784 # define YY_STACK_PRINT(Bottom, Top)
785 # define YY_REDUCE_PRINT(Rule)
786 #endif /* !YYDEBUG */
789 /* YYINITDEPTH -- initial size of the parser's stacks. */
790 #ifndef YYINITDEPTH
791 # define YYINITDEPTH 200
792 #endif
794 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
795 if the built-in stack extension method is used).
797 Do not make this value too large; the results are undefined if
798 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
799 evaluated with infinite-precision integer arithmetic. */
801 #ifndef YYMAXDEPTH
802 # define YYMAXDEPTH 10000
803 #endif
807 #if YYERROR_VERBOSE
809 # ifndef yystrlen
810 # if defined __GLIBC__ && defined _STRING_H
811 # define yystrlen strlen
812 # else
813 /* Return the length of YYSTR. */
814 #if (defined __STDC__ || defined __C99__FUNC__ \
815 || defined __cplusplus || defined _MSC_VER)
816 static YYSIZE_T
817 yystrlen (const char *yystr)
818 #else
819 static YYSIZE_T
820 yystrlen (yystr)
821 const char *yystr;
822 #endif
824 YYSIZE_T yylen;
825 for (yylen = 0; yystr[yylen]; yylen++)
826 continue;
827 return yylen;
829 # endif
830 # endif
832 # ifndef yystpcpy
833 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
834 # define yystpcpy stpcpy
835 # else
836 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
837 YYDEST. */
838 #if (defined __STDC__ || defined __C99__FUNC__ \
839 || defined __cplusplus || defined _MSC_VER)
840 static char *
841 yystpcpy (char *yydest, const char *yysrc)
842 #else
843 static char *
844 yystpcpy (yydest, yysrc)
845 char *yydest;
846 const char *yysrc;
847 #endif
849 char *yyd = yydest;
850 const char *yys = yysrc;
852 while ((*yyd++ = *yys++) != '\0')
853 continue;
855 return yyd - 1;
857 # endif
858 # endif
860 # ifndef yytnamerr
861 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
862 quotes and backslashes, so that it's suitable for yyerror. The
863 heuristic is that double-quoting is unnecessary unless the string
864 contains an apostrophe, a comma, or backslash (other than
865 backslash-backslash). YYSTR is taken from yytname. If YYRES is
866 null, do not copy; instead, return the length of what the result
867 would have been. */
868 static YYSIZE_T
869 yytnamerr (char *yyres, const char *yystr)
871 if (*yystr == '"')
873 YYSIZE_T yyn = 0;
874 char const *yyp = yystr;
876 for (;;)
877 switch (*++yyp)
879 case '\'':
880 case ',':
881 goto do_not_strip_quotes;
883 case '\\':
884 if (*++yyp != '\\')
885 goto do_not_strip_quotes;
886 /* Fall through. */
887 default:
888 if (yyres)
889 yyres[yyn] = *yyp;
890 yyn++;
891 break;
893 case '"':
894 if (yyres)
895 yyres[yyn] = '\0';
896 return yyn;
898 do_not_strip_quotes: ;
901 if (! yyres)
902 return yystrlen (yystr);
904 return yystpcpy (yyres, yystr) - yyres;
906 # endif
908 /* Copy into YYRESULT an error message about the unexpected token
909 YYCHAR while in state YYSTATE. Return the number of bytes copied,
910 including the terminating null byte. If YYRESULT is null, do not
911 copy anything; just return the number of bytes that would be
912 copied. As a special case, return 0 if an ordinary "syntax error"
913 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
914 size calculation. */
915 static YYSIZE_T
916 yysyntax_error (char *yyresult, int yystate, int yychar)
918 int yyn = yypact[yystate];
920 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
921 return 0;
922 else
924 int yytype = YYTRANSLATE (yychar);
925 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
926 YYSIZE_T yysize = yysize0;
927 YYSIZE_T yysize1;
928 int yysize_overflow = 0;
929 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
930 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
931 int yyx;
933 # if 0
934 /* This is so xgettext sees the translatable formats that are
935 constructed on the fly. */
936 YY_("syntax error, unexpected %s");
937 YY_("syntax error, unexpected %s, expecting %s");
938 YY_("syntax error, unexpected %s, expecting %s or %s");
939 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
940 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
941 # endif
942 char *yyfmt;
943 char const *yyf;
944 static char const yyunexpected[] = "syntax error, unexpected %s";
945 static char const yyexpecting[] = ", expecting %s";
946 static char const yyor[] = " or %s";
947 char yyformat[sizeof yyunexpected
948 + sizeof yyexpecting - 1
949 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
950 * (sizeof yyor - 1))];
951 char const *yyprefix = yyexpecting;
953 /* Start YYX at -YYN if negative to avoid negative indexes in
954 YYCHECK. */
955 int yyxbegin = yyn < 0 ? -yyn : 0;
957 /* Stay within bounds of both yycheck and yytname. */
958 int yychecklim = YYLAST - yyn + 1;
959 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
960 int yycount = 1;
962 yyarg[0] = yytname[yytype];
963 yyfmt = yystpcpy (yyformat, yyunexpected);
965 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
966 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
968 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
970 yycount = 1;
971 yysize = yysize0;
972 yyformat[sizeof yyunexpected - 1] = '\0';
973 break;
975 yyarg[yycount++] = yytname[yyx];
976 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
977 yysize_overflow |= (yysize1 < yysize);
978 yysize = yysize1;
979 yyfmt = yystpcpy (yyfmt, yyprefix);
980 yyprefix = yyor;
983 yyf = YY_(yyformat);
984 yysize1 = yysize + yystrlen (yyf);
985 yysize_overflow |= (yysize1 < yysize);
986 yysize = yysize1;
988 if (yysize_overflow)
989 return YYSIZE_MAXIMUM;
991 if (yyresult)
993 /* Avoid sprintf, as that infringes on the user's name space.
994 Don't have undefined behavior even if the translation
995 produced a string with the wrong number of "%s"s. */
996 char *yyp = yyresult;
997 int yyi = 0;
998 while ((*yyp = *yyf) != '\0')
1000 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1002 yyp += yytnamerr (yyp, yyarg[yyi++]);
1003 yyf += 2;
1005 else
1007 yyp++;
1008 yyf++;
1012 return yysize;
1015 #endif /* YYERROR_VERBOSE */
1018 /*-----------------------------------------------.
1019 | Release the memory associated to this symbol. |
1020 `-----------------------------------------------*/
1022 /*ARGSUSED*/
1023 #if (defined __STDC__ || defined __C99__FUNC__ \
1024 || defined __cplusplus || defined _MSC_VER)
1025 static void
1026 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1027 #else
1028 static void
1029 yydestruct (yymsg, yytype, yyvaluep)
1030 const char *yymsg;
1031 int yytype;
1032 YYSTYPE *yyvaluep;
1033 #endif
1035 YYUSE (yyvaluep);
1037 if (!yymsg)
1038 yymsg = "Deleting";
1039 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1041 switch (yytype)
1044 default:
1045 break;
1050 /* Prevent warnings from -Wmissing-prototypes. */
1052 #ifdef YYPARSE_PARAM
1053 #if defined __STDC__ || defined __cplusplus
1054 int yyparse (void *YYPARSE_PARAM);
1055 #else
1056 int yyparse ();
1057 #endif
1058 #else /* ! YYPARSE_PARAM */
1059 #if defined __STDC__ || defined __cplusplus
1060 int yyparse (void);
1061 #else
1062 int yyparse ();
1063 #endif
1064 #endif /* ! YYPARSE_PARAM */
1068 /* The look-ahead symbol. */
1069 int yychar;
1071 /* The semantic value of the look-ahead symbol. */
1072 YYSTYPE yylval;
1074 /* Number of syntax errors so far. */
1075 int yynerrs;
1079 /*----------.
1080 | yyparse. |
1081 `----------*/
1083 #ifdef YYPARSE_PARAM
1084 #if (defined __STDC__ || defined __C99__FUNC__ \
1085 || defined __cplusplus || defined _MSC_VER)
1087 yyparse (void *YYPARSE_PARAM)
1088 #else
1090 yyparse (YYPARSE_PARAM)
1091 void *YYPARSE_PARAM;
1092 #endif
1093 #else /* ! YYPARSE_PARAM */
1094 #if (defined __STDC__ || defined __C99__FUNC__ \
1095 || defined __cplusplus || defined _MSC_VER)
1097 yyparse (void)
1098 #else
1100 yyparse ()
1102 #endif
1103 #endif
1106 int yystate;
1107 int yyn;
1108 int yyresult;
1109 /* Number of tokens to shift before error messages enabled. */
1110 int yyerrstatus;
1111 /* Look-ahead token as an internal (translated) token number. */
1112 int yytoken = 0;
1113 #if YYERROR_VERBOSE
1114 /* Buffer for error messages, and its allocated size. */
1115 char yymsgbuf[128];
1116 char *yymsg = yymsgbuf;
1117 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1118 #endif
1120 /* Three stacks and their tools:
1121 `yyss': related to states,
1122 `yyvs': related to semantic values,
1123 `yyls': related to locations.
1125 Refer to the stacks thru separate pointers, to allow yyoverflow
1126 to reallocate them elsewhere. */
1128 /* The state stack. */
1129 yytype_int16 yyssa[YYINITDEPTH];
1130 yytype_int16 *yyss = yyssa;
1131 yytype_int16 *yyssp;
1133 /* The semantic value stack. */
1134 YYSTYPE yyvsa[YYINITDEPTH];
1135 YYSTYPE *yyvs = yyvsa;
1136 YYSTYPE *yyvsp;
1140 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1142 YYSIZE_T yystacksize = YYINITDEPTH;
1144 /* The variables used to return semantic value and location from the
1145 action routines. */
1146 YYSTYPE yyval;
1149 /* The number of symbols on the RHS of the reduced rule.
1150 Keep to zero when no symbol should be popped. */
1151 int yylen = 0;
1153 YYDPRINTF ((stderr, "Starting parse\n"));
1155 yystate = 0;
1156 yyerrstatus = 0;
1157 yynerrs = 0;
1158 yychar = YYEMPTY; /* Cause a token to be read. */
1160 /* Initialize stack pointers.
1161 Waste one element of value and location stack
1162 so that they stay on the same level as the state stack.
1163 The wasted elements are never initialized. */
1165 yyssp = yyss;
1166 yyvsp = yyvs;
1168 goto yysetstate;
1170 /*------------------------------------------------------------.
1171 | yynewstate -- Push a new state, which is found in yystate. |
1172 `------------------------------------------------------------*/
1173 yynewstate:
1174 /* In all cases, when you get here, the value and location stacks
1175 have just been pushed. So pushing a state here evens the stacks. */
1176 yyssp++;
1178 yysetstate:
1179 *yyssp = yystate;
1181 if (yyss + yystacksize - 1 <= yyssp)
1183 /* Get the current used size of the three stacks, in elements. */
1184 YYSIZE_T yysize = yyssp - yyss + 1;
1186 #ifdef yyoverflow
1188 /* Give user a chance to reallocate the stack. Use copies of
1189 these so that the &'s don't force the real ones into
1190 memory. */
1191 YYSTYPE *yyvs1 = yyvs;
1192 yytype_int16 *yyss1 = yyss;
1195 /* Each stack pointer address is followed by the size of the
1196 data in use in that stack, in bytes. This used to be a
1197 conditional around just the two extra args, but that might
1198 be undefined if yyoverflow is a macro. */
1199 yyoverflow (YY_("memory exhausted"),
1200 &yyss1, yysize * sizeof (*yyssp),
1201 &yyvs1, yysize * sizeof (*yyvsp),
1203 &yystacksize);
1205 yyss = yyss1;
1206 yyvs = yyvs1;
1208 #else /* no yyoverflow */
1209 # ifndef YYSTACK_RELOCATE
1210 goto yyexhaustedlab;
1211 # else
1212 /* Extend the stack our own way. */
1213 if (YYMAXDEPTH <= yystacksize)
1214 goto yyexhaustedlab;
1215 yystacksize *= 2;
1216 if (YYMAXDEPTH < yystacksize)
1217 yystacksize = YYMAXDEPTH;
1220 yytype_int16 *yyss1 = yyss;
1221 union yyalloc *yyptr =
1222 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1223 if (! yyptr)
1224 goto yyexhaustedlab;
1225 YYSTACK_RELOCATE (yyss);
1226 YYSTACK_RELOCATE (yyvs);
1228 # undef YYSTACK_RELOCATE
1229 if (yyss1 != yyssa)
1230 YYSTACK_FREE (yyss1);
1232 # endif
1233 #endif /* no yyoverflow */
1235 yyssp = yyss + yysize - 1;
1236 yyvsp = yyvs + yysize - 1;
1239 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1240 (unsigned long int) yystacksize));
1242 if (yyss + yystacksize - 1 <= yyssp)
1243 YYABORT;
1246 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1248 goto yybackup;
1250 /*-----------.
1251 | yybackup. |
1252 `-----------*/
1253 yybackup:
1255 /* Do appropriate processing given the current state. Read a
1256 look-ahead token if we need one and don't already have one. */
1258 /* First try to decide what to do without reference to look-ahead token. */
1259 yyn = yypact[yystate];
1260 if (yyn == YYPACT_NINF)
1261 goto yydefault;
1263 /* Not known => get a look-ahead token if don't already have one. */
1265 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1266 if (yychar == YYEMPTY)
1268 YYDPRINTF ((stderr, "Reading a token: "));
1269 yychar = YYLEX;
1272 if (yychar <= YYEOF)
1274 yychar = yytoken = YYEOF;
1275 YYDPRINTF ((stderr, "Now at end of input.\n"));
1277 else
1279 yytoken = YYTRANSLATE (yychar);
1280 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1283 /* If the proper action on seeing token YYTOKEN is to reduce or to
1284 detect an error, take that action. */
1285 yyn += yytoken;
1286 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1287 goto yydefault;
1288 yyn = yytable[yyn];
1289 if (yyn <= 0)
1291 if (yyn == 0 || yyn == YYTABLE_NINF)
1292 goto yyerrlab;
1293 yyn = -yyn;
1294 goto yyreduce;
1297 if (yyn == YYFINAL)
1298 YYACCEPT;
1300 /* Count tokens shifted since error; after three, turn off error
1301 status. */
1302 if (yyerrstatus)
1303 yyerrstatus--;
1305 /* Shift the look-ahead token. */
1306 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1308 /* Discard the shifted token unless it is eof. */
1309 if (yychar != YYEOF)
1310 yychar = YYEMPTY;
1312 yystate = yyn;
1313 *++yyvsp = yylval;
1315 goto yynewstate;
1318 /*-----------------------------------------------------------.
1319 | yydefault -- do the default action for the current state. |
1320 `-----------------------------------------------------------*/
1321 yydefault:
1322 yyn = yydefact[yystate];
1323 if (yyn == 0)
1324 goto yyerrlab;
1325 goto yyreduce;
1328 /*-----------------------------.
1329 | yyreduce -- Do a reduction. |
1330 `-----------------------------*/
1331 yyreduce:
1332 /* yyn is the number of a rule to reduce with. */
1333 yylen = yyr2[yyn];
1335 /* If YYLEN is nonzero, implement the default value of the action:
1336 `$$ = $1'.
1338 Otherwise, the following line sets YYVAL to garbage.
1339 This behavior is undocumented and Bison
1340 users should not rely upon it. Assigning to YYVAL
1341 unconditionally makes the parser a bit smaller, and it avoids a
1342 GCC warning that YYVAL may be used uninitialized. */
1343 yyval = yyvsp[1-yylen];
1346 YY_REDUCE_PRINT (yyn);
1347 switch (yyn)
1349 case 2:
1350 #line 43 "./Parser.y"
1352 ParsedSearchExpression((yyvsp[(1) - (1)].pexpr));
1353 delete (yyvsp[(1) - (1)].pexpr);
1354 return 0;
1356 break;
1358 case 3:
1359 #line 49 "./Parser.y"
1361 CSearchExpr* pexpr = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1362 ParsedSearchExpression(pexpr);
1363 delete pexpr;
1364 delete (yyvsp[(1) - (1)].pstr);
1365 return 0;
1367 break;
1369 case 4:
1370 #line 58 "./Parser.y"
1372 yyerror(wxT("Undefined search expression error"));
1373 delete (yyvsp[(1) - (2)].pexpr);
1374 return 1;
1376 break;
1378 case 6:
1379 #line 68 "./Parser.y"
1381 CSearchExpr* pexpr = new CSearchExpr;
1382 pexpr->Add(SEARCHOP_AND);
1383 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1384 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1385 (yyval.pexpr) = pexpr;
1386 delete (yyvsp[(1) - (3)].pexpr);
1387 delete (yyvsp[(3) - (3)].pexpr);
1389 break;
1391 case 7:
1392 #line 78 "./Parser.y"
1394 CSearchExpr* pexpr = new CSearchExpr;
1395 pexpr->Add(SEARCHOP_OR);
1396 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1397 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1398 (yyval.pexpr) = pexpr;
1399 delete (yyvsp[(1) - (3)].pexpr);
1400 delete (yyvsp[(3) - (3)].pexpr);
1402 break;
1404 case 8:
1405 #line 88 "./Parser.y"
1407 CSearchExpr* pexpr = new CSearchExpr;
1408 pexpr->Add(SEARCHOP_NOT);
1409 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1410 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1411 (yyval.pexpr) = pexpr;
1412 delete (yyvsp[(1) - (3)].pexpr);
1413 delete (yyvsp[(3) - (3)].pexpr);
1415 break;
1417 case 9:
1418 #line 98 "./Parser.y"
1420 (yyval.pexpr) = (yyvsp[(2) - (3)].pexpr);
1422 break;
1424 case 10:
1425 #line 103 "./Parser.y"
1427 yyerror(wxT("Missing right operand for OR on search expression"));
1428 delete (yyvsp[(1) - (3)].pexpr);
1429 return 1;
1431 break;
1433 case 11:
1434 #line 109 "./Parser.y"
1436 yyerror(wxT("Missing operand for NOT on search expression"));
1437 delete (yyvsp[(1) - (3)].pexpr);
1438 return 1;
1440 break;
1442 case 12:
1443 #line 115 "./Parser.y"
1445 yyerror(wxT("Missing left parenthesis on search expression"));
1446 return 1;
1448 break;
1450 case 13:
1451 #line 120 "./Parser.y"
1453 yyerror(wxT("Missing closing parenthesis on search expression"));
1454 delete (yyvsp[(2) - (3)].pexpr);
1455 return 1;
1457 break;
1459 case 14:
1460 #line 126 "./Parser.y"
1462 yyerror(wxT("Missing left operand for AND on search expression"));
1463 return 1;
1465 break;
1467 case 15:
1468 #line 131 "./Parser.y"
1470 yyerror(wxT("Missing left operand for OR on search expression"));
1471 return 1;
1473 break;
1475 case 16:
1476 #line 136 "./Parser.y"
1478 yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1479 return 1;
1481 break;
1483 case 17:
1484 #line 143 "./Parser.y"
1486 (yyval.pexpr) = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1487 delete (yyvsp[(1) - (1)].pstr);
1489 break;
1491 case 18:
1492 #line 148 "./Parser.y"
1494 /*$1->Concatenate($2);
1495 delete $2;*/
1496 CSearchExpr* pexpr = new CSearchExpr;
1497 pexpr->Add(SEARCHOP_AND);
1498 pexpr->Add((yyvsp[(1) - (2)].pexpr));
1499 pexpr->Add(*(yyvsp[(2) - (2)].pstr));
1500 (yyval.pexpr) = pexpr;
1501 delete (yyvsp[(1) - (2)].pexpr);
1502 delete (yyvsp[(2) - (2)].pstr);
1504 break;
1507 /* Line 1267 of yacc.c. */
1508 #line 1513 "Parser.cpp"
1509 default: break;
1511 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1513 YYPOPSTACK (yylen);
1514 yylen = 0;
1515 YY_STACK_PRINT (yyss, yyssp);
1517 *++yyvsp = yyval;
1520 /* Now `shift' the result of the reduction. Determine what state
1521 that goes to, based on the state we popped back to and the rule
1522 number reduced by. */
1524 yyn = yyr1[yyn];
1526 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1527 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1528 yystate = yytable[yystate];
1529 else
1530 yystate = yydefgoto[yyn - YYNTOKENS];
1532 goto yynewstate;
1535 /*------------------------------------.
1536 | yyerrlab -- here on detecting error |
1537 `------------------------------------*/
1538 yyerrlab:
1539 /* If not already recovering from an error, report this error. */
1540 if (!yyerrstatus)
1542 ++yynerrs;
1543 #if ! YYERROR_VERBOSE
1544 yyerror (YY_("syntax error"));
1545 #else
1547 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1548 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1550 YYSIZE_T yyalloc = 2 * yysize;
1551 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1552 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1553 if (yymsg != yymsgbuf)
1554 YYSTACK_FREE (yymsg);
1555 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1556 if (yymsg)
1557 yymsg_alloc = yyalloc;
1558 else
1560 yymsg = yymsgbuf;
1561 yymsg_alloc = sizeof yymsgbuf;
1565 if (0 < yysize && yysize <= yymsg_alloc)
1567 (void) yysyntax_error (yymsg, yystate, yychar);
1568 yyerror (yymsg);
1570 else
1572 yyerror (YY_("syntax error"));
1573 if (yysize != 0)
1574 goto yyexhaustedlab;
1577 #endif
1582 if (yyerrstatus == 3)
1584 /* If just tried and failed to reuse look-ahead token after an
1585 error, discard it. */
1587 if (yychar <= YYEOF)
1589 /* Return failure if at end of input. */
1590 if (yychar == YYEOF)
1591 YYABORT;
1593 else
1595 yydestruct ("Error: discarding",
1596 yytoken, &yylval);
1597 yychar = YYEMPTY;
1601 /* Else will try to reuse look-ahead token after shifting the error
1602 token. */
1603 goto yyerrlab1;
1606 /*---------------------------------------------------.
1607 | yyerrorlab -- error raised explicitly by YYERROR. |
1608 `---------------------------------------------------*/
1609 yyerrorlab:
1611 /* Pacify compilers like GCC when the user code never invokes
1612 YYERROR and the label yyerrorlab therefore never appears in user
1613 code. */
1614 if (/*CONSTCOND*/ 0)
1615 goto yyerrorlab;
1617 /* Do not reclaim the symbols of the rule which action triggered
1618 this YYERROR. */
1619 YYPOPSTACK (yylen);
1620 yylen = 0;
1621 YY_STACK_PRINT (yyss, yyssp);
1622 yystate = *yyssp;
1623 goto yyerrlab1;
1626 /*-------------------------------------------------------------.
1627 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1628 `-------------------------------------------------------------*/
1629 yyerrlab1:
1630 yyerrstatus = 3; /* Each real token shifted decrements this. */
1632 for (;;)
1634 yyn = yypact[yystate];
1635 if (yyn != YYPACT_NINF)
1637 yyn += YYTERROR;
1638 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1640 yyn = yytable[yyn];
1641 if (0 < yyn)
1642 break;
1646 /* Pop the current state because it cannot handle the error token. */
1647 if (yyssp == yyss)
1648 YYABORT;
1651 yydestruct ("Error: popping",
1652 yystos[yystate], yyvsp);
1653 YYPOPSTACK (1);
1654 yystate = *yyssp;
1655 YY_STACK_PRINT (yyss, yyssp);
1658 if (yyn == YYFINAL)
1659 YYACCEPT;
1661 *++yyvsp = yylval;
1664 /* Shift the error token. */
1665 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1667 yystate = yyn;
1668 goto yynewstate;
1671 /*-------------------------------------.
1672 | yyacceptlab -- YYACCEPT comes here. |
1673 `-------------------------------------*/
1674 yyacceptlab:
1675 yyresult = 0;
1676 goto yyreturn;
1678 /*-----------------------------------.
1679 | yyabortlab -- YYABORT comes here. |
1680 `-----------------------------------*/
1681 yyabortlab:
1682 yyresult = 1;
1683 goto yyreturn;
1685 #ifndef yyoverflow
1686 /*-------------------------------------------------.
1687 | yyexhaustedlab -- memory exhaustion comes here. |
1688 `-------------------------------------------------*/
1689 yyexhaustedlab:
1690 yyerror (YY_("memory exhausted"));
1691 yyresult = 2;
1692 /* Fall through. */
1693 #endif
1695 yyreturn:
1696 if (yychar != YYEOF && yychar != YYEMPTY)
1697 yydestruct ("Cleanup: discarding lookahead",
1698 yytoken, &yylval);
1699 /* Do not reclaim the symbols of the rule which action triggered
1700 this YYABORT or YYACCEPT. */
1701 YYPOPSTACK (yylen);
1702 YY_STACK_PRINT (yyss, yyssp);
1703 while (yyssp != yyss)
1705 yydestruct ("Cleanup: popping",
1706 yystos[*yyssp], yyvsp);
1707 YYPOPSTACK (1);
1709 #ifndef yyoverflow
1710 if (yyss != yyssa)
1711 YYSTACK_FREE (yyss);
1712 #endif
1713 #if YYERROR_VERBOSE
1714 if (yymsg != yymsgbuf)
1715 YYSTACK_FREE (yymsg);
1716 #endif
1717 /* Make sure YYID is used. */
1718 return YYID (yyresult);
1722 #line 161 "./Parser.y"
1725 int yyerror(const char* errstr)
1727 // Errors created by yacc generated code
1728 //yyerror ("syntax error: cannot back up");
1729 //yyerror ("syntax error; also virtual memory exhausted");
1730 //yyerror ("syntax error");
1731 //yyerror ("parser stack overflow");
1733 _astrParserErrors.Add(char2unicode(errstr));
1734 return EXIT_FAILURE;
1737 int yyerror(wxString errstr)
1739 _astrParserErrors.Add(errstr);
1740 return EXIT_FAILURE;