1/* A Bison parser, made by GNU Bison 2.3.  */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5   Copyright (c) 1984-2008 Free Software Foundation, Inc.
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2, or (at your option)
10   any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software
19   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20   Boston, MA 02110-1301, USA.  */
21
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.
31
32   This special exception was added by the Free Software Foundation in
33   version 2.2 of Bison.  */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36   simplifying the original so-called "semantic" parser.  */
37
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.  */
44
45/* Identify Bison output.  */
46#define YYBISON 1
47
48/* Bison version.  */
49#define YYBISON_VERSION "2.3"
50
51/* Skeleton name.  */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers.  */
55#define YYPURE 0
56
57/* Using locations.  */
58#define YYLSP_NEEDED 0
59
60
61
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
73   };
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"
83
84class wxString;
85
86#include "Scanner.h.in"
87#include "Scanner.h"
88#include "OtherFunctions.h"
89#include "SearchExpr.h"
90
91#include "libs/common/StringFunctions.h"
92
93#ifdef _DEBUG
94#undef THIS_FILE
95static char THIS_FILE[] = __FILE__;
96#endif
97
98extern wxArrayString _astrParserErrors;
99
100void ParsedSearchExpression(const CSearchExpr* pexpr);
101int yyerror(const char* errstr);
102int yyerror(wxString errstr);
103
104
105
106/* Enabling traces.  */
107#ifndef YYDEBUG
108# define YYDEBUG 1
109#endif
110
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
118
119/* Enabling the token table.  */
120#ifndef YYTOKEN_TABLE
121# define YYTOKEN_TABLE 0
122#endif
123
124#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
125typedef union YYSTYPE
126#line 23 "./Parser.y"
127{
128	wxString*		pstr;
129	CSearchExpr*	pexpr;
130}
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
138
139
140
141/* Copy the second part of user declarations.  */
142
143
144/* Line 216 of yacc.c.  */
145#line 150 "Parser.cpp"
146
147#ifdef short
148# undef short
149#endif
150
151#ifdef YYTYPE_UINT8
152typedef YYTYPE_UINT8 yytype_uint8;
153#else
154typedef unsigned char yytype_uint8;
155#endif
156
157#ifdef YYTYPE_INT8
158typedef YYTYPE_INT8 yytype_int8;
159#elif (defined __STDC__ || defined __C99__FUNC__ \
160     || defined __cplusplus || defined _MSC_VER)
161typedef signed char yytype_int8;
162#else
163typedef short int yytype_int8;
164#endif
165
166#ifdef YYTYPE_UINT16
167typedef YYTYPE_UINT16 yytype_uint16;
168#else
169typedef unsigned short int yytype_uint16;
170#endif
171
172#ifdef YYTYPE_INT16
173typedef YYTYPE_INT16 yytype_int16;
174#else
175typedef short int yytype_int16;
176#endif
177
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
191
192#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
193
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
205
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
212
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)
219static int
220YYID (int i)
221#else
222static int
223YYID (i)
224    int i;
225#endif
226{
227  return i;
228}
229#endif
230
231#if ! defined yyoverflow || YYERROR_VERBOSE
232
233/* The parser invokes alloca or malloc; define the necessary symbols.  */
234
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
258
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)
287void *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)
294void free (void *); /* INFRINGES ON USER NAME SPACE */
295#   endif
296#  endif
297# endif
298#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
299
300
301#if (! defined yyoverflow \
302     && (! defined __cplusplus \
303	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
304
305/* A type that is properly aligned for any stack member.  */
306union yyalloc
307{
308  yytype_int16 yyss;
309  YYSTYPE yyvs;
310  };
311
312/* The size of the maximum gap between one aligned stack and the next.  */
313# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
314
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)
320
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					\
330	{					\
331	  YYSIZE_T yyi;				\
332	  for (yyi = 0; yyi < (Count); yyi++)	\
333	    (To)[yyi] = (From)[yyi];		\
334	}					\
335      while (YYID (0))
336#  endif
337# endif
338
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									\
346      {									\
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);				\
352      }									\
353    while (YYID (0))
354
355#endif
356
357/* YYFINAL -- State number of the termination state.  */
358#define YYFINAL  15
359/* YYLAST -- Last index in YYTABLE.  */
360#define YYLAST   52
361
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
370
371/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
372#define YYUNDEFTOK  2
373#define YYMAXUTOK   262
374
375#define YYTRANSLATE(YYX)						\
376  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
377
378/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
379static const yytype_uint8 yytranslate[] =
380{
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
408};
409
410#if YYDEBUG
411/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
412   YYRHS.  */
413static const yytype_uint8 yyprhs[] =
414{
415       0,     0,     3,     5,     7,    10,    12,    16,    20,    24,
416      28,    32,    36,    39,    43,    46,    49,    52,    54
417};
418
419/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
420static const yytype_int8 yyrhs[] =
421{
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
428};
429
430/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
431static const yytype_uint8 yyrline[] =
432{
433       0,    42,    42,    48,    57,    66,    67,    77,    87,    97,
434     102,   108,   114,   119,   125,   130,   135,   142,   147
435};
436#endif
437
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.  */
441static const char *const yytname[] =
442{
443  "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
444  "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
445  "searchexpr", "and_strings", 0
446};
447#endif
448
449# ifdef YYPRINT
450/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
451   token YYLEX-NUM.  */
452static const yytype_uint16 yytoknum[] =
453{
454       0,   256,   257,   258,   259,   260,   261,   262,    40,    41
455};
456# endif
457
458/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
459static const yytype_uint8 yyr1[] =
460{
461       0,    10,    11,    11,    11,    12,    12,    12,    12,    12,
462      12,    12,    12,    12,    12,    12,    12,    13,    13
463};
464
465/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
466static const yytype_uint8 yyr2[] =
467{
468       0,     2,     1,     1,     2,     1,     3,     3,     3,     3,
469       3,     3,     2,     3,     2,     2,     2,     1,     2
470};
471
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.  */
475static const yytype_uint8 yydefact[] =
476{
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
480};
481
482/* YYDEFGOTO[NTERM-NUM].  */
483static const yytype_int8 yydefgoto[] =
484{
485      -1,     7,     8,     9
486};
487
488/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
489   STATE-NUM.  */
490#define YYPACT_NINF -7
491static const yytype_int8 yypact[] =
492{
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
496};
497
498/* YYPGOTO[NTERM-NUM].  */
499static const yytype_int8 yypgoto[] =
500{
501      -7,    -7,    -6,    -7
502};
503
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
509static const yytype_int8 yytable[] =
510{
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
517};
518
519static const yytype_int8 yycheck[] =
520{
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
527};
528
529/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
530   symbol of state STATE-NUM.  */
531static const yytype_uint8 yystos[] =
532{
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
536};
537
538#define yyerrok		(yyerrstatus = 0)
539#define yyclearin	(yychar = YYEMPTY)
540#define YYEMPTY		(-2)
541#define YYEOF		0
542
543#define YYACCEPT	goto yyacceptlab
544#define YYABORT		goto yyabortlab
545#define YYERROR		goto yyerrorlab
546
547
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.  */
551
552#define YYFAIL		goto yyerrlab
553
554#define YYRECOVERING()  (!!yyerrstatus)
555
556#define YYBACKUP(Token, Value)					\
557do								\
558  if (yychar == YYEMPTY && yylen == 1)				\
559    {								\
560      yychar = (Token);						\
561      yylval = (Value);						\
562      yytoken = YYTRANSLATE (yychar);				\
563      YYPOPSTACK (1);						\
564      goto yybackup;						\
565    }								\
566  else								\
567    {								\
568      yyerror (YY_("syntax error: cannot back up")); \
569      YYERROR;							\
570    }								\
571while (YYID (0))
572
573
574#define YYTERROR	1
575#define YYERRCODE	256
576
577
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).  */
581
582#define YYRHSLOC(Rhs, K) ((Rhs)[K])
583#ifndef YYLLOC_DEFAULT
584# define YYLLOC_DEFAULT(Current, Rhs, N)				\
585    do									\
586      if (YYID (N))                                                    \
587	{								\
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;	\
592	}								\
593      else								\
594	{								\
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;				\
599	}								\
600    while (YYID (0))
601#endif
602
603
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.  */
607
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
618
619
620/* YYLEX -- calling `yylex' with the right arguments.  */
621
622#ifdef YYLEX_PARAM
623# define YYLEX yylex (YYLEX_PARAM)
624#else
625# define YYLEX yylex ()
626#endif
627
628/* Enable debugging if requested.  */
629#if YYDEBUG
630
631# ifndef YYFPRINTF
632#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
633#  define YYFPRINTF fprintf
634# endif
635
636# define YYDPRINTF(Args)			\
637do {						\
638  if (yydebug)					\
639    YYFPRINTF Args;				\
640} while (YYID (0))
641
642# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
643do {									  \
644  if (yydebug)								  \
645    {									  \
646      YYFPRINTF (stderr, "%s ", Title);					  \
647      yy_symbol_print (stderr,						  \
648		  Type, Value); \
649      YYFPRINTF (stderr, "\n");						  \
650    }									  \
651} while (YYID (0))
652
653
654/*--------------------------------.
655| Print this symbol on YYOUTPUT.  |
656`--------------------------------*/
657
658/*ARGSUSED*/
659#if (defined __STDC__ || defined __C99__FUNC__ \
660     || defined __cplusplus || defined _MSC_VER)
661static void
662yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
663#else
664static void
665yy_symbol_value_print (yyoutput, yytype, yyvaluep)
666    FILE *yyoutput;
667    int yytype;
668    YYSTYPE const * const yyvaluep;
669#endif
670{
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)
680    {
681      default:
682	break;
683    }
684}
685
686
687/*--------------------------------.
688| Print this symbol on YYOUTPUT.  |
689`--------------------------------*/
690
691#if (defined __STDC__ || defined __C99__FUNC__ \
692     || defined __cplusplus || defined _MSC_VER)
693static void
694yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
695#else
696static void
697yy_symbol_print (yyoutput, yytype, yyvaluep)
698    FILE *yyoutput;
699    int yytype;
700    YYSTYPE const * const yyvaluep;
701#endif
702{
703  if (yytype < YYNTOKENS)
704    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
705  else
706    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
707
708  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
709  YYFPRINTF (yyoutput, ")");
710}
711
712/*------------------------------------------------------------------.
713| yy_stack_print -- Print the state stack from its BOTTOM up to its |
714| TOP (included).                                                   |
715`------------------------------------------------------------------*/
716
717#if (defined __STDC__ || defined __C99__FUNC__ \
718     || defined __cplusplus || defined _MSC_VER)
719static void
720yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
721#else
722static void
723yy_stack_print (bottom, top)
724    yytype_int16 *bottom;
725    yytype_int16 *top;
726#endif
727{
728  YYFPRINTF (stderr, "Stack now");
729  for (; bottom <= top; ++bottom)
730    YYFPRINTF (stderr, " %d", *bottom);
731  YYFPRINTF (stderr, "\n");
732}
733
734# define YY_STACK_PRINT(Bottom, Top)				\
735do {								\
736  if (yydebug)							\
737    yy_stack_print ((Bottom), (Top));				\
738} while (YYID (0))
739
740
741/*------------------------------------------------.
742| Report that the YYRULE is going to be reduced.  |
743`------------------------------------------------*/
744
745#if (defined __STDC__ || defined __C99__FUNC__ \
746     || defined __cplusplus || defined _MSC_VER)
747static void
748yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
749#else
750static void
751yy_reduce_print (yyvsp, yyrule)
752    YYSTYPE *yyvsp;
753    int yyrule;
754#endif
755{
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++)
763    {
764      fprintf (stderr, "   $%d = ", yyi + 1);
765      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
766		       &(yyvsp[(yyi + 1) - (yynrhs)])
767		       		       );
768      fprintf (stderr, "\n");
769    }
770}
771
772# define YY_REDUCE_PRINT(Rule)		\
773do {					\
774  if (yydebug)				\
775    yy_reduce_print (yyvsp, Rule); \
776} while (YYID (0))
777
778/* Nonzero means print parse trace.  It is left uninitialized so that
779   multiple parsers can coexist.  */
780int 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 */
787
788
789/* YYINITDEPTH -- initial size of the parser's stacks.  */
790#ifndef	YYINITDEPTH
791# define YYINITDEPTH 200
792#endif
793
794/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
795   if the built-in stack extension method is used).
796
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.  */
800
801#ifndef YYMAXDEPTH
802# define YYMAXDEPTH 10000
803#endif
804
805
806
807#if YYERROR_VERBOSE
808
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)
816static YYSIZE_T
817yystrlen (const char *yystr)
818#else
819static YYSIZE_T
820yystrlen (yystr)
821    const char *yystr;
822#endif
823{
824  YYSIZE_T yylen;
825  for (yylen = 0; yystr[yylen]; yylen++)
826    continue;
827  return yylen;
828}
829#  endif
830# endif
831
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)
840static char *
841yystpcpy (char *yydest, const char *yysrc)
842#else
843static char *
844yystpcpy (yydest, yysrc)
845    char *yydest;
846    const char *yysrc;
847#endif
848{
849  char *yyd = yydest;
850  const char *yys = yysrc;
851
852  while ((*yyd++ = *yys++) != '\0')
853    continue;
854
855  return yyd - 1;
856}
857#  endif
858# endif
859
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.  */
868static YYSIZE_T
869yytnamerr (char *yyres, const char *yystr)
870{
871  if (*yystr == '"')
872    {
873      YYSIZE_T yyn = 0;
874      char const *yyp = yystr;
875
876      for (;;)
877	switch (*++yyp)
878	  {
879	  case '\'':
880	  case ',':
881	    goto do_not_strip_quotes;
882
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;
892
893	  case '"':
894	    if (yyres)
895	      yyres[yyn] = '\0';
896	    return yyn;
897	  }
898    do_not_strip_quotes: ;
899    }
900
901  if (! yyres)
902    return yystrlen (yystr);
903
904  return yystpcpy (yyres, yystr) - yyres;
905}
906# endif
907
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.  */
915static YYSIZE_T
916yysyntax_error (char *yyresult, int yystate, int yychar)
917{
918  int yyn = yypact[yystate];
919
920  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
921    return 0;
922  else
923    {
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;
932
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;
952
953      /* Start YYX at -YYN if negative to avoid negative indexes in
954	 YYCHECK.  */
955      int yyxbegin = yyn < 0 ? -yyn : 0;
956
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;
961
962      yyarg[0] = yytname[yytype];
963      yyfmt = yystpcpy (yyformat, yyunexpected);
964
965      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
966	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
967	  {
968	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
969	      {
970		yycount = 1;
971		yysize = yysize0;
972		yyformat[sizeof yyunexpected - 1] = '\0';
973		break;
974	      }
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;
981	  }
982
983      yyf = YY_(yyformat);
984      yysize1 = yysize + yystrlen (yyf);
985      yysize_overflow |= (yysize1 < yysize);
986      yysize = yysize1;
987
988      if (yysize_overflow)
989	return YYSIZE_MAXIMUM;
990
991      if (yyresult)
992	{
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')
999	    {
1000	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1001		{
1002		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1003		  yyf += 2;
1004		}
1005	      else
1006		{
1007		  yyp++;
1008		  yyf++;
1009		}
1010	    }
1011	}
1012      return yysize;
1013    }
1014}
1015#endif /* YYERROR_VERBOSE */
1016
1017
1018/*-----------------------------------------------.
1019| Release the memory associated to this symbol.  |
1020`-----------------------------------------------*/
1021
1022/*ARGSUSED*/
1023#if (defined __STDC__ || defined __C99__FUNC__ \
1024     || defined __cplusplus || defined _MSC_VER)
1025static void
1026yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1027#else
1028static void
1029yydestruct (yymsg, yytype, yyvaluep)
1030    const char *yymsg;
1031    int yytype;
1032    YYSTYPE *yyvaluep;
1033#endif
1034{
1035  YYUSE (yyvaluep);
1036
1037  if (!yymsg)
1038    yymsg = "Deleting";
1039  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1040
1041  switch (yytype)
1042    {
1043
1044      default:
1045	break;
1046    }
1047}
1048
1049
1050/* Prevent warnings from -Wmissing-prototypes.  */
1051
1052#ifdef YYPARSE_PARAM
1053#if defined __STDC__ || defined __cplusplus
1054int yyparse (void *YYPARSE_PARAM);
1055#else
1056int yyparse ();
1057#endif
1058#else /* ! YYPARSE_PARAM */
1059#if defined __STDC__ || defined __cplusplus
1060int yyparse (void);
1061#else
1062int yyparse ();
1063#endif
1064#endif /* ! YYPARSE_PARAM */
1065
1066
1067
1068/* The look-ahead symbol.  */
1069int yychar;
1070
1071/* The semantic value of the look-ahead symbol.  */
1072YYSTYPE yylval;
1073
1074/* Number of syntax errors so far.  */
1075int yynerrs;
1076
1077
1078
1079/*----------.
1080| yyparse.  |
1081`----------*/
1082
1083#ifdef YYPARSE_PARAM
1084#if (defined __STDC__ || defined __C99__FUNC__ \
1085     || defined __cplusplus || defined _MSC_VER)
1086int
1087yyparse (void *YYPARSE_PARAM)
1088#else
1089int
1090yyparse (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)
1096int
1097yyparse (void)
1098#else
1099int
1100yyparse ()
1101
1102#endif
1103#endif
1104{
1105
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
1119
1120  /* Three stacks and their tools:
1121     `yyss': related to states,
1122     `yyvs': related to semantic values,
1123     `yyls': related to locations.
1124
1125     Refer to the stacks thru separate pointers, to allow yyoverflow
1126     to reallocate them elsewhere.  */
1127
1128  /* The state stack.  */
1129  yytype_int16 yyssa[YYINITDEPTH];
1130  yytype_int16 *yyss = yyssa;
1131  yytype_int16 *yyssp;
1132
1133  /* The semantic value stack.  */
1134  YYSTYPE yyvsa[YYINITDEPTH];
1135  YYSTYPE *yyvs = yyvsa;
1136  YYSTYPE *yyvsp;
1137
1138
1139
1140#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1141
1142  YYSIZE_T yystacksize = YYINITDEPTH;
1143
1144  /* The variables used to return semantic value and location from the
1145     action routines.  */
1146  YYSTYPE yyval;
1147
1148
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;
1152
1153  YYDPRINTF ((stderr, "Starting parse\n"));
1154
1155  yystate = 0;
1156  yyerrstatus = 0;
1157  yynerrs = 0;
1158  yychar = YYEMPTY;		/* Cause a token to be read.  */
1159
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.  */
1164
1165  yyssp = yyss;
1166  yyvsp = yyvs;
1167
1168  goto yysetstate;
1169
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++;
1177
1178 yysetstate:
1179  *yyssp = yystate;
1180
1181  if (yyss + yystacksize - 1 <= yyssp)
1182    {
1183      /* Get the current used size of the three stacks, in elements.  */
1184      YYSIZE_T yysize = yyssp - yyss + 1;
1185
1186#ifdef yyoverflow
1187      {
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;
1193
1194
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),
1202
1203		    &yystacksize);
1204
1205	yyss = yyss1;
1206	yyvs = yyvs1;
1207      }
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;
1218
1219      {
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);
1227
1228#  undef YYSTACK_RELOCATE
1229	if (yyss1 != yyssa)
1230	  YYSTACK_FREE (yyss1);
1231      }
1232# endif
1233#endif /* no yyoverflow */
1234
1235      yyssp = yyss + yysize - 1;
1236      yyvsp = yyvs + yysize - 1;
1237
1238
1239      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1240		  (unsigned long int) yystacksize));
1241
1242      if (yyss + yystacksize - 1 <= yyssp)
1243	YYABORT;
1244    }
1245
1246  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1247
1248  goto yybackup;
1249
1250/*-----------.
1251| yybackup.  |
1252`-----------*/
1253yybackup:
1254
1255  /* Do appropriate processing given the current state.  Read a
1256     look-ahead token if we need one and don't already have one.  */
1257
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;
1262
1263  /* Not known => get a look-ahead token if don't already have one.  */
1264
1265  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1266  if (yychar == YYEMPTY)
1267    {
1268      YYDPRINTF ((stderr, "Reading a token: "));
1269      yychar = YYLEX;
1270    }
1271
1272  if (yychar <= YYEOF)
1273    {
1274      yychar = yytoken = YYEOF;
1275      YYDPRINTF ((stderr, "Now at end of input.\n"));
1276    }
1277  else
1278    {
1279      yytoken = YYTRANSLATE (yychar);
1280      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1281    }
1282
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)
1290    {
1291      if (yyn == 0 || yyn == YYTABLE_NINF)
1292	goto yyerrlab;
1293      yyn = -yyn;
1294      goto yyreduce;
1295    }
1296
1297  if (yyn == YYFINAL)
1298    YYACCEPT;
1299
1300  /* Count tokens shifted since error; after three, turn off error
1301     status.  */
1302  if (yyerrstatus)
1303    yyerrstatus--;
1304
1305  /* Shift the look-ahead token.  */
1306  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1307
1308  /* Discard the shifted token unless it is eof.  */
1309  if (yychar != YYEOF)
1310    yychar = YYEMPTY;
1311
1312  yystate = yyn;
1313  *++yyvsp = yylval;
1314
1315  goto yynewstate;
1316
1317
1318/*-----------------------------------------------------------.
1319| yydefault -- do the default action for the current state.  |
1320`-----------------------------------------------------------*/
1321yydefault:
1322  yyn = yydefact[yystate];
1323  if (yyn == 0)
1324    goto yyerrlab;
1325  goto yyreduce;
1326
1327
1328/*-----------------------------.
1329| yyreduce -- Do a reduction.  |
1330`-----------------------------*/
1331yyreduce:
1332  /* yyn is the number of a rule to reduce with.  */
1333  yylen = yyr2[yyn];
1334
1335  /* If YYLEN is nonzero, implement the default value of the action:
1336     `$$ = $1'.
1337
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];
1344
1345
1346  YY_REDUCE_PRINT (yyn);
1347  switch (yyn)
1348    {
1349        case 2:
1350#line 43 "./Parser.y"
1351    {
1352						ParsedSearchExpression((yyvsp[(1) - (1)].pexpr));
1353						delete (yyvsp[(1) - (1)].pexpr);
1354						return 0;
1355					;}
1356    break;
1357
1358  case 3:
1359#line 49 "./Parser.y"
1360    {
1361						CSearchExpr* pexpr = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1362						ParsedSearchExpression(pexpr);
1363						delete pexpr;
1364						delete (yyvsp[(1) - (1)].pstr);
1365						return 0;
1366					;}
1367    break;
1368
1369  case 4:
1370#line 58 "./Parser.y"
1371    {
1372						yyerror(wxT("Undefined search expression error"));
1373						delete (yyvsp[(1) - (2)].pexpr);
1374						return 1;
1375					;}
1376    break;
1377
1378  case 6:
1379#line 68 "./Parser.y"
1380    {
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);
1388					;}
1389    break;
1390
1391  case 7:
1392#line 78 "./Parser.y"
1393    {
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);
1401					;}
1402    break;
1403
1404  case 8:
1405#line 88 "./Parser.y"
1406    {
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);
1414					;}
1415    break;
1416
1417  case 9:
1418#line 98 "./Parser.y"
1419    {
1420						(yyval.pexpr) = (yyvsp[(2) - (3)].pexpr);
1421					;}
1422    break;
1423
1424  case 10:
1425#line 103 "./Parser.y"
1426    {
1427						yyerror(wxT("Missing right operand for OR on search expression"));
1428						delete (yyvsp[(1) - (3)].pexpr);
1429						return 1;
1430					;}
1431    break;
1432
1433  case 11:
1434#line 109 "./Parser.y"
1435    {
1436						yyerror(wxT("Missing operand for NOT on search expression"));
1437						delete (yyvsp[(1) - (3)].pexpr);
1438						return 1;
1439					;}
1440    break;
1441
1442  case 12:
1443#line 115 "./Parser.y"
1444    {
1445						yyerror(wxT("Missing left parenthesis on search expression"));
1446						return 1;
1447					;}
1448    break;
1449
1450  case 13:
1451#line 120 "./Parser.y"
1452    {
1453						yyerror(wxT("Missing closing parenthesis on search expression"));
1454						delete (yyvsp[(2) - (3)].pexpr);
1455						return 1;
1456					;}
1457    break;
1458
1459  case 14:
1460#line 126 "./Parser.y"
1461    {
1462						yyerror(wxT("Missing left operand for AND on search expression"));
1463						return 1;
1464					;}
1465    break;
1466
1467  case 15:
1468#line 131 "./Parser.y"
1469    {
1470						yyerror(wxT("Missing left operand for OR on search expression"));
1471						return 1;
1472					;}
1473    break;
1474
1475  case 16:
1476#line 136 "./Parser.y"
1477    {
1478						yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1479						return 1;
1480					;}
1481    break;
1482
1483  case 17:
1484#line 143 "./Parser.y"
1485    {
1486						(yyval.pexpr) = new CSearchExpr(*(yyvsp[(1) - (1)].pstr));
1487						delete (yyvsp[(1) - (1)].pstr);
1488					;}
1489    break;
1490
1491  case 18:
1492#line 148 "./Parser.y"
1493    {
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);
1503					;}
1504    break;
1505
1506
1507/* Line 1267 of yacc.c.  */
1508#line 1513 "Parser.cpp"
1509      default: break;
1510    }
1511  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1512
1513  YYPOPSTACK (yylen);
1514  yylen = 0;
1515  YY_STACK_PRINT (yyss, yyssp);
1516
1517  *++yyvsp = yyval;
1518
1519
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.  */
1523
1524  yyn = yyr1[yyn];
1525
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];
1531
1532  goto yynewstate;
1533
1534
1535/*------------------------------------.
1536| yyerrlab -- here on detecting error |
1537`------------------------------------*/
1538yyerrlab:
1539  /* If not already recovering from an error, report this error.  */
1540  if (!yyerrstatus)
1541    {
1542      ++yynerrs;
1543#if ! YYERROR_VERBOSE
1544      yyerror (YY_("syntax error"));
1545#else
1546      {
1547	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1548	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1549	  {
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
1559	      {
1560		yymsg = yymsgbuf;
1561		yymsg_alloc = sizeof yymsgbuf;
1562	      }
1563	  }
1564
1565	if (0 < yysize && yysize <= yymsg_alloc)
1566	  {
1567	    (void) yysyntax_error (yymsg, yystate, yychar);
1568	    yyerror (yymsg);
1569	  }
1570	else
1571	  {
1572	    yyerror (YY_("syntax error"));
1573	    if (yysize != 0)
1574	      goto yyexhaustedlab;
1575	  }
1576      }
1577#endif
1578    }
1579
1580
1581
1582  if (yyerrstatus == 3)
1583    {
1584      /* If just tried and failed to reuse look-ahead token after an
1585	 error, discard it.  */
1586
1587      if (yychar <= YYEOF)
1588	{
1589	  /* Return failure if at end of input.  */
1590	  if (yychar == YYEOF)
1591	    YYABORT;
1592	}
1593      else
1594	{
1595	  yydestruct ("Error: discarding",
1596		      yytoken, &yylval);
1597	  yychar = YYEMPTY;
1598	}
1599    }
1600
1601  /* Else will try to reuse look-ahead token after shifting the error
1602     token.  */
1603  goto yyerrlab1;
1604
1605
1606/*---------------------------------------------------.
1607| yyerrorlab -- error raised explicitly by YYERROR.  |
1608`---------------------------------------------------*/
1609yyerrorlab:
1610
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;
1616
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;
1624
1625
1626/*-------------------------------------------------------------.
1627| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1628`-------------------------------------------------------------*/
1629yyerrlab1:
1630  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1631
1632  for (;;)
1633    {
1634      yyn = yypact[yystate];
1635      if (yyn != YYPACT_NINF)
1636	{
1637	  yyn += YYTERROR;
1638	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1639	    {
1640	      yyn = yytable[yyn];
1641	      if (0 < yyn)
1642		break;
1643	    }
1644	}
1645
1646      /* Pop the current state because it cannot handle the error token.  */
1647      if (yyssp == yyss)
1648	YYABORT;
1649
1650
1651      yydestruct ("Error: popping",
1652		  yystos[yystate], yyvsp);
1653      YYPOPSTACK (1);
1654      yystate = *yyssp;
1655      YY_STACK_PRINT (yyss, yyssp);
1656    }
1657
1658  if (yyn == YYFINAL)
1659    YYACCEPT;
1660
1661  *++yyvsp = yylval;
1662
1663
1664  /* Shift the error token.  */
1665  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1666
1667  yystate = yyn;
1668  goto yynewstate;
1669
1670
1671/*-------------------------------------.
1672| yyacceptlab -- YYACCEPT comes here.  |
1673`-------------------------------------*/
1674yyacceptlab:
1675  yyresult = 0;
1676  goto yyreturn;
1677
1678/*-----------------------------------.
1679| yyabortlab -- YYABORT comes here.  |
1680`-----------------------------------*/
1681yyabortlab:
1682  yyresult = 1;
1683  goto yyreturn;
1684
1685#ifndef yyoverflow
1686/*-------------------------------------------------.
1687| yyexhaustedlab -- memory exhaustion comes here.  |
1688`-------------------------------------------------*/
1689yyexhaustedlab:
1690  yyerror (YY_("memory exhausted"));
1691  yyresult = 2;
1692  /* Fall through.  */
1693#endif
1694
1695yyreturn:
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)
1704    {
1705      yydestruct ("Cleanup: popping",
1706		  yystos[*yyssp], yyvsp);
1707      YYPOPSTACK (1);
1708    }
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);
1719}
1720
1721
1722#line 161 "./Parser.y"
1723
1724
1725int yyerror(const char* errstr)
1726{
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");
1732
1733	_astrParserErrors.Add(char2unicode(errstr));
1734	return EXIT_FAILURE;
1735}
1736
1737int yyerror(wxString errstr)
1738{
1739	_astrParserErrors.Add(errstr);
1740	return EXIT_FAILURE;
1741}
1742
1743