Upstream tarball 20080418
[amule.git] / src / Parser.cpp
blob34f1fd2678b2f84f695c9312538d4afcb674c274
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, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 TOK_STRING = 258,
70 TOK_AND = 259,
71 TOK_OR = 260,
72 TOK_NOT = 261,
73 TOK_ED2K_LINK = 262
75 #endif
76 /* Tokens. */
77 #define TOK_STRING 258
78 #define TOK_AND 259
79 #define TOK_OR 260
80 #define TOK_NOT 261
81 #define TOK_ED2K_LINK 262
82 /* Copy the first part of user declarations. */
83 #line 1 "./Parser.y"
85 class wxString;
87 #include "Scanner.h.in"
88 #include "Scanner.h"
89 #include "OtherFunctions.h"
90 #include "SearchExpr.h"
92 #include "libs/common/StringFunctions.h"
94 #ifdef _DEBUG
95 #undef THIS_FILE
96 static char THIS_FILE[] = __FILE__;
97 #endif
99 extern wxArrayString _astrParserErrors;
101 void ParsedSearchExpression(const CSearchExpr* pexpr);
102 int yyerror(const char* errstr);
103 int yyerror(wxString errstr);
107 /* Enabling traces. */
108 #ifndef YYDEBUG
109 # define YYDEBUG 1
110 #endif
112 /* Enabling verbose error messages. */
113 #ifdef YYERROR_VERBOSE
114 # undef YYERROR_VERBOSE
115 # define YYERROR_VERBOSE 1
116 #else
117 # define YYERROR_VERBOSE 0
118 #endif
120 /* Enabling the token table. */
121 #ifndef YYTOKEN_TABLE
122 # define YYTOKEN_TABLE 0
123 #endif
125 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
126 typedef union YYSTYPE
127 #line 23 "./Parser.y"
129 wxString* pstr;
130 CSearchExpr* pexpr;
132 /* Line 187 of yacc.c. */
133 #line 137 "Parser.cpp"
134 YYSTYPE;
135 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
136 # define YYSTYPE_IS_DECLARED 1
137 # define YYSTYPE_IS_TRIVIAL 1
138 #endif
142 /* Copy the second part of user declarations. */
145 /* Line 216 of yacc.c. */
146 #line 150 "Parser.cpp"
148 #ifdef short
149 # undef short
150 #endif
152 #ifdef YYTYPE_UINT8
153 typedef YYTYPE_UINT8 yytype_uint8;
154 #else
155 typedef unsigned char yytype_uint8;
156 #endif
158 #ifdef YYTYPE_INT8
159 typedef YYTYPE_INT8 yytype_int8;
160 #elif (defined __STDC__ || defined __C99__FUNC__ \
161 || defined __cplusplus || defined _MSC_VER)
162 typedef signed char yytype_int8;
163 #else
164 typedef short int yytype_int8;
165 #endif
167 #ifdef YYTYPE_UINT16
168 typedef YYTYPE_UINT16 yytype_uint16;
169 #else
170 typedef unsigned short int yytype_uint16;
171 #endif
173 #ifdef YYTYPE_INT16
174 typedef YYTYPE_INT16 yytype_int16;
175 #else
176 typedef short int yytype_int16;
177 #endif
179 #ifndef YYSIZE_T
180 # ifdef __SIZE_TYPE__
181 # define YYSIZE_T __SIZE_TYPE__
182 # elif defined size_t
183 # define YYSIZE_T size_t
184 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
185 || defined __cplusplus || defined _MSC_VER)
186 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
187 # define YYSIZE_T size_t
188 # else
189 # define YYSIZE_T unsigned int
190 # endif
191 #endif
193 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
195 #ifndef YY_
196 # if YYENABLE_NLS
197 # if ENABLE_NLS
198 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
199 # define YY_(msgid) dgettext ("bison-runtime", msgid)
200 # endif
201 # endif
202 # ifndef YY_
203 # define YY_(msgid) msgid
204 # endif
205 #endif
207 /* Suppress unused-variable warnings by "using" E. */
208 #if ! defined lint || defined __GNUC__
209 # define YYUSE(e) ((void) (e))
210 #else
211 # define YYUSE(e) /* empty */
212 #endif
214 /* Identity function, used to suppress warnings about constant conditions. */
215 #ifndef lint
216 # define YYID(n) (n)
217 #else
218 #if (defined __STDC__ || defined __C99__FUNC__ \
219 || defined __cplusplus || defined _MSC_VER)
220 static int
221 YYID (int i)
222 #else
223 static int
224 YYID (i)
225 int i;
226 #endif
228 return i;
230 #endif
232 #if ! defined yyoverflow || YYERROR_VERBOSE
234 /* The parser invokes alloca or malloc; define the necessary symbols. */
236 # ifdef YYSTACK_USE_ALLOCA
237 # if YYSTACK_USE_ALLOCA
238 # ifdef __GNUC__
239 # define YYSTACK_ALLOC __builtin_alloca
240 # elif defined __BUILTIN_VA_ARG_INCR
241 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
242 # elif defined _AIX
243 # define YYSTACK_ALLOC __alloca
244 # elif defined _MSC_VER
245 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
246 # define alloca _alloca
247 # else
248 # define YYSTACK_ALLOC alloca
249 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
250 || defined __cplusplus || defined _MSC_VER)
251 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
252 # ifndef _STDLIB_H
253 # define _STDLIB_H 1
254 # endif
255 # endif
256 # endif
257 # endif
258 # endif
260 # ifdef YYSTACK_ALLOC
261 /* Pacify GCC's `empty if-body' warning. */
262 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
263 # ifndef YYSTACK_ALLOC_MAXIMUM
264 /* The OS might guarantee only one guard page at the bottom of the stack,
265 and a page size can be as small as 4096 bytes. So we cannot safely
266 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
267 to allow for a few compiler-allocated temporary stack slots. */
268 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
269 # endif
270 # else
271 # define YYSTACK_ALLOC YYMALLOC
272 # define YYSTACK_FREE YYFREE
273 # ifndef YYSTACK_ALLOC_MAXIMUM
274 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
275 # endif
276 # if (defined __cplusplus && ! defined _STDLIB_H \
277 && ! ((defined YYMALLOC || defined malloc) \
278 && (defined YYFREE || defined free)))
279 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
280 # ifndef _STDLIB_H
281 # define _STDLIB_H 1
282 # endif
283 # endif
284 # ifndef YYMALLOC
285 # define YYMALLOC malloc
286 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
287 || defined __cplusplus || defined _MSC_VER)
288 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
289 # endif
290 # endif
291 # ifndef YYFREE
292 # define YYFREE free
293 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
294 || defined __cplusplus || defined _MSC_VER)
295 void free (void *); /* INFRINGES ON USER NAME SPACE */
296 # endif
297 # endif
298 # endif
299 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
302 #if (! defined yyoverflow \
303 && (! defined __cplusplus \
304 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
306 /* A type that is properly aligned for any stack member. */
307 union yyalloc
309 yytype_int16 yyss;
310 YYSTYPE yyvs;
313 /* The size of the maximum gap between one aligned stack and the next. */
314 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
316 /* The size of an array large to enough to hold all stacks, each with
317 N elements. */
318 # define YYSTACK_BYTES(N) \
319 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
320 + YYSTACK_GAP_MAXIMUM)
322 /* Copy COUNT objects from FROM to TO. The source and destination do
323 not overlap. */
324 # ifndef YYCOPY
325 # if defined __GNUC__ && 1 < __GNUC__
326 # define YYCOPY(To, From, Count) \
327 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
328 # else
329 # define YYCOPY(To, From, Count) \
330 do \
332 YYSIZE_T yyi; \
333 for (yyi = 0; yyi < (Count); yyi++) \
334 (To)[yyi] = (From)[yyi]; \
336 while (YYID (0))
337 # endif
338 # endif
340 /* Relocate STACK from its old location to the new one. The
341 local variables YYSIZE and YYSTACKSIZE give the old and new number of
342 elements in the stack, and YYPTR gives the new location of the
343 stack. Advance YYPTR to a properly aligned location for the next
344 stack. */
345 # define YYSTACK_RELOCATE(Stack) \
346 do \
348 YYSIZE_T yynewbytes; \
349 YYCOPY (&yyptr->Stack, Stack, yysize); \
350 Stack = &yyptr->Stack; \
351 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
352 yyptr += yynewbytes / sizeof (*yyptr); \
354 while (YYID (0))
356 #endif
358 /* YYFINAL -- State number of the termination state. */
359 #define YYFINAL 15
360 /* YYLAST -- Last index in YYTABLE. */
361 #define YYLAST 52
363 /* YYNTOKENS -- Number of terminals. */
364 #define YYNTOKENS 10
365 /* YYNNTS -- Number of nonterminals. */
366 #define YYNNTS 4
367 /* YYNRULES -- Number of rules. */
368 #define YYNRULES 18
369 /* YYNRULES -- Number of states. */
370 #define YYNSTATES 28
372 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
373 #define YYUNDEFTOK 2
374 #define YYMAXUTOK 262
376 #define YYTRANSLATE(YYX) \
377 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
379 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
380 static const yytype_uint8 yytranslate[] =
382 0, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 8, 9, 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, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
408 5, 6, 7
411 #if YYDEBUG
412 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
413 YYRHS. */
414 static const yytype_uint8 yyprhs[] =
416 0, 0, 3, 5, 7, 10, 12, 16, 20, 24,
417 28, 32, 36, 39, 43, 46, 49, 52, 54
420 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
421 static const yytype_int8 yyrhs[] =
423 11, 0, -1, 12, -1, 7, -1, 12, 1, -1,
424 13, -1, 12, 4, 12, -1, 12, 5, 12, -1,
425 12, 6, 12, -1, 8, 12, 9, -1, 12, 5,
426 1, -1, 12, 6, 1, -1, 8, 1, -1, 8,
427 12, 1, -1, 4, 1, -1, 5, 1, -1, 6,
428 1, -1, 3, -1, 13, 3, -1
431 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
432 static const yytype_uint8 yyrline[] =
434 0, 42, 42, 48, 57, 66, 67, 77, 87, 97,
435 102, 108, 114, 119, 125, 130, 135, 142, 147
437 #endif
439 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
440 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
441 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
442 static const char *const yytname[] =
444 "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
445 "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
446 "searchexpr", "and_strings", 0
448 #endif
450 # ifdef YYPRINT
451 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
452 token YYLEX-NUM. */
453 static const yytype_uint16 yytoknum[] =
455 0, 256, 257, 258, 259, 260, 261, 262, 40, 41
457 # endif
459 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
460 static const yytype_uint8 yyr1[] =
462 0, 10, 11, 11, 11, 12, 12, 12, 12, 12,
463 12, 12, 12, 12, 12, 12, 12, 13, 13
466 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
467 static const yytype_uint8 yyr2[] =
469 0, 2, 1, 1, 2, 1, 3, 3, 3, 3,
470 3, 3, 2, 3, 2, 2, 2, 1, 2
473 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
474 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
475 means the default is an error. */
476 static const yytype_uint8 yydefact[] =
478 0, 17, 0, 0, 0, 3, 0, 0, 0, 5,
479 14, 15, 16, 12, 0, 1, 4, 0, 0, 0,
480 18, 13, 9, 6, 10, 7, 11, 8
483 /* YYDEFGOTO[NTERM-NUM]. */
484 static const yytype_int8 yydefgoto[] =
486 -1, 7, 8, 9
489 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
490 STATE-NUM. */
491 #define YYPACT_NINF -7
492 static const yytype_int8 yypact[] =
494 38, -7, 1, 2, 6, -7, 13, 15, 34, 29,
495 -7, -7, -7, -7, 0, -7, -7, 44, 19, 25,
496 -7, -7, -7, 30, -7, 4, -7, -7
499 /* YYPGOTO[NTERM-NUM]. */
500 static const yytype_int8 yypgoto[] =
502 -7, -7, -6, -7
505 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
506 positive, shift that token. If negative, reduce the rule which
507 number is the opposite. If zero, do what YYDEFACT says.
508 If YYTABLE_NINF, syntax error. */
509 #define YYTABLE_NINF -3
510 static const yytype_int8 yytable[] =
512 14, 21, 10, 11, 17, 18, 19, 12, 17, 22,
513 19, 23, 25, 27, 13, 15, 1, 2, 3, 4,
514 24, 6, 1, 2, 3, 4, 26, 6, 1, 2,
515 3, 4, 20, 6, -2, 16, 19, 0, 17, 18,
516 19, 1, 2, 3, 4, 5, 6, 1, 2, 3,
517 4, 0, 6
520 static const yytype_int8 yycheck[] =
522 6, 1, 1, 1, 4, 5, 6, 1, 4, 9,
523 6, 17, 18, 19, 1, 0, 3, 4, 5, 6,
524 1, 8, 3, 4, 5, 6, 1, 8, 3, 4,
525 5, 6, 3, 8, 0, 1, 6, -1, 4, 5,
526 6, 3, 4, 5, 6, 7, 8, 3, 4, 5,
527 6, -1, 8
530 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
531 symbol of state STATE-NUM. */
532 static const yytype_uint8 yystos[] =
534 0, 3, 4, 5, 6, 7, 8, 11, 12, 13,
535 1, 1, 1, 1, 12, 0, 1, 4, 5, 6,
536 3, 1, 9, 12, 1, 12, 1, 12
539 #define yyerrok (yyerrstatus = 0)
540 #define yyclearin (yychar = YYEMPTY)
541 #define YYEMPTY (-2)
542 #define YYEOF 0
544 #define YYACCEPT goto yyacceptlab
545 #define YYABORT goto yyabortlab
546 #define YYERROR goto yyerrorlab
549 /* Like YYERROR except do call yyerror. This remains here temporarily
550 to ease the transition to the new meaning of YYERROR, for GCC.
551 Once GCC version 2 has supplanted version 1, this can go. */
553 #define YYFAIL goto yyerrlab
555 #define YYRECOVERING() (!!yyerrstatus)
557 #define YYBACKUP(Token, Value) \
558 do \
559 if (yychar == YYEMPTY && yylen == 1) \
561 yychar = (Token); \
562 yylval = (Value); \
563 yytoken = YYTRANSLATE (yychar); \
564 YYPOPSTACK (1); \
565 goto yybackup; \
567 else \
569 yyerror (YY_("syntax error: cannot back up")); \
570 YYERROR; \
572 while (YYID (0))
575 #define YYTERROR 1
576 #define YYERRCODE 256
579 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
580 If N is 0, then set CURRENT to the empty location which ends
581 the previous symbol: RHS[0] (always defined). */
583 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
584 #ifndef YYLLOC_DEFAULT
585 # define YYLLOC_DEFAULT(Current, Rhs, N) \
586 do \
587 if (YYID (N)) \
589 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
590 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
591 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
592 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
594 else \
596 (Current).first_line = (Current).last_line = \
597 YYRHSLOC (Rhs, 0).last_line; \
598 (Current).first_column = (Current).last_column = \
599 YYRHSLOC (Rhs, 0).last_column; \
601 while (YYID (0))
602 #endif
605 /* YY_LOCATION_PRINT -- Print the location on the stream.
606 This macro was not mandated originally: define only if we know
607 we won't break user code: when these are the locations we know. */
609 #ifndef YY_LOCATION_PRINT
610 # if YYLTYPE_IS_TRIVIAL
611 # define YY_LOCATION_PRINT(File, Loc) \
612 fprintf (File, "%d.%d-%d.%d", \
613 (Loc).first_line, (Loc).first_column, \
614 (Loc).last_line, (Loc).last_column)
615 # else
616 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
617 # endif
618 #endif
621 /* YYLEX -- calling `yylex' with the right arguments. */
623 #ifdef YYLEX_PARAM
624 # define YYLEX yylex (YYLEX_PARAM)
625 #else
626 # define YYLEX yylex ()
627 #endif
629 /* Enable debugging if requested. */
630 #if YYDEBUG
632 # ifndef YYFPRINTF
633 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
634 # define YYFPRINTF fprintf
635 # endif
637 # define YYDPRINTF(Args) \
638 do { \
639 if (yydebug) \
640 YYFPRINTF Args; \
641 } while (YYID (0))
643 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
644 do { \
645 if (yydebug) \
647 YYFPRINTF (stderr, "%s ", Title); \
648 yy_symbol_print (stderr, \
649 Type, Value); \
650 YYFPRINTF (stderr, "\n"); \
652 } while (YYID (0))
655 /*--------------------------------.
656 | Print this symbol on YYOUTPUT. |
657 `--------------------------------*/
659 /*ARGSUSED*/
660 #if (defined __STDC__ || defined __C99__FUNC__ \
661 || defined __cplusplus || defined _MSC_VER)
662 static void
663 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
664 #else
665 static void
666 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
667 FILE *yyoutput;
668 int yytype;
669 YYSTYPE const * const yyvaluep;
670 #endif
672 if (!yyvaluep)
673 return;
674 # ifdef YYPRINT
675 if (yytype < YYNTOKENS)
676 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
677 # else
678 YYUSE (yyoutput);
679 # endif
680 switch (yytype)
682 default:
683 break;
688 /*--------------------------------.
689 | Print this symbol on YYOUTPUT. |
690 `--------------------------------*/
692 #if (defined __STDC__ || defined __C99__FUNC__ \
693 || defined __cplusplus || defined _MSC_VER)
694 static void
695 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
696 #else
697 static void
698 yy_symbol_print (yyoutput, yytype, yyvaluep)
699 FILE *yyoutput;
700 int yytype;
701 YYSTYPE const * const yyvaluep;
702 #endif
704 if (yytype < YYNTOKENS)
705 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
706 else
707 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
709 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
710 YYFPRINTF (yyoutput, ")");
713 /*------------------------------------------------------------------.
714 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
715 | TOP (included). |
716 `------------------------------------------------------------------*/
718 #if (defined __STDC__ || defined __C99__FUNC__ \
719 || defined __cplusplus || defined _MSC_VER)
720 static void
721 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
722 #else
723 static void
724 yy_stack_print (bottom, top)
725 yytype_int16 *bottom;
726 yytype_int16 *top;
727 #endif
729 YYFPRINTF (stderr, "Stack now");
730 for (; bottom <= top; ++bottom)
731 YYFPRINTF (stderr, " %d", *bottom);
732 YYFPRINTF (stderr, "\n");
735 # define YY_STACK_PRINT(Bottom, Top) \
736 do { \
737 if (yydebug) \
738 yy_stack_print ((Bottom), (Top)); \
739 } while (YYID (0))
742 /*------------------------------------------------.
743 | Report that the YYRULE is going to be reduced. |
744 `------------------------------------------------*/
746 #if (defined __STDC__ || defined __C99__FUNC__ \
747 || defined __cplusplus || defined _MSC_VER)
748 static void
749 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
750 #else
751 static void
752 yy_reduce_print (yyvsp, yyrule)
753 YYSTYPE *yyvsp;
754 int yyrule;
755 #endif
757 int yynrhs = yyr2[yyrule];
758 int yyi;
759 unsigned long int yylno = yyrline[yyrule];
760 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
761 yyrule - 1, yylno);
762 /* The symbols being reduced. */
763 for (yyi = 0; yyi < yynrhs; yyi++)
765 fprintf (stderr, " $%d = ", yyi + 1);
766 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
767 &(yyvsp[(yyi + 1) - (yynrhs)])
769 fprintf (stderr, "\n");
773 # define YY_REDUCE_PRINT(Rule) \
774 do { \
775 if (yydebug) \
776 yy_reduce_print (yyvsp, Rule); \
777 } while (YYID (0))
779 /* Nonzero means print parse trace. It is left uninitialized so that
780 multiple parsers can coexist. */
781 int yydebug;
782 #else /* !YYDEBUG */
783 # define YYDPRINTF(Args)
784 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
785 # define YY_STACK_PRINT(Bottom, Top)
786 # define YY_REDUCE_PRINT(Rule)
787 #endif /* !YYDEBUG */
790 /* YYINITDEPTH -- initial size of the parser's stacks. */
791 #ifndef YYINITDEPTH
792 # define YYINITDEPTH 200
793 #endif
795 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
796 if the built-in stack extension method is used).
798 Do not make this value too large; the results are undefined if
799 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
800 evaluated with infinite-precision integer arithmetic. */
802 #ifndef YYMAXDEPTH
803 # define YYMAXDEPTH 10000
804 #endif
808 #if YYERROR_VERBOSE
810 # ifndef yystrlen
811 # if defined __GLIBC__ && defined _STRING_H
812 # define yystrlen strlen
813 # else
814 /* Return the length of YYSTR. */
815 #if (defined __STDC__ || defined __C99__FUNC__ \
816 || defined __cplusplus || defined _MSC_VER)
817 static YYSIZE_T
818 yystrlen (const char *yystr)
819 #else
820 static YYSIZE_T
821 yystrlen (yystr)
822 const char *yystr;
823 #endif
825 YYSIZE_T yylen;
826 for (yylen = 0; yystr[yylen]; yylen++)
827 continue;
828 return yylen;
830 # endif
831 # endif
833 # ifndef yystpcpy
834 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
835 # define yystpcpy stpcpy
836 # else
837 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
838 YYDEST. */
839 #if (defined __STDC__ || defined __C99__FUNC__ \
840 || defined __cplusplus || defined _MSC_VER)
841 static char *
842 yystpcpy (char *yydest, const char *yysrc)
843 #else
844 static char *
845 yystpcpy (yydest, yysrc)
846 char *yydest;
847 const char *yysrc;
848 #endif
850 char *yyd = yydest;
851 const char *yys = yysrc;
853 while ((*yyd++ = *yys++) != '\0')
854 continue;
856 return yyd - 1;
858 # endif
859 # endif
861 # ifndef yytnamerr
862 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
863 quotes and backslashes, so that it's suitable for yyerror. The
864 heuristic is that double-quoting is unnecessary unless the string
865 contains an apostrophe, a comma, or backslash (other than
866 backslash-backslash). YYSTR is taken from yytname. If YYRES is
867 null, do not copy; instead, return the length of what the result
868 would have been. */
869 static YYSIZE_T
870 yytnamerr (char *yyres, const char *yystr)
872 if (*yystr == '"')
874 YYSIZE_T yyn = 0;
875 char const *yyp = yystr;
877 for (;;)
878 switch (*++yyp)
880 case '\'':
881 case ',':
882 goto do_not_strip_quotes;
884 case '\\':
885 if (*++yyp != '\\')
886 goto do_not_strip_quotes;
887 /* Fall through. */
888 default:
889 if (yyres)
890 yyres[yyn] = *yyp;
891 yyn++;
892 break;
894 case '"':
895 if (yyres)
896 yyres[yyn] = '\0';
897 return yyn;
899 do_not_strip_quotes: ;
902 if (! yyres)
903 return yystrlen (yystr);
905 return yystpcpy (yyres, yystr) - yyres;
907 # endif
909 /* Copy into YYRESULT an error message about the unexpected token
910 YYCHAR while in state YYSTATE. Return the number of bytes copied,
911 including the terminating null byte. If YYRESULT is null, do not
912 copy anything; just return the number of bytes that would be
913 copied. As a special case, return 0 if an ordinary "syntax error"
914 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
915 size calculation. */
916 static YYSIZE_T
917 yysyntax_error (char *yyresult, int yystate, int yychar)
919 int yyn = yypact[yystate];
921 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
922 return 0;
923 else
925 int yytype = YYTRANSLATE (yychar);
926 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
927 YYSIZE_T yysize = yysize0;
928 YYSIZE_T yysize1;
929 int yysize_overflow = 0;
930 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
931 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
932 int yyx;
934 # if 0
935 /* This is so xgettext sees the translatable formats that are
936 constructed on the fly. */
937 YY_("syntax error, unexpected %s");
938 YY_("syntax error, unexpected %s, expecting %s");
939 YY_("syntax error, unexpected %s, expecting %s or %s");
940 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
941 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
942 # endif
943 char *yyfmt;
944 char const *yyf;
945 static char const yyunexpected[] = "syntax error, unexpected %s";
946 static char const yyexpecting[] = ", expecting %s";
947 static char const yyor[] = " or %s";
948 char yyformat[sizeof yyunexpected
949 + sizeof yyexpecting - 1
950 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
951 * (sizeof yyor - 1))];
952 char const *yyprefix = yyexpecting;
954 /* Start YYX at -YYN if negative to avoid negative indexes in
955 YYCHECK. */
956 int yyxbegin = yyn < 0 ? -yyn : 0;
958 /* Stay within bounds of both yycheck and yytname. */
959 int yychecklim = YYLAST - yyn + 1;
960 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
961 int yycount = 1;
963 yyarg[0] = yytname[yytype];
964 yyfmt = yystpcpy (yyformat, yyunexpected);
966 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
967 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
969 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
971 yycount = 1;
972 yysize = yysize0;
973 yyformat[sizeof yyunexpected - 1] = '\0';
974 break;
976 yyarg[yycount++] = yytname[yyx];
977 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
978 yysize_overflow |= (yysize1 < yysize);
979 yysize = yysize1;
980 yyfmt = yystpcpy (yyfmt, yyprefix);
981 yyprefix = yyor;
984 yyf = YY_(yyformat);
985 yysize1 = yysize + yystrlen (yyf);
986 yysize_overflow |= (yysize1 < yysize);
987 yysize = yysize1;
989 if (yysize_overflow)
990 return YYSIZE_MAXIMUM;
992 if (yyresult)
994 /* Avoid sprintf, as that infringes on the user's name space.
995 Don't have undefined behavior even if the translation
996 produced a string with the wrong number of "%s"s. */
997 char *yyp = yyresult;
998 int yyi = 0;
999 while ((*yyp = *yyf) != '\0')
1001 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1003 yyp += yytnamerr (yyp, yyarg[yyi++]);
1004 yyf += 2;
1006 else
1008 yyp++;
1009 yyf++;
1013 return yysize;
1016 #endif /* YYERROR_VERBOSE */
1019 /*-----------------------------------------------.
1020 | Release the memory associated to this symbol. |
1021 `-----------------------------------------------*/
1023 /*ARGSUSED*/
1024 #if (defined __STDC__ || defined __C99__FUNC__ \
1025 || defined __cplusplus || defined _MSC_VER)
1026 static void
1027 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1028 #else
1029 static void
1030 yydestruct (yymsg, yytype, yyvaluep)
1031 const char *yymsg;
1032 int yytype;
1033 YYSTYPE *yyvaluep;
1034 #endif
1036 YYUSE (yyvaluep);
1038 if (!yymsg)
1039 yymsg = "Deleting";
1040 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1042 switch (yytype)
1045 default:
1046 break;
1051 /* Prevent warnings from -Wmissing-prototypes. */
1053 #ifdef YYPARSE_PARAM
1054 #if defined __STDC__ || defined __cplusplus
1055 int yyparse (void *YYPARSE_PARAM);
1056 #else
1057 int yyparse ();
1058 #endif
1059 #else /* ! YYPARSE_PARAM */
1060 #if defined __STDC__ || defined __cplusplus
1061 int yyparse (void);
1062 #else
1063 int yyparse ();
1064 #endif
1065 #endif /* ! YYPARSE_PARAM */
1069 /* The look-ahead symbol. */
1070 int yychar;
1072 /* The semantic value of the look-ahead symbol. */
1073 YYSTYPE yylval;
1075 /* Number of syntax errors so far. */
1076 int yynerrs;
1080 /*----------.
1081 | yyparse. |
1082 `----------*/
1084 #ifdef YYPARSE_PARAM
1085 #if (defined __STDC__ || defined __C99__FUNC__ \
1086 || defined __cplusplus || defined _MSC_VER)
1088 yyparse (void *YYPARSE_PARAM)
1089 #else
1091 yyparse (YYPARSE_PARAM)
1092 void *YYPARSE_PARAM;
1093 #endif
1094 #else /* ! YYPARSE_PARAM */
1095 #if (defined __STDC__ || defined __C99__FUNC__ \
1096 || defined __cplusplus || defined _MSC_VER)
1098 yyparse (void)
1099 #else
1101 yyparse ()
1103 #endif
1104 #endif
1107 int yystate;
1108 int yyn;
1109 int yyresult;
1110 /* Number of tokens to shift before error messages enabled. */
1111 int yyerrstatus;
1112 /* Look-ahead token as an internal (translated) token number. */
1113 int yytoken = 0;
1114 #if YYERROR_VERBOSE
1115 /* Buffer for error messages, and its allocated size. */
1116 char yymsgbuf[128];
1117 char *yymsg = yymsgbuf;
1118 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1119 #endif
1121 /* Three stacks and their tools:
1122 `yyss': related to states,
1123 `yyvs': related to semantic values,
1124 `yyls': related to locations.
1126 Refer to the stacks thru separate pointers, to allow yyoverflow
1127 to reallocate them elsewhere. */
1129 /* The state stack. */
1130 yytype_int16 yyssa[YYINITDEPTH];
1131 yytype_int16 *yyss = yyssa;
1132 yytype_int16 *yyssp;
1134 /* The semantic value stack. */
1135 YYSTYPE yyvsa[YYINITDEPTH];
1136 YYSTYPE *yyvs = yyvsa;
1137 YYSTYPE *yyvsp;
1141 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1143 YYSIZE_T yystacksize = YYINITDEPTH;
1145 /* The variables used to return semantic value and location from the
1146 action routines. */
1147 YYSTYPE yyval;
1150 /* The number of symbols on the RHS of the reduced rule.
1151 Keep to zero when no symbol should be popped. */
1152 int yylen = 0;
1154 YYDPRINTF ((stderr, "Starting parse\n"));
1156 yystate = 0;
1157 yyerrstatus = 0;
1158 yynerrs = 0;
1159 yychar = YYEMPTY; /* Cause a token to be read. */
1161 /* Initialize stack pointers.
1162 Waste one element of value and location stack
1163 so that they stay on the same level as the state stack.
1164 The wasted elements are never initialized. */
1166 yyssp = yyss;
1167 yyvsp = yyvs;
1169 goto yysetstate;
1171 /*------------------------------------------------------------.
1172 | yynewstate -- Push a new state, which is found in yystate. |
1173 `------------------------------------------------------------*/
1174 yynewstate:
1175 /* In all cases, when you get here, the value and location stacks
1176 have just been pushed. So pushing a state here evens the stacks. */
1177 yyssp++;
1179 yysetstate:
1180 *yyssp = yystate;
1182 if (yyss + yystacksize - 1 <= yyssp)
1184 /* Get the current used size of the three stacks, in elements. */
1185 YYSIZE_T yysize = yyssp - yyss + 1;
1187 #ifdef yyoverflow
1189 /* Give user a chance to reallocate the stack. Use copies of
1190 these so that the &'s don't force the real ones into
1191 memory. */
1192 YYSTYPE *yyvs1 = yyvs;
1193 yytype_int16 *yyss1 = yyss;
1196 /* Each stack pointer address is followed by the size of the
1197 data in use in that stack, in bytes. This used to be a
1198 conditional around just the two extra args, but that might
1199 be undefined if yyoverflow is a macro. */
1200 yyoverflow (YY_("memory exhausted"),
1201 &yyss1, yysize * sizeof (*yyssp),
1202 &yyvs1, yysize * sizeof (*yyvsp),
1204 &yystacksize);
1206 yyss = yyss1;
1207 yyvs = yyvs1;
1209 #else /* no yyoverflow */
1210 # ifndef YYSTACK_RELOCATE
1211 goto yyexhaustedlab;
1212 # else
1213 /* Extend the stack our own way. */
1214 if (YYMAXDEPTH <= yystacksize)
1215 goto yyexhaustedlab;
1216 yystacksize *= 2;
1217 if (YYMAXDEPTH < yystacksize)
1218 yystacksize = YYMAXDEPTH;
1221 yytype_int16 *yyss1 = yyss;
1222 union yyalloc *yyptr =
1223 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1224 if (! yyptr)
1225 goto yyexhaustedlab;
1226 YYSTACK_RELOCATE (yyss);
1227 YYSTACK_RELOCATE (yyvs);
1229 # undef YYSTACK_RELOCATE
1230 if (yyss1 != yyssa)
1231 YYSTACK_FREE (yyss1);
1233 # endif
1234 #endif /* no yyoverflow */
1236 yyssp = yyss + yysize - 1;
1237 yyvsp = yyvs + yysize - 1;
1240 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1241 (unsigned long int) yystacksize));
1243 if (yyss + yystacksize - 1 <= yyssp)
1244 YYABORT;
1247 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1249 goto yybackup;
1251 /*-----------.
1252 | yybackup. |
1253 `-----------*/
1254 yybackup:
1256 /* Do appropriate processing given the current state. Read a
1257 look-ahead token if we need one and don't already have one. */
1259 /* First try to decide what to do without reference to look-ahead token. */
1260 yyn = yypact[yystate];
1261 if (yyn == YYPACT_NINF)
1262 goto yydefault;
1264 /* Not known => get a look-ahead token if don't already have one. */
1266 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1267 if (yychar == YYEMPTY)
1269 YYDPRINTF ((stderr, "Reading a token: "));
1270 yychar = YYLEX;
1273 if (yychar <= YYEOF)
1275 yychar = yytoken = YYEOF;
1276 YYDPRINTF ((stderr, "Now at end of input.\n"));
1278 else
1280 yytoken = YYTRANSLATE (yychar);
1281 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1284 /* If the proper action on seeing token YYTOKEN is to reduce or to
1285 detect an error, take that action. */
1286 yyn += yytoken;
1287 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1288 goto yydefault;
1289 yyn = yytable[yyn];
1290 if (yyn <= 0)
1292 if (yyn == 0 || yyn == YYTABLE_NINF)
1293 goto yyerrlab;
1294 yyn = -yyn;
1295 goto yyreduce;
1298 if (yyn == YYFINAL)
1299 YYACCEPT;
1301 /* Count tokens shifted since error; after three, turn off error
1302 status. */
1303 if (yyerrstatus)
1304 yyerrstatus--;
1306 /* Shift the look-ahead token. */
1307 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1309 /* Discard the shifted token unless it is eof. */
1310 if (yychar != YYEOF)
1311 yychar = YYEMPTY;
1313 yystate = yyn;
1314 *++yyvsp = yylval;
1316 goto yynewstate;
1319 /*-----------------------------------------------------------.
1320 | yydefault -- do the default action for the current state. |
1321 `-----------------------------------------------------------*/
1322 yydefault:
1323 yyn = yydefact[yystate];
1324 if (yyn == 0)
1325 goto yyerrlab;
1326 goto yyreduce;
1329 /*-----------------------------.
1330 | yyreduce -- Do a reduction. |
1331 `-----------------------------*/
1332 yyreduce:
1333 /* yyn is the number of a rule to reduce with. */
1334 yylen = yyr2[yyn];
1336 /* If YYLEN is nonzero, implement the default value of the action:
1337 `$$ = $1'.
1339 Otherwise, the following line sets YYVAL to garbage.
1340 This behavior is undocumented and Bison
1341 users should not rely upon it. Assigning to YYVAL
1342 unconditionally makes the parser a bit smaller, and it avoids a
1343 GCC warning that YYVAL may be used uninitialized. */
1344 yyval = yyvsp[1-yylen];
1347 YY_REDUCE_PRINT (yyn);
1348 switch (yyn)
1350 case 2:
1351 #line 43 "./Parser.y"
1353 ParsedSearchExpression((yyvsp[(1) - (1)].pexpr));
1354 delete (yyvsp[(1) - (1)].pexpr);
1355 return 0;
1357 break;
1359 case 3:
1360 #line 49 "./Parser.y"
1362 CSearchExpr* pexpr = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1363 ParsedSearchExpression(pexpr);
1364 delete pexpr;
1365 delete (yyvsp[(1) - (1)].pstr);
1366 return 0;
1368 break;
1370 case 4:
1371 #line 58 "./Parser.y"
1373 yyerror(wxT("Undefined search expression error"));
1374 delete (yyvsp[(1) - (2)].pexpr);
1375 return 1;
1377 break;
1379 case 6:
1380 #line 68 "./Parser.y"
1382 CSearchExpr* pexpr = new CSearchExpr;
1383 pexpr->Add(SEARCHOP_AND);
1384 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1385 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1386 (yyval.pexpr) = pexpr;
1387 delete (yyvsp[(1) - (3)].pexpr);
1388 delete (yyvsp[(3) - (3)].pexpr);
1390 break;
1392 case 7:
1393 #line 78 "./Parser.y"
1395 CSearchExpr* pexpr = new CSearchExpr;
1396 pexpr->Add(SEARCHOP_OR);
1397 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1398 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1399 (yyval.pexpr) = pexpr;
1400 delete (yyvsp[(1) - (3)].pexpr);
1401 delete (yyvsp[(3) - (3)].pexpr);
1403 break;
1405 case 8:
1406 #line 88 "./Parser.y"
1408 CSearchExpr* pexpr = new CSearchExpr;
1409 pexpr->Add(SEARCHOP_NOT);
1410 pexpr->Add((yyvsp[(1) - (3)].pexpr));
1411 pexpr->Add((yyvsp[(3) - (3)].pexpr));
1412 (yyval.pexpr) = pexpr;
1413 delete (yyvsp[(1) - (3)].pexpr);
1414 delete (yyvsp[(3) - (3)].pexpr);
1416 break;
1418 case 9:
1419 #line 98 "./Parser.y"
1421 (yyval.pexpr) = (yyvsp[(2) - (3)].pexpr);
1423 break;
1425 case 10:
1426 #line 103 "./Parser.y"
1428 yyerror(wxT("Missing right operand for OR on search expression"));
1429 delete (yyvsp[(1) - (3)].pexpr);
1430 return 1;
1432 break;
1434 case 11:
1435 #line 109 "./Parser.y"
1437 yyerror(wxT("Missing operand for NOT on search expression"));
1438 delete (yyvsp[(1) - (3)].pexpr);
1439 return 1;
1441 break;
1443 case 12:
1444 #line 115 "./Parser.y"
1446 yyerror(wxT("Missing left parenthesis on search expression"));
1447 return 1;
1449 break;
1451 case 13:
1452 #line 120 "./Parser.y"
1454 yyerror(wxT("Missing closing parenthesis on search expression"));
1455 delete (yyvsp[(2) - (3)].pexpr);
1456 return 1;
1458 break;
1460 case 14:
1461 #line 126 "./Parser.y"
1463 yyerror(wxT("Missing left operand for AND on search expression"));
1464 return 1;
1466 break;
1468 case 15:
1469 #line 131 "./Parser.y"
1471 yyerror(wxT("Missing left operand for OR on search expression"));
1472 return 1;
1474 break;
1476 case 16:
1477 #line 136 "./Parser.y"
1479 yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1480 return 1;
1482 break;
1484 case 17:
1485 #line 143 "./Parser.y"
1487 (yyval.pexpr) = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1488 delete (yyvsp[(1) - (1)].pstr);
1490 break;
1492 case 18:
1493 #line 148 "./Parser.y"
1495 /*$1->Concatenate($2);
1496 delete $2;*/
1497 CSearchExpr* pexpr = new CSearchExpr;
1498 pexpr->Add(SEARCHOP_AND);
1499 pexpr->Add((yyvsp[(1) - (2)].pexpr));
1500 pexpr->Add(*(yyvsp[(2) - (2)].pstr));
1501 (yyval.pexpr) = pexpr;
1502 delete (yyvsp[(1) - (2)].pexpr);
1503 delete (yyvsp[(2) - (2)].pstr);
1505 break;
1508 /* Line 1267 of yacc.c. */
1509 #line 1513 "Parser.cpp"
1510 default: break;
1512 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1514 YYPOPSTACK (yylen);
1515 yylen = 0;
1516 YY_STACK_PRINT (yyss, yyssp);
1518 *++yyvsp = yyval;
1521 /* Now `shift' the result of the reduction. Determine what state
1522 that goes to, based on the state we popped back to and the rule
1523 number reduced by. */
1525 yyn = yyr1[yyn];
1527 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1528 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1529 yystate = yytable[yystate];
1530 else
1531 yystate = yydefgoto[yyn - YYNTOKENS];
1533 goto yynewstate;
1536 /*------------------------------------.
1537 | yyerrlab -- here on detecting error |
1538 `------------------------------------*/
1539 yyerrlab:
1540 /* If not already recovering from an error, report this error. */
1541 if (!yyerrstatus)
1543 ++yynerrs;
1544 #if ! YYERROR_VERBOSE
1545 yyerror (YY_("syntax error"));
1546 #else
1548 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1549 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1551 YYSIZE_T yyalloc = 2 * yysize;
1552 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1553 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1554 if (yymsg != yymsgbuf)
1555 YYSTACK_FREE (yymsg);
1556 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1557 if (yymsg)
1558 yymsg_alloc = yyalloc;
1559 else
1561 yymsg = yymsgbuf;
1562 yymsg_alloc = sizeof yymsgbuf;
1566 if (0 < yysize && yysize <= yymsg_alloc)
1568 (void) yysyntax_error (yymsg, yystate, yychar);
1569 yyerror (yymsg);
1571 else
1573 yyerror (YY_("syntax error"));
1574 if (yysize != 0)
1575 goto yyexhaustedlab;
1578 #endif
1583 if (yyerrstatus == 3)
1585 /* If just tried and failed to reuse look-ahead token after an
1586 error, discard it. */
1588 if (yychar <= YYEOF)
1590 /* Return failure if at end of input. */
1591 if (yychar == YYEOF)
1592 YYABORT;
1594 else
1596 yydestruct ("Error: discarding",
1597 yytoken, &yylval);
1598 yychar = YYEMPTY;
1602 /* Else will try to reuse look-ahead token after shifting the error
1603 token. */
1604 goto yyerrlab1;
1607 /*---------------------------------------------------.
1608 | yyerrorlab -- error raised explicitly by YYERROR. |
1609 `---------------------------------------------------*/
1610 yyerrorlab:
1612 /* Pacify compilers like GCC when the user code never invokes
1613 YYERROR and the label yyerrorlab therefore never appears in user
1614 code. */
1615 if (/*CONSTCOND*/ 0)
1616 goto yyerrorlab;
1618 /* Do not reclaim the symbols of the rule which action triggered
1619 this YYERROR. */
1620 YYPOPSTACK (yylen);
1621 yylen = 0;
1622 YY_STACK_PRINT (yyss, yyssp);
1623 yystate = *yyssp;
1624 goto yyerrlab1;
1627 /*-------------------------------------------------------------.
1628 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1629 `-------------------------------------------------------------*/
1630 yyerrlab1:
1631 yyerrstatus = 3; /* Each real token shifted decrements this. */
1633 for (;;)
1635 yyn = yypact[yystate];
1636 if (yyn != YYPACT_NINF)
1638 yyn += YYTERROR;
1639 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1641 yyn = yytable[yyn];
1642 if (0 < yyn)
1643 break;
1647 /* Pop the current state because it cannot handle the error token. */
1648 if (yyssp == yyss)
1649 YYABORT;
1652 yydestruct ("Error: popping",
1653 yystos[yystate], yyvsp);
1654 YYPOPSTACK (1);
1655 yystate = *yyssp;
1656 YY_STACK_PRINT (yyss, yyssp);
1659 if (yyn == YYFINAL)
1660 YYACCEPT;
1662 *++yyvsp = yylval;
1665 /* Shift the error token. */
1666 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1668 yystate = yyn;
1669 goto yynewstate;
1672 /*-------------------------------------.
1673 | yyacceptlab -- YYACCEPT comes here. |
1674 `-------------------------------------*/
1675 yyacceptlab:
1676 yyresult = 0;
1677 goto yyreturn;
1679 /*-----------------------------------.
1680 | yyabortlab -- YYABORT comes here. |
1681 `-----------------------------------*/
1682 yyabortlab:
1683 yyresult = 1;
1684 goto yyreturn;
1686 #ifndef yyoverflow
1687 /*-------------------------------------------------.
1688 | yyexhaustedlab -- memory exhaustion comes here. |
1689 `-------------------------------------------------*/
1690 yyexhaustedlab:
1691 yyerror (YY_("memory exhausted"));
1692 yyresult = 2;
1693 /* Fall through. */
1694 #endif
1696 yyreturn:
1697 if (yychar != YYEOF && yychar != YYEMPTY)
1698 yydestruct ("Cleanup: discarding lookahead",
1699 yytoken, &yylval);
1700 /* Do not reclaim the symbols of the rule which action triggered
1701 this YYABORT or YYACCEPT. */
1702 YYPOPSTACK (yylen);
1703 YY_STACK_PRINT (yyss, yyssp);
1704 while (yyssp != yyss)
1706 yydestruct ("Cleanup: popping",
1707 yystos[*yyssp], yyvsp);
1708 YYPOPSTACK (1);
1710 #ifndef yyoverflow
1711 if (yyss != yyssa)
1712 YYSTACK_FREE (yyss);
1713 #endif
1714 #if YYERROR_VERBOSE
1715 if (yymsg != yymsgbuf)
1716 YYSTACK_FREE (yymsg);
1717 #endif
1718 /* Make sure YYID is used. */
1719 return YYID (yyresult);
1723 #line 161 "./Parser.y"
1726 int yyerror(const char* errstr)
1728 // Errors created by yacc generated code
1729 //yyerror ("syntax error: cannot back up");
1730 //yyerror ("syntax error; also virtual memory exhausted");
1731 //yyerror ("syntax error");
1732 //yyerror ("parser stack overflow");
1734 _astrParserErrors.Add(char2unicode(errstr));
1735 return EXIT_FAILURE;
1738 int yyerror(wxString errstr)
1740 _astrParserErrors.Add(errstr);
1741 return EXIT_FAILURE;