1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 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 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.4"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
65 #line 1 "./Parser.y" /* yacc.c:339 */
67 #include "SearchExpr.h"
69 #include "OtherFunctions.h"
71 #include "libs/common/StringFunctions.h"
75 static char THIS_FILE
[] = __FILE__
;
78 extern wxArrayString _astrParserErrors
;
80 int yyerror(const char* errstr
);
81 int yyerror(wxString errstr
);
84 #line 85 "Parser.cpp" /* yacc.c:339 */
87 # if defined __cplusplus && 201103L <= __cplusplus
88 # define YY_NULLPTR nullptr
94 /* Enabling verbose error messages. */
95 #ifdef YYERROR_VERBOSE
96 # undef YYERROR_VERBOSE
97 # define YYERROR_VERBOSE 1
99 # define YYERROR_VERBOSE 0
102 /* In a future release of Bison, this section will be replaced
103 by #include "Parser.hpp". */
104 #ifndef YY_YY_PARSER_HPP_INCLUDED
105 # define YY_YY_PARSER_HPP_INCLUDED
128 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
132 #line 20 "./Parser.y" /* yacc.c:355 */
137 #line 138 "Parser.cpp" /* yacc.c:355 */
140 typedef union YYSTYPE YYSTYPE
;
141 # define YYSTYPE_IS_TRIVIAL 1
142 # define YYSTYPE_IS_DECLARED 1
146 extern YYSTYPE yylval
;
150 #endif /* !YY_YY_PARSER_HPP_INCLUDED */
152 /* Copy the second part of user declarations. */
154 #line 155 "Parser.cpp" /* yacc.c:358 */
161 typedef YYTYPE_UINT8 yytype_uint8
;
163 typedef unsigned char yytype_uint8
;
167 typedef YYTYPE_INT8 yytype_int8
;
169 typedef signed char yytype_int8
;
173 typedef YYTYPE_UINT16 yytype_uint16
;
175 typedef unsigned short int yytype_uint16
;
179 typedef YYTYPE_INT16 yytype_int16
;
181 typedef short int yytype_int16
;
185 # ifdef __SIZE_TYPE__
186 # define YYSIZE_T __SIZE_TYPE__
187 # elif defined size_t
188 # define YYSIZE_T size_t
189 # elif ! defined YYSIZE_T
190 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
191 # define YYSIZE_T size_t
193 # define YYSIZE_T unsigned int
197 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
200 # if defined YYENABLE_NLS && YYENABLE_NLS
202 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
203 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
207 # define YY_(Msgid) Msgid
212 # if (defined __GNUC__ \
213 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
214 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
215 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
217 # define YY_ATTRIBUTE(Spec) /* empty */
221 #ifndef YY_ATTRIBUTE_PURE
222 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
225 #ifndef YY_ATTRIBUTE_UNUSED
226 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
229 #if !defined _Noreturn \
230 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
231 # if defined _MSC_VER && 1200 <= _MSC_VER
232 # define _Noreturn __declspec (noreturn)
234 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
238 /* Suppress unused-variable warnings by "using" E. */
239 #if ! defined lint || defined __GNUC__
240 # define YYUSE(E) ((void) (E))
242 # define YYUSE(E) /* empty */
245 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
246 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
247 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
248 _Pragma ("GCC diagnostic push") \
249 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
250 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
251 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
252 _Pragma ("GCC diagnostic pop")
254 # define YY_INITIAL_VALUE(Value) Value
256 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
257 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
258 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
260 #ifndef YY_INITIAL_VALUE
261 # define YY_INITIAL_VALUE(Value) /* Nothing. */
265 #if ! defined yyoverflow || YYERROR_VERBOSE
267 /* The parser invokes alloca or malloc; define the necessary symbols. */
269 # ifdef YYSTACK_USE_ALLOCA
270 # if YYSTACK_USE_ALLOCA
272 # define YYSTACK_ALLOC __builtin_alloca
273 # elif defined __BUILTIN_VA_ARG_INCR
274 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
276 # define YYSTACK_ALLOC __alloca
277 # elif defined _MSC_VER
278 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
279 # define alloca _alloca
281 # define YYSTACK_ALLOC alloca
282 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
283 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
285 # ifndef EXIT_SUCCESS
286 # define EXIT_SUCCESS 0
293 # ifdef YYSTACK_ALLOC
294 /* Pacify GCC's 'empty if-body' warning. */
295 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
296 # ifndef YYSTACK_ALLOC_MAXIMUM
297 /* The OS might guarantee only one guard page at the bottom of the stack,
298 and a page size can be as small as 4096 bytes. So we cannot safely
299 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
300 to allow for a few compiler-allocated temporary stack slots. */
301 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
304 # define YYSTACK_ALLOC YYMALLOC
305 # define YYSTACK_FREE YYFREE
306 # ifndef YYSTACK_ALLOC_MAXIMUM
307 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
309 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
310 && ! ((defined YYMALLOC || defined malloc) \
311 && (defined YYFREE || defined free)))
312 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
313 # ifndef EXIT_SUCCESS
314 # define EXIT_SUCCESS 0
318 # define YYMALLOC malloc
319 # if ! defined malloc && ! defined EXIT_SUCCESS
320 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
325 # if ! defined free && ! defined EXIT_SUCCESS
326 void free (void *); /* INFRINGES ON USER NAME SPACE */
330 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
333 #if (! defined yyoverflow \
334 && (! defined __cplusplus \
335 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
337 /* A type that is properly aligned for any stack member. */
340 yytype_int16 yyss_alloc
;
344 /* The size of the maximum gap between one aligned stack and the next. */
345 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
347 /* The size of an array large to enough to hold all stacks, each with
349 # define YYSTACK_BYTES(N) \
350 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
351 + YYSTACK_GAP_MAXIMUM)
353 # define YYCOPY_NEEDED 1
355 /* Relocate STACK from its old location to the new one. The
356 local variables YYSIZE and YYSTACKSIZE give the old and new number of
357 elements in the stack, and YYPTR gives the new location of the
358 stack. Advance YYPTR to a properly aligned location for the next
360 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
363 YYSIZE_T yynewbytes; \
364 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
365 Stack = &yyptr->Stack_alloc; \
366 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
367 yyptr += yynewbytes / sizeof (*yyptr); \
373 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
374 /* Copy COUNT objects from SRC to DST. The source and destination do
377 # if defined __GNUC__ && 1 < __GNUC__
378 # define YYCOPY(Dst, Src, Count) \
379 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
381 # define YYCOPY(Dst, Src, Count) \
385 for (yyi = 0; yyi < (Count); yyi++) \
386 (Dst)[yyi] = (Src)[yyi]; \
391 #endif /* !YYCOPY_NEEDED */
393 /* YYFINAL -- State number of the termination state. */
395 /* YYLAST -- Last index in YYTABLE. */
398 /* YYNTOKENS -- Number of terminals. */
400 /* YYNNTS -- Number of nonterminals. */
402 /* YYNRULES -- Number of rules. */
404 /* YYNSTATES -- Number of states. */
407 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
408 by yylex, with out-of-bounds checking. */
410 #define YYMAXUTOK 262
412 #define YYTRANSLATE(YYX) \
413 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
415 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
416 as returned by yylex, without out-of-bounds checking. */
417 static const yytype_uint8 yytranslate
[] =
419 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 8, 9, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
449 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
450 static const yytype_uint8 yyrline
[] =
452 0, 39, 39, 45, 54, 63, 64, 74, 84, 94,
453 99, 105, 111, 116, 122, 127, 132, 139, 144
457 #if YYDEBUG || YYERROR_VERBOSE || 0
458 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
459 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
460 static const char *const yytname
[] =
462 "$end", "error", "$undefined", "TOK_STRING", "TOK_AND", "TOK_OR",
463 "TOK_NOT", "TOK_ED2K_LINK", "'('", "')'", "$accept", "action",
464 "searchexpr", "and_strings", YY_NULLPTR
469 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
470 (internal) symbol number NUM (which must be that of a token). */
471 static const yytype_uint16 yytoknum
[] =
473 0, 256, 257, 258, 259, 260, 261, 262, 40, 41
477 #define YYPACT_NINF -7
479 #define yypact_value_is_default(Yystate) \
480 (!!((Yystate) == (-7)))
482 #define YYTABLE_NINF -3
484 #define yytable_value_is_error(Yytable_value) \
487 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
489 static const yytype_int8 yypact
[] =
491 38, -7, 1, 2, 6, -7, 13, 15, 34, 29,
492 -7, -7, -7, -7, 0, -7, -7, 44, 19, 25,
493 -7, -7, -7, 30, -7, 4, -7, -7
496 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
497 Performed when YYTABLE does not specify something else to do. Zero
498 means the default is an error. */
499 static const yytype_uint8 yydefact
[] =
501 0, 17, 0, 0, 0, 3, 0, 0, 0, 5,
502 14, 15, 16, 12, 0, 1, 4, 0, 0, 0,
503 18, 13, 9, 6, 10, 7, 11, 8
506 /* YYPGOTO[NTERM-NUM]. */
507 static const yytype_int8 yypgoto
[] =
512 /* YYDEFGOTO[NTERM-NUM]. */
513 static const yytype_int8 yydefgoto
[] =
518 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
519 positive, shift that token. If negative, reduce the rule whose
520 number is the opposite. If YYTABLE_NINF, syntax error. */
521 static const yytype_int8 yytable
[] =
523 14, 21, 10, 11, 17, 18, 19, 12, 17, 22,
524 19, 23, 25, 27, 13, 15, 1, 2, 3, 4,
525 24, 6, 1, 2, 3, 4, 26, 6, 1, 2,
526 3, 4, 20, 6, -2, 16, 19, 0, 17, 18,
527 19, 1, 2, 3, 4, 5, 6, 1, 2, 3,
531 static const yytype_int8 yycheck
[] =
533 6, 1, 1, 1, 4, 5, 6, 1, 4, 9,
534 6, 17, 18, 19, 1, 0, 3, 4, 5, 6,
535 1, 8, 3, 4, 5, 6, 1, 8, 3, 4,
536 5, 6, 3, 8, 0, 1, 6, -1, 4, 5,
537 6, 3, 4, 5, 6, 7, 8, 3, 4, 5,
541 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
542 symbol of state STATE-NUM. */
543 static const yytype_uint8 yystos
[] =
545 0, 3, 4, 5, 6, 7, 8, 11, 12, 13,
546 1, 1, 1, 1, 12, 0, 1, 4, 5, 6,
547 3, 1, 9, 12, 1, 12, 1, 12
550 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
551 static const yytype_uint8 yyr1
[] =
553 0, 10, 11, 11, 11, 12, 12, 12, 12, 12,
554 12, 12, 12, 12, 12, 12, 12, 13, 13
557 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
558 static const yytype_uint8 yyr2
[] =
560 0, 2, 1, 1, 2, 1, 3, 3, 3, 3,
561 3, 3, 2, 3, 2, 2, 2, 1, 2
565 #define yyerrok (yyerrstatus = 0)
566 #define yyclearin (yychar = YYEMPTY)
570 #define YYACCEPT goto yyacceptlab
571 #define YYABORT goto yyabortlab
572 #define YYERROR goto yyerrorlab
575 #define YYRECOVERING() (!!yyerrstatus)
577 #define YYBACKUP(Token, Value) \
579 if (yychar == YYEMPTY) \
583 YYPOPSTACK (yylen); \
589 yyerror (YY_("syntax error: cannot back up")); \
594 /* Error token number */
596 #define YYERRCODE 256
600 /* Enable debugging if requested. */
604 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
605 # define YYFPRINTF fprintf
608 # define YYDPRINTF(Args) \
614 /* This macro is provided for backward compatibility. */
615 #ifndef YY_LOCATION_PRINT
616 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
620 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
624 YYFPRINTF (stderr, "%s ", Title); \
625 yy_symbol_print (stderr, \
627 YYFPRINTF (stderr, "\n"); \
632 /*----------------------------------------.
633 | Print this symbol's value on YYOUTPUT. |
634 `----------------------------------------*/
637 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
639 FILE *yyo
= yyoutput
;
644 if (yytype
< YYNTOKENS
)
645 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
651 /*--------------------------------.
652 | Print this symbol on YYOUTPUT. |
653 `--------------------------------*/
656 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
658 YYFPRINTF (yyoutput
, "%s %s (",
659 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
661 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
662 YYFPRINTF (yyoutput
, ")");
665 /*------------------------------------------------------------------.
666 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
668 `------------------------------------------------------------------*/
671 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
673 YYFPRINTF (stderr
, "Stack now");
674 for (; yybottom
<= yytop
; yybottom
++)
676 int yybot
= *yybottom
;
677 YYFPRINTF (stderr
, " %d", yybot
);
679 YYFPRINTF (stderr
, "\n");
682 # define YY_STACK_PRINT(Bottom, Top) \
685 yy_stack_print ((Bottom), (Top)); \
689 /*------------------------------------------------.
690 | Report that the YYRULE is going to be reduced. |
691 `------------------------------------------------*/
694 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
)
696 unsigned long int yylno
= yyrline
[yyrule
];
697 int yynrhs
= yyr2
[yyrule
];
699 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
701 /* The symbols being reduced. */
702 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
704 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
705 yy_symbol_print (stderr
,
706 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
707 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
709 YYFPRINTF (stderr
, "\n");
713 # define YY_REDUCE_PRINT(Rule) \
716 yy_reduce_print (yyssp, yyvsp, Rule); \
719 /* Nonzero means print parse trace. It is left uninitialized so that
720 multiple parsers can coexist. */
723 # define YYDPRINTF(Args)
724 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
725 # define YY_STACK_PRINT(Bottom, Top)
726 # define YY_REDUCE_PRINT(Rule)
727 #endif /* !YYDEBUG */
730 /* YYINITDEPTH -- initial size of the parser's stacks. */
732 # define YYINITDEPTH 200
735 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
736 if the built-in stack extension method is used).
738 Do not make this value too large; the results are undefined if
739 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
740 evaluated with infinite-precision integer arithmetic. */
743 # define YYMAXDEPTH 10000
750 # if defined __GLIBC__ && defined _STRING_H
751 # define yystrlen strlen
753 /* Return the length of YYSTR. */
755 yystrlen (const char *yystr
)
758 for (yylen
= 0; yystr
[yylen
]; yylen
++)
766 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
767 # define yystpcpy stpcpy
769 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
772 yystpcpy (char *yydest
, const char *yysrc
)
775 const char *yys
= yysrc
;
777 while ((*yyd
++ = *yys
++) != '\0')
786 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
787 quotes and backslashes, so that it's suitable for yyerror. The
788 heuristic is that double-quoting is unnecessary unless the string
789 contains an apostrophe, a comma, or backslash (other than
790 backslash-backslash). YYSTR is taken from yytname. If YYRES is
791 null, do not copy; instead, return the length of what the result
794 yytnamerr (char *yyres
, const char *yystr
)
799 char const *yyp
= yystr
;
806 goto do_not_strip_quotes
;
810 goto do_not_strip_quotes
;
823 do_not_strip_quotes
: ;
827 return yystrlen (yystr
);
829 return yystpcpy (yyres
, yystr
) - yyres
;
833 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
834 about the unexpected token YYTOKEN for the state stack whose top is
837 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
838 not large enough to hold the message. In that case, also set
839 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
840 required number of bytes is too large to store. */
842 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
843 yytype_int16
*yyssp
, int yytoken
)
845 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
846 YYSIZE_T yysize
= yysize0
;
847 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
848 /* Internationalized format string. */
849 const char *yyformat
= YY_NULLPTR
;
850 /* Arguments of yyformat. */
851 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
852 /* Number of reported tokens (one for the "unexpected", one per
856 /* There are many possibilities here to consider:
857 - If this state is a consistent state with a default action, then
858 the only way this function was invoked is if the default action
859 is an error action. In that case, don't check for expected
860 tokens because there are none.
861 - The only way there can be no lookahead present (in yychar) is if
862 this state is a consistent state with a default action. Thus,
863 detecting the absence of a lookahead is sufficient to determine
864 that there is no unexpected or expected token to report. In that
865 case, just report a simple "syntax error".
866 - Don't assume there isn't a lookahead just because this state is a
867 consistent state with a default action. There might have been a
868 previous inconsistent state, consistent state with a non-default
869 action, or user semantic action that manipulated yychar.
870 - Of course, the expected token list depends on states to have
871 correct lookahead information, and it depends on the parser not
872 to perform extra reductions after fetching a lookahead from the
873 scanner and before detecting a syntax error. Thus, state merging
874 (from LALR or IELR) and default reductions corrupt the expected
875 token list. However, the list is correct for canonical LR with
876 one exception: it will still contain any token that will not be
877 accepted due to an error action in a later state.
879 if (yytoken
!= YYEMPTY
)
881 int yyn
= yypact
[*yyssp
];
882 yyarg
[yycount
++] = yytname
[yytoken
];
883 if (!yypact_value_is_default (yyn
))
885 /* Start YYX at -YYN if negative to avoid negative indexes in
886 YYCHECK. In other words, skip the first -YYN actions for
887 this state because they are default actions. */
888 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
889 /* Stay within bounds of both yycheck and yytname. */
890 int yychecklim
= YYLAST
- yyn
+ 1;
891 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
894 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
895 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
896 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
898 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
904 yyarg
[yycount
++] = yytname
[yyx
];
906 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
907 if (! (yysize
<= yysize1
908 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
918 # define YYCASE_(N, S) \
922 YYCASE_(0, YY_("syntax error"));
923 YYCASE_(1, YY_("syntax error, unexpected %s"));
924 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
925 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
926 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
927 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
932 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
933 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
938 if (*yymsg_alloc
< yysize
)
940 *yymsg_alloc
= 2 * yysize
;
941 if (! (yysize
<= *yymsg_alloc
942 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
943 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
947 /* Avoid sprintf, as that infringes on the user's name space.
948 Don't have undefined behavior even if the translation
949 produced a string with the wrong number of "%s"s. */
953 while ((*yyp
= *yyformat
) != '\0')
954 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
956 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
967 #endif /* YYERROR_VERBOSE */
969 /*-----------------------------------------------.
970 | Release the memory associated to this symbol. |
971 `-----------------------------------------------*/
974 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
979 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
981 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
983 YY_IGNORE_MAYBE_UNINITIALIZED_END
989 /* The lookahead symbol. */
992 /* The semantic value of the lookahead symbol. */
994 /* Number of syntax errors so far. */
1006 /* Number of tokens to shift before error messages enabled. */
1009 /* The stacks and their tools:
1010 'yyss': related to states.
1011 'yyvs': related to semantic values.
1013 Refer to the stacks through separate pointers, to allow yyoverflow
1014 to reallocate them elsewhere. */
1016 /* The state stack. */
1017 yytype_int16 yyssa
[YYINITDEPTH
];
1019 yytype_int16
*yyssp
;
1021 /* The semantic value stack. */
1022 YYSTYPE yyvsa
[YYINITDEPTH
];
1026 YYSIZE_T yystacksize
;
1030 /* Lookahead token as an internal (translated) token number. */
1032 /* The variables used to return semantic value and location from the
1037 /* Buffer for error messages, and its allocated size. */
1039 char *yymsg
= yymsgbuf
;
1040 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1043 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1045 /* The number of symbols on the RHS of the reduced rule.
1046 Keep to zero when no symbol should be popped. */
1049 yyssp
= yyss
= yyssa
;
1050 yyvsp
= yyvs
= yyvsa
;
1051 yystacksize
= YYINITDEPTH
;
1053 YYDPRINTF ((stderr
, "Starting parse\n"));
1058 yychar
= YYEMPTY
; /* Cause a token to be read. */
1061 /*------------------------------------------------------------.
1062 | yynewstate -- Push a new state, which is found in yystate. |
1063 `------------------------------------------------------------*/
1065 /* In all cases, when you get here, the value and location stacks
1066 have just been pushed. So pushing a state here evens the stacks. */
1072 if (yyss
+ yystacksize
- 1 <= yyssp
)
1074 /* Get the current used size of the three stacks, in elements. */
1075 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1079 /* Give user a chance to reallocate the stack. Use copies of
1080 these so that the &'s don't force the real ones into
1082 YYSTYPE
*yyvs1
= yyvs
;
1083 yytype_int16
*yyss1
= yyss
;
1085 /* Each stack pointer address is followed by the size of the
1086 data in use in that stack, in bytes. This used to be a
1087 conditional around just the two extra args, but that might
1088 be undefined if yyoverflow is a macro. */
1089 yyoverflow (YY_("memory exhausted"),
1090 &yyss1
, yysize
* sizeof (*yyssp
),
1091 &yyvs1
, yysize
* sizeof (*yyvsp
),
1097 #else /* no yyoverflow */
1098 # ifndef YYSTACK_RELOCATE
1099 goto yyexhaustedlab
;
1101 /* Extend the stack our own way. */
1102 if (YYMAXDEPTH
<= yystacksize
)
1103 goto yyexhaustedlab
;
1105 if (YYMAXDEPTH
< yystacksize
)
1106 yystacksize
= YYMAXDEPTH
;
1109 yytype_int16
*yyss1
= yyss
;
1110 union yyalloc
*yyptr
=
1111 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1113 goto yyexhaustedlab
;
1114 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1115 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1116 # undef YYSTACK_RELOCATE
1118 YYSTACK_FREE (yyss1
);
1121 #endif /* no yyoverflow */
1123 yyssp
= yyss
+ yysize
- 1;
1124 yyvsp
= yyvs
+ yysize
- 1;
1126 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1127 (unsigned long int) yystacksize
));
1129 if (yyss
+ yystacksize
- 1 <= yyssp
)
1133 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1135 if (yystate
== YYFINAL
)
1145 /* Do appropriate processing given the current state. Read a
1146 lookahead token if we need one and don't already have one. */
1148 /* First try to decide what to do without reference to lookahead token. */
1149 yyn
= yypact
[yystate
];
1150 if (yypact_value_is_default (yyn
))
1153 /* Not known => get a lookahead token if don't already have one. */
1155 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1156 if (yychar
== YYEMPTY
)
1158 YYDPRINTF ((stderr
, "Reading a token: "));
1162 if (yychar
<= YYEOF
)
1164 yychar
= yytoken
= YYEOF
;
1165 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1169 yytoken
= YYTRANSLATE (yychar
);
1170 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1173 /* If the proper action on seeing token YYTOKEN is to reduce or to
1174 detect an error, take that action. */
1176 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1181 if (yytable_value_is_error (yyn
))
1187 /* Count tokens shifted since error; after three, turn off error
1192 /* Shift the lookahead token. */
1193 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1195 /* Discard the shifted token. */
1199 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1201 YY_IGNORE_MAYBE_UNINITIALIZED_END
1206 /*-----------------------------------------------------------.
1207 | yydefault -- do the default action for the current state. |
1208 `-----------------------------------------------------------*/
1210 yyn
= yydefact
[yystate
];
1216 /*-----------------------------.
1217 | yyreduce -- Do a reduction. |
1218 `-----------------------------*/
1220 /* yyn is the number of a rule to reduce with. */
1223 /* If YYLEN is nonzero, implement the default value of the action:
1226 Otherwise, the following line sets YYVAL to garbage.
1227 This behavior is undocumented and Bison
1228 users should not rely upon it. Assigning to YYVAL
1229 unconditionally makes the parser a bit smaller, and it avoids a
1230 GCC warning that YYVAL may be used uninitialized. */
1231 yyval
= yyvsp
[1-yylen
];
1234 YY_REDUCE_PRINT (yyn
);
1238 #line 40 "./Parser.y" /* yacc.c:1646 */
1240 ParsedSearchExpression((yyvsp
[0].pexpr
));
1241 delete (yyvsp
[0].pexpr
);
1244 #line 1245 "Parser.cpp" /* yacc.c:1646 */
1248 #line 46 "./Parser.y" /* yacc.c:1646 */
1250 CSearchExpr
* pexpr
= new CSearchExpr(*(yyvsp
[0].pstr
));
1251 ParsedSearchExpression(pexpr
);
1253 delete (yyvsp
[0].pstr
);
1256 #line 1257 "Parser.cpp" /* yacc.c:1646 */
1260 #line 55 "./Parser.y" /* yacc.c:1646 */
1262 yyerror(wxT("Undefined search expression error"));
1263 delete (yyvsp
[-1].pexpr
);
1266 #line 1267 "Parser.cpp" /* yacc.c:1646 */
1270 #line 65 "./Parser.y" /* yacc.c:1646 */
1272 CSearchExpr
* pexpr
= new CSearchExpr
;
1273 pexpr
->Add(SEARCHOP_AND
);
1274 pexpr
->Add((yyvsp
[-2].pexpr
));
1275 pexpr
->Add((yyvsp
[0].pexpr
));
1276 (yyval
.pexpr
) = pexpr
;
1277 delete (yyvsp
[-2].pexpr
);
1278 delete (yyvsp
[0].pexpr
);
1280 #line 1281 "Parser.cpp" /* yacc.c:1646 */
1284 #line 75 "./Parser.y" /* yacc.c:1646 */
1286 CSearchExpr
* pexpr
= new CSearchExpr
;
1287 pexpr
->Add(SEARCHOP_OR
);
1288 pexpr
->Add((yyvsp
[-2].pexpr
));
1289 pexpr
->Add((yyvsp
[0].pexpr
));
1290 (yyval
.pexpr
) = pexpr
;
1291 delete (yyvsp
[-2].pexpr
);
1292 delete (yyvsp
[0].pexpr
);
1294 #line 1295 "Parser.cpp" /* yacc.c:1646 */
1298 #line 85 "./Parser.y" /* yacc.c:1646 */
1300 CSearchExpr
* pexpr
= new CSearchExpr
;
1301 pexpr
->Add(SEARCHOP_NOT
);
1302 pexpr
->Add((yyvsp
[-2].pexpr
));
1303 pexpr
->Add((yyvsp
[0].pexpr
));
1304 (yyval
.pexpr
) = pexpr
;
1305 delete (yyvsp
[-2].pexpr
);
1306 delete (yyvsp
[0].pexpr
);
1308 #line 1309 "Parser.cpp" /* yacc.c:1646 */
1312 #line 95 "./Parser.y" /* yacc.c:1646 */
1314 (yyval
.pexpr
) = (yyvsp
[-1].pexpr
);
1316 #line 1317 "Parser.cpp" /* yacc.c:1646 */
1320 #line 100 "./Parser.y" /* yacc.c:1646 */
1322 yyerror(wxT("Missing right operand for OR on search expression"));
1323 delete (yyvsp
[-2].pexpr
);
1326 #line 1327 "Parser.cpp" /* yacc.c:1646 */
1330 #line 106 "./Parser.y" /* yacc.c:1646 */
1332 yyerror(wxT("Missing operand for NOT on search expression"));
1333 delete (yyvsp
[-2].pexpr
);
1336 #line 1337 "Parser.cpp" /* yacc.c:1646 */
1340 #line 112 "./Parser.y" /* yacc.c:1646 */
1342 yyerror(wxT("Missing left parenthesis on search expression"));
1345 #line 1346 "Parser.cpp" /* yacc.c:1646 */
1349 #line 117 "./Parser.y" /* yacc.c:1646 */
1351 yyerror(wxT("Missing closing parenthesis on search expression"));
1352 delete (yyvsp
[-1].pexpr
);
1355 #line 1356 "Parser.cpp" /* yacc.c:1646 */
1359 #line 123 "./Parser.y" /* yacc.c:1646 */
1361 yyerror(wxT("Missing left operand for AND on search expression"));
1364 #line 1365 "Parser.cpp" /* yacc.c:1646 */
1368 #line 128 "./Parser.y" /* yacc.c:1646 */
1370 yyerror(wxT("Missing left operand for OR on search expression"));
1373 #line 1374 "Parser.cpp" /* yacc.c:1646 */
1377 #line 133 "./Parser.y" /* yacc.c:1646 */
1379 yyerror(wxT("Missing left operand for NOT on search expression (?)"));
1382 #line 1383 "Parser.cpp" /* yacc.c:1646 */
1386 #line 140 "./Parser.y" /* yacc.c:1646 */
1388 (yyval
.pexpr
) = new CSearchExpr(*(yyvsp
[0].pstr
));
1389 delete (yyvsp
[0].pstr
);
1391 #line 1392 "Parser.cpp" /* yacc.c:1646 */
1395 #line 145 "./Parser.y" /* yacc.c:1646 */
1397 /*$1->Concatenate($2);
1399 CSearchExpr
* pexpr
= new CSearchExpr
;
1400 pexpr
->Add(SEARCHOP_AND
);
1401 pexpr
->Add((yyvsp
[-1].pexpr
));
1402 pexpr
->Add(*(yyvsp
[0].pstr
));
1403 (yyval
.pexpr
) = pexpr
;
1404 delete (yyvsp
[-1].pexpr
);
1405 delete (yyvsp
[0].pstr
);
1407 #line 1408 "Parser.cpp" /* yacc.c:1646 */
1411 #line 1412 "Parser.cpp" /* yacc.c:1646 */
1414 /* User semantic actions sometimes alter yychar, and that requires
1415 that yytoken be updated with the new translation. We take the
1416 approach of translating immediately before every use of yytoken.
1417 One alternative is translating here after every semantic action,
1418 but that translation would be missed if the semantic action invokes
1419 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1420 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1421 incorrect destructor might then be invoked immediately. In the
1422 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1423 to an incorrect destructor call or verbose syntax error message
1424 before the lookahead is translated. */
1425 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1429 YY_STACK_PRINT (yyss
, yyssp
);
1433 /* Now 'shift' the result of the reduction. Determine what state
1434 that goes to, based on the state we popped back to and the rule
1435 number reduced by. */
1439 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1440 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1441 yystate
= yytable
[yystate
];
1443 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1448 /*--------------------------------------.
1449 | yyerrlab -- here on detecting error. |
1450 `--------------------------------------*/
1452 /* Make sure we have latest lookahead translation. See comments at
1453 user semantic actions for why this is necessary. */
1454 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
1456 /* If not already recovering from an error, report this error. */
1460 #if ! YYERROR_VERBOSE
1461 yyerror (YY_("syntax error"));
1463 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1466 char const *yymsgp
= YY_("syntax error");
1467 int yysyntax_error_status
;
1468 yysyntax_error_status
= YYSYNTAX_ERROR
;
1469 if (yysyntax_error_status
== 0)
1471 else if (yysyntax_error_status
== 1)
1473 if (yymsg
!= yymsgbuf
)
1474 YYSTACK_FREE (yymsg
);
1475 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
1479 yymsg_alloc
= sizeof yymsgbuf
;
1480 yysyntax_error_status
= 2;
1484 yysyntax_error_status
= YYSYNTAX_ERROR
;
1489 if (yysyntax_error_status
== 2)
1490 goto yyexhaustedlab
;
1492 # undef YYSYNTAX_ERROR
1498 if (yyerrstatus
== 3)
1500 /* If just tried and failed to reuse lookahead token after an
1501 error, discard it. */
1503 if (yychar
<= YYEOF
)
1505 /* Return failure if at end of input. */
1506 if (yychar
== YYEOF
)
1511 yydestruct ("Error: discarding",
1517 /* Else will try to reuse lookahead token after shifting the error
1522 /*---------------------------------------------------.
1523 | yyerrorlab -- error raised explicitly by YYERROR. |
1524 `---------------------------------------------------*/
1527 /* Pacify compilers like GCC when the user code never invokes
1528 YYERROR and the label yyerrorlab therefore never appears in user
1530 if (/*CONSTCOND*/ 0)
1533 /* Do not reclaim the symbols of the rule whose action triggered
1537 YY_STACK_PRINT (yyss
, yyssp
);
1542 /*-------------------------------------------------------------.
1543 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1544 `-------------------------------------------------------------*/
1546 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1550 yyn
= yypact
[yystate
];
1551 if (!yypact_value_is_default (yyn
))
1554 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1562 /* Pop the current state because it cannot handle the error token. */
1567 yydestruct ("Error: popping",
1568 yystos
[yystate
], yyvsp
);
1571 YY_STACK_PRINT (yyss
, yyssp
);
1574 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1576 YY_IGNORE_MAYBE_UNINITIALIZED_END
1579 /* Shift the error token. */
1580 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1586 /*-------------------------------------.
1587 | yyacceptlab -- YYACCEPT comes here. |
1588 `-------------------------------------*/
1593 /*-----------------------------------.
1594 | yyabortlab -- YYABORT comes here. |
1595 `-----------------------------------*/
1600 #if !defined yyoverflow || YYERROR_VERBOSE
1601 /*-------------------------------------------------.
1602 | yyexhaustedlab -- memory exhaustion comes here. |
1603 `-------------------------------------------------*/
1605 yyerror (YY_("memory exhausted"));
1611 if (yychar
!= YYEMPTY
)
1613 /* Make sure we have latest lookahead translation. See comments at
1614 user semantic actions for why this is necessary. */
1615 yytoken
= YYTRANSLATE (yychar
);
1616 yydestruct ("Cleanup: discarding lookahead",
1619 /* Do not reclaim the symbols of the rule whose action triggered
1620 this YYABORT or YYACCEPT. */
1622 YY_STACK_PRINT (yyss
, yyssp
);
1623 while (yyssp
!= yyss
)
1625 yydestruct ("Cleanup: popping",
1626 yystos
[*yyssp
], yyvsp
);
1631 YYSTACK_FREE (yyss
);
1634 if (yymsg
!= yymsgbuf
)
1635 YYSTACK_FREE (yymsg
);
1639 #line 158 "./Parser.y" /* yacc.c:1906 */
1642 int yyerror(const char* errstr
)
1644 // Errors created by yacc generated code
1645 //yyerror ("syntax error: cannot back up");
1646 //yyerror ("syntax error; also virtual memory exhausted");
1647 //yyerror ("syntax error");
1648 //yyerror ("parser stack overflow");
1650 _astrParserErrors
.Add(char2unicode(errstr
));
1651 return EXIT_FAILURE
;
1654 int yyerror(wxString errstr
)
1656 _astrParserErrors
.Add(errstr
);
1657 return EXIT_FAILURE
;