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)
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. */
49 #define YYBISON_VERSION "2.3"
52 #define YYSKELETON_NAME "yacc.c"
57 /* Using locations. */
58 #define YYLSP_NEEDED 0
65 /* Put the tokens into the symbol table, so that GDB and other debuggers
76 #define TOK_STRING 258
80 #define TOK_ED2K_LINK 262
81 /* Copy the first part of user declarations. */
86 #include "Scanner.h.in"
88 #include "OtherFunctions.h"
89 #include "SearchExpr.h"
91 #include "libs/common/StringFunctions.h"
95 static char THIS_FILE
[] = __FILE__
;
98 extern wxArrayString _astrParserErrors
;
100 void ParsedSearchExpression(const CSearchExpr
* pexpr
);
101 int yyerror(const char* errstr
);
102 int yyerror(wxString errstr
);
106 /* Enabling traces. */
111 /* Enabling verbose error messages. */
112 #ifdef YYERROR_VERBOSE
113 # undef YYERROR_VERBOSE
114 # define YYERROR_VERBOSE 1
116 # define YYERROR_VERBOSE 0
119 /* Enabling the token table. */
120 #ifndef YYTOKEN_TABLE
121 # define YYTOKEN_TABLE 0
124 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
125 typedef union YYSTYPE
126 #line 23 "./Parser.y"
131 /* Line 187 of yacc.c. */
132 #line 137 "Parser.cpp"
134 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
135 # define YYSTYPE_IS_DECLARED 1
136 # define YYSTYPE_IS_TRIVIAL 1
141 /* Copy the second part of user declarations. */
144 /* Line 216 of yacc.c. */
145 #line 150 "Parser.cpp"
152 typedef YYTYPE_UINT8 yytype_uint8
;
154 typedef unsigned char yytype_uint8
;
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
;
163 typedef short int yytype_int8
;
167 typedef YYTYPE_UINT16 yytype_uint16
;
169 typedef unsigned short int yytype_uint16
;
173 typedef YYTYPE_INT16 yytype_int16
;
175 typedef short int yytype_int16
;
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
188 # define YYSIZE_T unsigned int
192 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
197 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
198 # define YY_(msgid) dgettext ("bison-runtime", msgid)
202 # define YY_(msgid) msgid
206 /* Suppress unused-variable warnings by "using" E. */
207 #if ! defined lint || defined __GNUC__
208 # define YYUSE(e) ((void) (e))
210 # define YYUSE(e) /* empty */
213 /* Identity function, used to suppress warnings about constant conditions. */
217 #if (defined __STDC__ || defined __C99__FUNC__ \
218 || defined __cplusplus || defined _MSC_VER)
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
238 # define YYSTACK_ALLOC __builtin_alloca
239 # elif defined __BUILTIN_VA_ARG_INCR
240 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
242 # define YYSTACK_ALLOC __alloca
243 # elif defined _MSC_VER
244 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
245 # define alloca _alloca
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 */
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 */
270 # define YYSTACK_ALLOC YYMALLOC
271 # define YYSTACK_FREE YYFREE
272 # ifndef YYSTACK_ALLOC_MAXIMUM
273 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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 */
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 */
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 */
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. */
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
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
324 # if defined __GNUC__ && 1 < __GNUC__
325 # define YYCOPY(To, From, Count) \
326 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
328 # define YYCOPY(To, From, Count) \
332 for (yyi = 0; yyi < (Count); yyi++) \
333 (To)[yyi] = (From)[yyi]; \
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
344 # define YYSTACK_RELOCATE(Stack) \
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); \
357 /* YYFINAL -- State number of the termination state. */
359 /* YYLAST -- Last index in YYTABLE. */
362 /* YYNTOKENS -- Number of terminals. */
364 /* YYNNTS -- Number of nonterminals. */
366 /* YYNRULES -- Number of rules. */
368 /* YYNRULES -- Number of states. */
371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
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,
411 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
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
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
450 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
452 static const yytype_uint16 yytoknum
[] =
454 0, 256, 257, 258, 259, 260, 261, 262, 40, 41
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
[] =
488 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
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
[] =
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,
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,
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)
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) \
558 if (yychar == YYEMPTY && yylen == 1) \
562 yytoken = YYTRANSLATE (yychar); \
568 yyerror (YY_("syntax error: cannot back up")); \
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) \
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; \
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; \
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)
615 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
620 /* YYLEX -- calling `yylex' with the right arguments. */
623 # define YYLEX yylex (YYLEX_PARAM)
625 # define YYLEX yylex ()
628 /* Enable debugging if requested. */
632 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
633 # define YYFPRINTF fprintf
636 # define YYDPRINTF(Args) \
642 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
646 YYFPRINTF (stderr, "%s ", Title); \
647 yy_symbol_print (stderr, \
649 YYFPRINTF (stderr, "\n"); \
654 /*--------------------------------.
655 | Print this symbol on YYOUTPUT. |
656 `--------------------------------*/
659 #if (defined __STDC__ || defined __C99__FUNC__ \
660 || defined __cplusplus || defined _MSC_VER)
662 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
665 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
668 YYSTYPE
const * const yyvaluep
;
674 if (yytype
< YYNTOKENS
)
675 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
687 /*--------------------------------.
688 | Print this symbol on YYOUTPUT. |
689 `--------------------------------*/
691 #if (defined __STDC__ || defined __C99__FUNC__ \
692 || defined __cplusplus || defined _MSC_VER)
694 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
697 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
700 YYSTYPE
const * const yyvaluep
;
703 if (yytype
< YYNTOKENS
)
704 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
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 |
715 `------------------------------------------------------------------*/
717 #if (defined __STDC__ || defined __C99__FUNC__ \
718 || defined __cplusplus || defined _MSC_VER)
720 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
723 yy_stack_print (bottom
, top
)
724 yytype_int16
*bottom
;
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) \
737 yy_stack_print ((Bottom), (Top)); \
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)
748 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
751 yy_reduce_print (yyvsp
, yyrule
)
756 int yynrhs
= yyr2
[yyrule
];
758 unsigned long int yylno
= yyrline
[yyrule
];
759 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
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) \
775 yy_reduce_print (yyvsp, Rule); \
778 /* Nonzero means print parse trace. It is left uninitialized so that
779 multiple parsers can coexist. */
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. */
791 # define YYINITDEPTH 200
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. */
802 # define YYMAXDEPTH 10000
810 # if defined __GLIBC__ && defined _STRING_H
811 # define yystrlen strlen
813 /* Return the length of YYSTR. */
814 #if (defined __STDC__ || defined __C99__FUNC__ \
815 || defined __cplusplus || defined _MSC_VER)
817 yystrlen (const char *yystr
)
825 for (yylen
= 0; yystr
[yylen
]; yylen
++)
833 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
834 # define yystpcpy stpcpy
836 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
838 #if (defined __STDC__ || defined __C99__FUNC__ \
839 || defined __cplusplus || defined _MSC_VER)
841 yystpcpy (char *yydest
, const char *yysrc
)
844 yystpcpy (yydest
, yysrc
)
850 const char *yys
= yysrc
;
852 while ((*yyd
++ = *yys
++) != '\0')
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
869 yytnamerr (char *yyres
, const char *yystr
)
874 char const *yyp
= yystr
;
881 goto do_not_strip_quotes
;
885 goto do_not_strip_quotes
;
898 do_not_strip_quotes
: ;
902 return yystrlen (yystr
);
904 return yystpcpy (yyres
, yystr
) - yyres
;
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
916 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
918 int yyn
= yypact
[yystate
];
920 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
924 int yytype
= YYTRANSLATE (yychar
);
925 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
926 YYSIZE_T yysize
= yysize0
;
928 int yysize_overflow
= 0;
929 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
930 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
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");
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
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
;
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
)
972 yyformat
[sizeof yyunexpected
- 1] = '\0';
975 yyarg
[yycount
++] = yytname
[yyx
];
976 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
977 yysize_overflow
|= (yysize1
< yysize
);
979 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
984 yysize1
= yysize
+ yystrlen (yyf
);
985 yysize_overflow
|= (yysize1
< yysize
);
989 return YYSIZE_MAXIMUM
;
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
;
998 while ((*yyp
= *yyf
) != '\0')
1000 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1002 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1015 #endif /* YYERROR_VERBOSE */
1018 /*-----------------------------------------------.
1019 | Release the memory associated to this symbol. |
1020 `-----------------------------------------------*/
1023 #if (defined __STDC__ || defined __C99__FUNC__ \
1024 || defined __cplusplus || defined _MSC_VER)
1026 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1029 yydestruct (yymsg
, yytype
, yyvaluep
)
1039 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1050 /* Prevent warnings from -Wmissing-prototypes. */
1052 #ifdef YYPARSE_PARAM
1053 #if defined __STDC__ || defined __cplusplus
1054 int yyparse (void *YYPARSE_PARAM
);
1058 #else /* ! YYPARSE_PARAM */
1059 #if defined __STDC__ || defined __cplusplus
1064 #endif /* ! YYPARSE_PARAM */
1068 /* The look-ahead symbol. */
1071 /* The semantic value of the look-ahead symbol. */
1074 /* Number of syntax errors so far. */
1083 #ifdef YYPARSE_PARAM
1084 #if (defined __STDC__ || defined __C99__FUNC__ \
1085 || defined __cplusplus || defined _MSC_VER)
1087 yyparse (void *YYPARSE_PARAM
)
1090 yyparse (YYPARSE_PARAM
)
1091 void *YYPARSE_PARAM
;
1093 #else /* ! YYPARSE_PARAM */
1094 #if (defined __STDC__ || defined __C99__FUNC__ \
1095 || defined __cplusplus || defined _MSC_VER)
1109 /* Number of tokens to shift before error messages enabled. */
1111 /* Look-ahead token as an internal (translated) token number. */
1114 /* Buffer for error messages, and its allocated size. */
1116 char *yymsg
= yymsgbuf
;
1117 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
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
;
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
1149 /* The number of symbols on the RHS of the reduced rule.
1150 Keep to zero when no symbol should be popped. */
1153 YYDPRINTF ((stderr
, "Starting parse\n"));
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. */
1170 /*------------------------------------------------------------.
1171 | yynewstate -- Push a new state, which is found in yystate. |
1172 `------------------------------------------------------------*/
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. */
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;
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
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
),
1208 #else /* no yyoverflow */
1209 # ifndef YYSTACK_RELOCATE
1210 goto yyexhaustedlab
;
1212 /* Extend the stack our own way. */
1213 if (YYMAXDEPTH
<= yystacksize
)
1214 goto yyexhaustedlab
;
1216 if (YYMAXDEPTH
< yystacksize
)
1217 yystacksize
= YYMAXDEPTH
;
1220 yytype_int16
*yyss1
= yyss
;
1221 union yyalloc
*yyptr
=
1222 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1224 goto yyexhaustedlab
;
1225 YYSTACK_RELOCATE (yyss
);
1226 YYSTACK_RELOCATE (yyvs
);
1228 # undef YYSTACK_RELOCATE
1230 YYSTACK_FREE (yyss1
);
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
)
1246 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
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
)
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: "));
1272 if (yychar
<= YYEOF
)
1274 yychar
= yytoken
= YYEOF
;
1275 YYDPRINTF ((stderr
, "Now at end of input.\n"));
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. */
1286 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1291 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1300 /* Count tokens shifted since error; after three, turn off error
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
)
1318 /*-----------------------------------------------------------.
1319 | yydefault -- do the default action for the current state. |
1320 `-----------------------------------------------------------*/
1322 yyn
= yydefact
[yystate
];
1328 /*-----------------------------.
1329 | yyreduce -- Do a reduction. |
1330 `-----------------------------*/
1332 /* yyn is the number of a rule to reduce with. */
1335 /* If YYLEN is nonzero, implement the default value of the action:
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
);
1350 #line 43 "./Parser.y"
1352 ParsedSearchExpression((yyvsp
[(1) - (1)].pexpr
));
1353 delete (yyvsp
[(1) - (1)].pexpr
);
1359 #line 49 "./Parser.y"
1361 CSearchExpr
* pexpr
= new CSearchExpr(*(yyvsp
[(1) - (1)].pstr
));
1362 ParsedSearchExpression(pexpr
);
1364 delete (yyvsp
[(1) - (1)].pstr
);
1370 #line 58 "./Parser.y"
1372 yyerror(wxT("Undefined search expression error"));
1373 delete (yyvsp
[(1) - (2)].pexpr
);
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
);
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
);
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
);
1418 #line 98 "./Parser.y"
1420 (yyval
.pexpr
) = (yyvsp
[(2) - (3)].pexpr
);
1425 #line 103 "./Parser.y"
1427 yyerror(wxT("Missing right operand for OR on search expression"));
1428 delete (yyvsp
[(1) - (3)].pexpr
);
1434 #line 109 "./Parser.y"
1436 yyerror(wxT("Missing operand for NOT on search expression"));
1437 delete (yyvsp
[(1) - (3)].pexpr
);
1443 #line 115 "./Parser.y"
1445 yyerror(wxT("Missing left parenthesis on search expression"));
1451 #line 120 "./Parser.y"
1453 yyerror(wxT("Missing closing parenthesis on search expression"));
1454 delete (yyvsp
[(2) - (3)].pexpr
);
1460 #line 126 "./Parser.y"
1462 yyerror(wxT("Missing left operand for AND on search expression"));
1468 #line 131 "./Parser.y"
1470 yyerror(wxT("Missing left operand for OR on search expression"));
1476 #line 136 "./Parser.y"
1478 yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1484 #line 143 "./Parser.y"
1486 (yyval
.pexpr
) = new CSearchExpr(*(yyvsp
[(1) - (1)].pstr
));
1487 delete (yyvsp
[(1) - (1)].pstr
);
1492 #line 148 "./Parser.y"
1494 /*$1->Concatenate($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
);
1507 /* Line 1267 of yacc.c. */
1508 #line 1513 "Parser.cpp"
1511 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1515 YY_STACK_PRINT (yyss
, yyssp
);
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. */
1526 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1527 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1528 yystate
= yytable
[yystate
];
1530 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1535 /*------------------------------------.
1536 | yyerrlab -- here on detecting error |
1537 `------------------------------------*/
1539 /* If not already recovering from an error, report this error. */
1543 #if ! YYERROR_VERBOSE
1544 yyerror (YY_("syntax error"));
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
);
1557 yymsg_alloc
= yyalloc
;
1561 yymsg_alloc
= sizeof yymsgbuf
;
1565 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1567 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1572 yyerror (YY_("syntax error"));
1574 goto yyexhaustedlab
;
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
)
1595 yydestruct ("Error: discarding",
1601 /* Else will try to reuse look-ahead token after shifting the error
1606 /*---------------------------------------------------.
1607 | yyerrorlab -- error raised explicitly by YYERROR. |
1608 `---------------------------------------------------*/
1611 /* Pacify compilers like GCC when the user code never invokes
1612 YYERROR and the label yyerrorlab therefore never appears in user
1614 if (/*CONSTCOND*/ 0)
1617 /* Do not reclaim the symbols of the rule which action triggered
1621 YY_STACK_PRINT (yyss
, yyssp
);
1626 /*-------------------------------------------------------------.
1627 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1628 `-------------------------------------------------------------*/
1630 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1634 yyn
= yypact
[yystate
];
1635 if (yyn
!= YYPACT_NINF
)
1638 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1646 /* Pop the current state because it cannot handle the error token. */
1651 yydestruct ("Error: popping",
1652 yystos
[yystate
], yyvsp
);
1655 YY_STACK_PRINT (yyss
, yyssp
);
1664 /* Shift the error token. */
1665 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1671 /*-------------------------------------.
1672 | yyacceptlab -- YYACCEPT comes here. |
1673 `-------------------------------------*/
1678 /*-----------------------------------.
1679 | yyabortlab -- YYABORT comes here. |
1680 `-----------------------------------*/
1686 /*-------------------------------------------------.
1687 | yyexhaustedlab -- memory exhaustion comes here. |
1688 `-------------------------------------------------*/
1690 yyerror (YY_("memory exhausted"));
1696 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1697 yydestruct ("Cleanup: discarding lookahead",
1699 /* Do not reclaim the symbols of the rule which action triggered
1700 this YYABORT or YYACCEPT. */
1702 YY_STACK_PRINT (yyss
, yyssp
);
1703 while (yyssp
!= yyss
)
1705 yydestruct ("Cleanup: popping",
1706 yystos
[*yyssp
], yyvsp
);
1711 YYSTACK_FREE (yyss
);
1714 if (yymsg
!= yymsgbuf
)
1715 YYSTACK_FREE (yymsg
);
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
;