• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* A Bison parser, made by GNU Bison 3.6.4.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38    especially those whose name start with YY_ or yy_.  They are
39    private implementation details that can be changed or removed.  */
40 
41 /* All symbols defined below should begin with yy or YY, to avoid
42    infringing on user name space.  This should be done even for local
43    variables, as they might otherwise be expanded by user macros.
44    There are some unavoidable exceptions within include files to
45    define necessary library symbols; they are noted "INFRINGES ON
46    USER NAME SPACE" below.  */
47 
48 /* Identify Bison output.  */
49 #define YYBISON 1
50 
51 /* Bison version.  */
52 #define YYBISON_VERSION "3.6.4"
53 
54 /* Skeleton name.  */
55 #define YYSKELETON_NAME "yacc.c"
56 
57 /* Pure parsers.  */
58 #define YYPURE 1
59 
60 /* Push parsers.  */
61 #define YYPUSH 0
62 
63 /* Pull parsers.  */
64 #define YYPULL 1
65 
66 /* Substitute the type names.  */
67 #define YYSTYPE         TRACEFS_STYPE
68 /* Substitute the variable and function names.  */
69 #define yyparse         tracefs_parse
70 #define yylex           tracefs_lex
71 #define yyerror         tracefs_error
72 #define yydebug         tracefs_debug
73 #define yynerrs         tracefs_nerrs
74 
75 /* First part of user prologue.  */
76 #line 1 "sqlhist.y"
77 
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include <string.h>
81 #include <errno.h>
82 
83 #include "sqlhist-parse.h"
84 
85 #define scanner sb->scanner
86 
87 extern int yylex(YYSTYPE *yylval, void *);
88 extern void yyerror(struct sqlhist_bison *, char *fmt, ...);
89 
90 #define CHECK_RETURN_PTR(x)					\
91 	do {							\
92 		if (!(x)) {					\
93 			printf("FAILED MEMORY: %s\n", #x);	\
94 			return -ENOMEM;				\
95 		}						\
96 	} while (0)
97 
98 #define CHECK_RETURN_VAL(x)					\
99 	do {							\
100 		if ((x) < 0) {					\
101 			printf("FAILED MEMORY: %s\n", #x);	\
102 			return -ENOMEM;				\
103 		}						\
104 	} while (0)
105 
106 
107 #line 108 "sqlhist.tab.c"
108 
109 # ifndef YY_CAST
110 #  ifdef __cplusplus
111 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
112 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
113 #  else
114 #   define YY_CAST(Type, Val) ((Type) (Val))
115 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
116 #  endif
117 # endif
118 # ifndef YY_NULLPTR
119 #  if defined __cplusplus
120 #   if 201103L <= __cplusplus
121 #    define YY_NULLPTR nullptr
122 #   else
123 #    define YY_NULLPTR 0
124 #   endif
125 #  else
126 #   define YY_NULLPTR ((void*)0)
127 #  endif
128 # endif
129 
130 /* Use api.header.include to #include this header
131    instead of duplicating it here.  */
132 #ifndef YY_TRACEFS_SQLHIST_TAB_H_INCLUDED
133 # define YY_TRACEFS_SQLHIST_TAB_H_INCLUDED
134 /* Debug traces.  */
135 #ifndef TRACEFS_DEBUG
136 # if defined YYDEBUG
137 #if YYDEBUG
138 #   define TRACEFS_DEBUG 1
139 #  else
140 #   define TRACEFS_DEBUG 0
141 #  endif
142 # else /* ! defined YYDEBUG */
143 #  define TRACEFS_DEBUG 1
144 # endif /* ! defined YYDEBUG */
145 #endif  /* ! defined TRACEFS_DEBUG */
146 #if TRACEFS_DEBUG
147 extern int tracefs_debug;
148 #endif
149 
150 /* Token kinds.  */
151 #ifndef TRACEFS_TOKENTYPE
152 # define TRACEFS_TOKENTYPE
153   enum tracefs_tokentype
154   {
155     TRACEFS_EMPTY = -2,
156     TRACEFS_EOF = 0,               /* "end of file"  */
157     TRACEFS_error = 256,           /* error  */
158     TRACEFS_UNDEF = 257,           /* "invalid token"  */
159     AS = 258,                      /* AS  */
160     SELECT = 259,                  /* SELECT  */
161     FROM = 260,                    /* FROM  */
162     JOIN = 261,                    /* JOIN  */
163     ON = 262,                      /* ON  */
164     WHERE = 263,                   /* WHERE  */
165     PARSE_ERROR = 264,             /* PARSE_ERROR  */
166     CAST = 265,                    /* CAST  */
167     NUMBER = 266,                  /* NUMBER  */
168     field_type = 267,              /* field_type  */
169     STRING = 268,                  /* STRING  */
170     FIELD = 269,                   /* FIELD  */
171     LE = 270,                      /* LE  */
172     GE = 271,                      /* GE  */
173     EQ = 272,                      /* EQ  */
174     NEQ = 273,                     /* NEQ  */
175     AND = 274,                     /* AND  */
176     OR = 275                       /* OR  */
177   };
178   typedef enum tracefs_tokentype tracefs_token_kind_t;
179 #endif
180 
181 /* Value type.  */
182 #if ! defined TRACEFS_STYPE && ! defined TRACEFS_STYPE_IS_DECLARED
183 union TRACEFS_STYPE
184 {
185 #line 46 "sqlhist.y"
186 
187 	int	s32;
188 	char	*string;
189 	long	number;
190 	void	*expr;
191 
192 #line 193 "sqlhist.tab.c"
193 
194 };
195 typedef union TRACEFS_STYPE TRACEFS_STYPE;
196 # define TRACEFS_STYPE_IS_TRIVIAL 1
197 # define TRACEFS_STYPE_IS_DECLARED 1
198 #endif
199 
200 
201 
202 int tracefs_parse (struct sqlhist_bison *sb);
203 /* "%code provides" blocks.  */
204 #line 37 "sqlhist.y"
205 
206   #define YYSTYPE TRACEFS_STYPE
207   #define yylex tracefs_lex
208   #define yyerror tracefs_error
209 
210 #line 211 "sqlhist.tab.c"
211 
212 #endif /* !YY_TRACEFS_SQLHIST_TAB_H_INCLUDED  */
213 /* Symbol kind.  */
214 enum yysymbol_kind_t
215 {
216   YYSYMBOL_YYEMPTY = -2,
217   YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
218   YYSYMBOL_YYerror = 1,                    /* error  */
219   YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
220   YYSYMBOL_AS = 3,                         /* AS  */
221   YYSYMBOL_SELECT = 4,                     /* SELECT  */
222   YYSYMBOL_FROM = 5,                       /* FROM  */
223   YYSYMBOL_JOIN = 6,                       /* JOIN  */
224   YYSYMBOL_ON = 7,                         /* ON  */
225   YYSYMBOL_WHERE = 8,                      /* WHERE  */
226   YYSYMBOL_PARSE_ERROR = 9,                /* PARSE_ERROR  */
227   YYSYMBOL_CAST = 10,                      /* CAST  */
228   YYSYMBOL_NUMBER = 11,                    /* NUMBER  */
229   YYSYMBOL_field_type = 12,                /* field_type  */
230   YYSYMBOL_STRING = 13,                    /* STRING  */
231   YYSYMBOL_FIELD = 14,                     /* FIELD  */
232   YYSYMBOL_LE = 15,                        /* LE  */
233   YYSYMBOL_GE = 16,                        /* GE  */
234   YYSYMBOL_EQ = 17,                        /* EQ  */
235   YYSYMBOL_NEQ = 18,                       /* NEQ  */
236   YYSYMBOL_AND = 19,                       /* AND  */
237   YYSYMBOL_OR = 20,                        /* OR  */
238   YYSYMBOL_21_ = 21,                       /* '+'  */
239   YYSYMBOL_22_ = 22,                       /* '-'  */
240   YYSYMBOL_23_ = 23,                       /* '*'  */
241   YYSYMBOL_24_ = 24,                       /* '/'  */
242   YYSYMBOL_25_ = 25,                       /* '<'  */
243   YYSYMBOL_26_ = 26,                       /* '>'  */
244   YYSYMBOL_27_ = 27,                       /* ','  */
245   YYSYMBOL_28_ = 28,                       /* '('  */
246   YYSYMBOL_29_ = 29,                       /* ')'  */
247   YYSYMBOL_30_ = 30,                       /* '='  */
248   YYSYMBOL_31_ = 31,                       /* "!="  */
249   YYSYMBOL_32_ = 32,                       /* '&'  */
250   YYSYMBOL_33_ = 33,                       /* '~'  */
251   YYSYMBOL_34_ = 34,                       /* '!'  */
252   YYSYMBOL_YYACCEPT = 35,                  /* $accept  */
253   YYSYMBOL_start = 36,                     /* start  */
254   YYSYMBOL_label = 37,                     /* label  */
255   YYSYMBOL_select = 38,                    /* select  */
256   YYSYMBOL_select_statement = 39,          /* select_statement  */
257   YYSYMBOL_selection_list = 40,            /* selection_list  */
258   YYSYMBOL_selection = 41,                 /* selection  */
259   YYSYMBOL_selection_expr = 42,            /* selection_expr  */
260   YYSYMBOL_selection_addition = 43,        /* selection_addition  */
261   YYSYMBOL_item = 44,                      /* item  */
262   YYSYMBOL_field = 45,                     /* field  */
263   YYSYMBOL_named_field = 46,               /* named_field  */
264   YYSYMBOL_name = 47,                      /* name  */
265   YYSYMBOL_str_val = 48,                   /* str_val  */
266   YYSYMBOL_val = 49,                       /* val  */
267   YYSYMBOL_compare = 50,                   /* compare  */
268   YYSYMBOL_compare_and_or = 51,            /* compare_and_or  */
269   YYSYMBOL_compare_items = 52,             /* compare_items  */
270   YYSYMBOL_compare_cmds = 53,              /* compare_cmds  */
271   YYSYMBOL_compare_list = 54,              /* compare_list  */
272   YYSYMBOL_where_clause = 55,              /* where_clause  */
273   YYSYMBOL_opt_where_clause = 56,          /* opt_where_clause  */
274   YYSYMBOL_opt_join_clause = 57,           /* opt_join_clause  */
275   YYSYMBOL_table_exp = 58,                 /* table_exp  */
276   YYSYMBOL_from_clause = 59,               /* from_clause  */
277   YYSYMBOL_join_clause = 60,               /* join_clause  */
278   YYSYMBOL_match = 61,                     /* match  */
279   YYSYMBOL_match_clause = 62               /* match_clause  */
280 };
281 typedef enum yysymbol_kind_t yysymbol_kind_t;
282 
283 
284 
285 
286 #ifdef short
287 # undef short
288 #endif
289 
290 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
291    <limits.h> and (if available) <stdint.h> are included
292    so that the code can choose integer types of a good width.  */
293 
294 #ifndef __PTRDIFF_MAX__
295 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
296 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
297 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
298 #  define YY_STDINT_H
299 # endif
300 #endif
301 
302 /* Narrow types that promote to a signed type and that can represent a
303    signed or unsigned integer of at least N bits.  In tables they can
304    save space and decrease cache pressure.  Promoting to a signed type
305    helps avoid bugs in integer arithmetic.  */
306 
307 #ifdef __INT_LEAST8_MAX__
308 typedef __INT_LEAST8_TYPE__ yytype_int8;
309 #elif defined YY_STDINT_H
310 typedef int_least8_t yytype_int8;
311 #else
312 typedef signed char yytype_int8;
313 #endif
314 
315 #ifdef __INT_LEAST16_MAX__
316 typedef __INT_LEAST16_TYPE__ yytype_int16;
317 #elif defined YY_STDINT_H
318 typedef int_least16_t yytype_int16;
319 #else
320 typedef short yytype_int16;
321 #endif
322 
323 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
324 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
325 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
326        && UINT_LEAST8_MAX <= INT_MAX)
327 typedef uint_least8_t yytype_uint8;
328 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
329 typedef unsigned char yytype_uint8;
330 #else
331 typedef short yytype_uint8;
332 #endif
333 
334 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
335 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
336 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
337        && UINT_LEAST16_MAX <= INT_MAX)
338 typedef uint_least16_t yytype_uint16;
339 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
340 typedef unsigned short yytype_uint16;
341 #else
342 typedef int yytype_uint16;
343 #endif
344 
345 #ifndef YYPTRDIFF_T
346 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
347 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
348 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
349 # elif defined PTRDIFF_MAX
350 #  ifndef ptrdiff_t
351 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
352 #  endif
353 #  define YYPTRDIFF_T ptrdiff_t
354 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
355 # else
356 #  define YYPTRDIFF_T long
357 #  define YYPTRDIFF_MAXIMUM LONG_MAX
358 # endif
359 #endif
360 
361 #ifndef YYSIZE_T
362 # ifdef __SIZE_TYPE__
363 #  define YYSIZE_T __SIZE_TYPE__
364 # elif defined size_t
365 #  define YYSIZE_T size_t
366 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
367 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
368 #  define YYSIZE_T size_t
369 # else
370 #  define YYSIZE_T unsigned
371 # endif
372 #endif
373 
374 #define YYSIZE_MAXIMUM                                  \
375   YY_CAST (YYPTRDIFF_T,                                 \
376            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
377             ? YYPTRDIFF_MAXIMUM                         \
378             : YY_CAST (YYSIZE_T, -1)))
379 
380 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
381 
382 
383 /* Stored state numbers (used for stacks). */
384 typedef yytype_int8 yy_state_t;
385 
386 /* State numbers in computations.  */
387 typedef int yy_state_fast_t;
388 
389 #ifndef YY_
390 # if defined YYENABLE_NLS && YYENABLE_NLS
391 #  if ENABLE_NLS
392 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
393 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
394 #  endif
395 # endif
396 # ifndef YY_
397 #  define YY_(Msgid) Msgid
398 # endif
399 #endif
400 
401 
402 #ifndef YY_ATTRIBUTE_PURE
403 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
404 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
405 # else
406 #  define YY_ATTRIBUTE_PURE
407 # endif
408 #endif
409 
410 #ifndef YY_ATTRIBUTE_UNUSED
411 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
412 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
413 # else
414 #  define YY_ATTRIBUTE_UNUSED
415 # endif
416 #endif
417 
418 /* Suppress unused-variable warnings by "using" E.  */
419 #if ! defined lint || defined __GNUC__
420 # define YYUSE(E) ((void) (E))
421 #else
422 # define YYUSE(E) /* empty */
423 #endif
424 
425 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
426 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
427 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
428     _Pragma ("GCC diagnostic push")                                     \
429     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
430     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
431 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
432     _Pragma ("GCC diagnostic pop")
433 #else
434 # define YY_INITIAL_VALUE(Value) Value
435 #endif
436 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
437 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
438 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
439 #endif
440 #ifndef YY_INITIAL_VALUE
441 # define YY_INITIAL_VALUE(Value) /* Nothing. */
442 #endif
443 
444 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
445 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
446     _Pragma ("GCC diagnostic push")                            \
447     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
448 # define YY_IGNORE_USELESS_CAST_END            \
449     _Pragma ("GCC diagnostic pop")
450 #endif
451 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
452 # define YY_IGNORE_USELESS_CAST_BEGIN
453 # define YY_IGNORE_USELESS_CAST_END
454 #endif
455 
456 
457 #define YY_ASSERT(E) ((void) (0 && (E)))
458 
459 #if !defined yyoverflow
460 
461 /* The parser invokes alloca or malloc; define the necessary symbols.  */
462 
463 # ifdef YYSTACK_USE_ALLOCA
464 #  if YYSTACK_USE_ALLOCA
465 #   ifdef __GNUC__
466 #    define YYSTACK_ALLOC __builtin_alloca
467 #   elif defined __BUILTIN_VA_ARG_INCR
468 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
469 #   elif defined _AIX
470 #    define YYSTACK_ALLOC __alloca
471 #   elif defined _MSC_VER
472 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
473 #    define alloca _alloca
474 #   else
475 #    define YYSTACK_ALLOC alloca
476 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
477 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
478       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
479 #     ifndef EXIT_SUCCESS
480 #      define EXIT_SUCCESS 0
481 #     endif
482 #    endif
483 #   endif
484 #  endif
485 # endif
486 
487 # ifdef YYSTACK_ALLOC
488    /* Pacify GCC's 'empty if-body' warning.  */
489 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
490 #  ifndef YYSTACK_ALLOC_MAXIMUM
491     /* The OS might guarantee only one guard page at the bottom of the stack,
492        and a page size can be as small as 4096 bytes.  So we cannot safely
493        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
494        to allow for a few compiler-allocated temporary stack slots.  */
495 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
496 #  endif
497 # else
498 #  define YYSTACK_ALLOC YYMALLOC
499 #  define YYSTACK_FREE YYFREE
500 #  ifndef YYSTACK_ALLOC_MAXIMUM
501 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
502 #  endif
503 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
504        && ! ((defined YYMALLOC || defined malloc) \
505              && (defined YYFREE || defined free)))
506 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
507 #   ifndef EXIT_SUCCESS
508 #    define EXIT_SUCCESS 0
509 #   endif
510 #  endif
511 #  ifndef YYMALLOC
512 #   define YYMALLOC malloc
513 #   if ! defined malloc && ! defined EXIT_SUCCESS
514 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
515 #   endif
516 #  endif
517 #  ifndef YYFREE
518 #   define YYFREE free
519 #   if ! defined free && ! defined EXIT_SUCCESS
520 void free (void *); /* INFRINGES ON USER NAME SPACE */
521 #   endif
522 #  endif
523 # endif
524 #endif /* !defined yyoverflow */
525 
526 #if (! defined yyoverflow \
527      && (! defined __cplusplus \
528          || (defined TRACEFS_STYPE_IS_TRIVIAL && TRACEFS_STYPE_IS_TRIVIAL)))
529 
530 /* A type that is properly aligned for any stack member.  */
531 union yyalloc
532 {
533   yy_state_t yyss_alloc;
534   YYSTYPE yyvs_alloc;
535 };
536 
537 /* The size of the maximum gap between one aligned stack and the next.  */
538 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
539 
540 /* The size of an array large to enough to hold all stacks, each with
541    N elements.  */
542 # define YYSTACK_BYTES(N) \
543      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
544       + YYSTACK_GAP_MAXIMUM)
545 
546 # define YYCOPY_NEEDED 1
547 
548 /* Relocate STACK from its old location to the new one.  The
549    local variables YYSIZE and YYSTACKSIZE give the old and new number of
550    elements in the stack, and YYPTR gives the new location of the
551    stack.  Advance YYPTR to a properly aligned location for the next
552    stack.  */
553 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
554     do                                                                  \
555       {                                                                 \
556         YYPTRDIFF_T yynewbytes;                                         \
557         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
558         Stack = &yyptr->Stack_alloc;                                    \
559         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
560         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
561       }                                                                 \
562     while (0)
563 
564 #endif
565 
566 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
567 /* Copy COUNT objects from SRC to DST.  The source and destination do
568    not overlap.  */
569 # ifndef YYCOPY
570 #  if defined __GNUC__ && 1 < __GNUC__
571 #   define YYCOPY(Dst, Src, Count) \
572       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
573 #  else
574 #   define YYCOPY(Dst, Src, Count)              \
575       do                                        \
576         {                                       \
577           YYPTRDIFF_T yyi;                      \
578           for (yyi = 0; yyi < (Count); yyi++)   \
579             (Dst)[yyi] = (Src)[yyi];            \
580         }                                       \
581       while (0)
582 #  endif
583 # endif
584 #endif /* !YYCOPY_NEEDED */
585 
586 /* YYFINAL -- State number of the termination state.  */
587 #define YYFINAL  5
588 /* YYLAST -- Last index in YYTABLE.  */
589 #define YYLAST   104
590 
591 /* YYNTOKENS -- Number of terminals.  */
592 #define YYNTOKENS  35
593 /* YYNNTS -- Number of nonterminals.  */
594 #define YYNNTS  28
595 /* YYNRULES -- Number of rules.  */
596 #define YYNRULES  61
597 /* YYNSTATES -- Number of states.  */
598 #define YYNSTATES  111
599 
600 #define YYMAXUTOK   276
601 
602 
603 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
604    as returned by yylex, with out-of-bounds checking.  */
605 #define YYTRANSLATE(YYX)                                \
606   (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
607    ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
608    : YYSYMBOL_YYUNDEF)
609 
610 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
611    as returned by yylex.  */
612 static const yytype_int8 yytranslate[] =
613 {
614        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
615        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
616        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
617        2,     2,     2,    34,     2,     2,     2,     2,    32,     2,
618       28,    29,    23,    21,    27,    22,     2,    24,     2,     2,
619        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
620       25,    30,    26,     2,     2,     2,     2,     2,     2,     2,
621        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
622        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
623        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
624        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
625        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
626        2,     2,     2,     2,     2,     2,    33,     2,     2,     2,
627        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
628        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
629        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
630        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
631        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
632        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
633        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
634        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
635        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
636        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
637        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
638        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
639        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
640        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
641       15,    16,    17,    18,    19,    20,    31
642 };
643 
644 #if TRACEFS_DEBUG
645   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
646 static const yytype_uint8 yyrline[] =
647 {
648        0,    75,    75,    78,    79,    82,    86,    90,    91,    95,
649       99,   106,   107,   108,   109,   110,   117,   122,   130,   131,
650      135,   139,   143,   147,   151,   152,   157,   158,   159,   160,
651      161,   162,   163,   164,   165,   166,   170,   171,   172,   173,
652      174,   178,   179,   180,   181,   182,   186,   195,   196,   197,
653      201,   204,   206,   209,   211,   215,   219,   234,   238,   239,
654      244,   245
655 };
656 #endif
657 
658 /** Accessing symbol of state STATE.  */
659 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
660 
661 #if TRACEFS_DEBUG || 0
662 /* The user-facing name of the symbol whose (internal) number is
663    YYSYMBOL.  No bounds checking.  */
664 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
665 
666 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
667    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
668 static const char *const yytname[] =
669 {
670   "\"end of file\"", "error", "\"invalid token\"", "AS", "SELECT", "FROM",
671   "JOIN", "ON", "WHERE", "PARSE_ERROR", "CAST", "NUMBER", "field_type",
672   "STRING", "FIELD", "LE", "GE", "EQ", "NEQ", "AND", "OR", "'+'", "'-'",
673   "'*'", "'/'", "'<'", "'>'", "','", "'('", "')'", "'='", "\"!=\"", "'&'",
674   "'~'", "'!'", "$accept", "start", "label", "select", "select_statement",
675   "selection_list", "selection", "selection_expr", "selection_addition",
676   "item", "field", "named_field", "name", "str_val", "val", "compare",
677   "compare_and_or", "compare_items", "compare_cmds", "compare_list",
678   "where_clause", "opt_where_clause", "opt_join_clause", "table_exp",
679   "from_clause", "join_clause", "match", "match_clause", YY_NULLPTR
680 };
681 
682 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)683 yysymbol_name (yysymbol_kind_t yysymbol)
684 {
685   return yytname[yysymbol];
686 }
687 #endif
688 
689 #ifdef YYPRINT
690 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
691    (internal) symbol number NUM (which must be that of a token).  */
692 static const yytype_int16 yytoknum[] =
693 {
694        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
695      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
696      275,    43,    45,    42,    47,    60,    62,    44,    40,    41,
697       61,   276,    38,   126,    33
698 };
699 #endif
700 
701 #define YYPACT_NINF (-58)
702 
703 #define yypact_value_is_default(Yyn) \
704   ((Yyn) == YYPACT_NINF)
705 
706 #define YYTABLE_NINF (-1)
707 
708 #define yytable_value_is_error(Yyn) \
709   0
710 
711   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
712      STATE-NUM.  */
713 static const yytype_int8 yypact[] =
714 {
715        4,   -58,    13,    11,   -58,   -58,     5,   -58,    43,    53,
716       45,    29,   -58,    19,    43,    44,    32,    60,   -58,    73,
717       11,    75,   -58,   -58,   -58,    43,    43,    87,   -58,   -58,
718       29,   -58,   -58,   -58,    60,    83,   -58,   -58,   -58,   -58,
719      -58,    78,   -58,    86,    14,   -58,   -58,    65,    60,    -4,
720      -12,    34,   -58,    76,   -15,   -58,   -58,   -10,    68,   -58,
721        1,   -58,    18,    -4,   -58,    33,    33,    33,    33,    33,
722       33,    33,    33,    33,    84,    14,    14,    14,    60,    60,
723       60,    -4,   -58,    -4,    -4,   -58,    49,   -58,   -58,   -58,
724      -58,   -58,   -58,   -58,   -58,   -58,   -58,   -58,   -58,   -58,
725      -58,   -58,   -58,   -58,   -58,   -58,    51,   -58,   -58,   -58,
726      -58
727 };
728 
729   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
730      Performed when YYTABLE does not specify something else to do.  Zero
731      means the default is an error.  */
732 static const yytype_int8 yydefact[] =
733 {
734        0,     5,     0,     0,     2,     1,     0,    20,     0,     0,
735        7,     9,    13,    11,     0,     0,     0,     0,     6,    53,
736        0,     0,    22,    10,     4,     0,     0,     0,    14,    12,
737       20,    56,    19,    18,     0,    51,    54,     8,     3,    16,
738       17,     0,    21,     0,     0,    52,    55,     0,     0,     0,
739        0,     0,    45,    46,    47,    50,    15,     0,    60,    57,
740        0,    40,     0,     0,    44,     0,     0,     0,     0,     0,
741        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
742        0,     0,    39,     0,     0,    42,     0,    25,    23,    24,
743       28,    29,    31,    32,    26,    27,    30,    33,    34,    35,
744       41,    49,    48,    59,    58,    61,     0,    37,    36,    43,
745       38
746 };
747 
748   /* YYPGOTO[NTERM-NUM].  */
749 static const yytype_int8 yypgoto[] =
750 {
751      -58,   -58,    69,   -58,   -58,    80,   -58,   -58,    90,   -16,
752       -3,   -58,    81,    27,    15,   -41,   -57,    28,   -58,   -21,
753      -58,   -58,   -58,   -58,   -58,   -58,   -58,    24
754 };
755 
756   /* YYDEFGOTO[NTERM-NUM].  */
757 static const yytype_int8 yydefgoto[] =
758 {
759       -1,     2,    23,     3,     4,     9,    10,    11,    12,    57,
760       51,    33,    24,    89,    90,    61,    62,    53,    54,    55,
761       45,    46,    35,    18,    19,    36,    58,    59
762 };
763 
764   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
765      positive, shift that token.  If negative, reduce the rule whose
766      number is the opposite.  If YYTABLE_NINF, syntax error.  */
767 static const yytype_int8 yytable[] =
768 {
769       13,    31,     7,    52,    76,    16,    86,    78,     1,    64,
770        7,    27,    77,     5,    32,     7,    63,    13,    43,    82,
771       79,     6,    39,    40,   106,     7,   107,   108,     7,    81,
772       60,    32,    21,    14,    52,    52,    52,    83,    84,     8,
773       25,    26,    49,    22,    87,    32,    88,    85,    50,    65,
774       66,    67,    68,    25,    26,   101,   102,     7,    17,    69,
775       70,    29,   103,   104,    71,    72,    73,    74,    83,    84,
776       83,    84,    20,    28,    30,    32,    32,    32,   109,    34,
777      110,    91,    92,    93,    94,    95,    96,    97,    98,    22,
778       41,    44,    47,    48,    56,    80,    75,    88,    15,    42,
779       37,    99,    38,   100,   105
780 };
781 
782 static const yytype_int8 yycheck[] =
783 {
784        3,    17,    14,    44,    19,     8,    63,    17,     4,    50,
785       14,    14,    27,     0,    17,    14,    28,    20,    34,    60,
786       30,    10,    25,    26,    81,    14,    83,    84,    14,    28,
787       34,    34,     3,    28,    75,    76,    77,    19,    20,    28,
788       21,    22,    28,    14,    11,    48,    13,    29,    34,    15,
789       16,    17,    18,    21,    22,    76,    77,    14,     5,    25,
790       26,    29,    78,    79,    30,    31,    32,    33,    19,    20,
791       19,    20,    27,    29,    14,    78,    79,    80,    29,     6,
792       29,    66,    67,    68,    69,    70,    71,    72,    73,    14,
793        3,     8,    14,     7,    29,    27,    20,    13,     8,    30,
794       20,    74,    21,    75,    80
795 };
796 
797   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
798      symbol of state STATE-NUM.  */
799 static const yytype_int8 yystos[] =
800 {
801        0,     4,    36,    38,    39,     0,    10,    14,    28,    40,
802       41,    42,    43,    45,    28,    43,    45,     5,    58,    59,
803       27,     3,    14,    37,    47,    21,    22,    45,    29,    29,
804       14,    44,    45,    46,     6,    57,    60,    40,    47,    45,
805       45,     3,    37,    44,     8,    55,    56,    14,     7,    28,
806       34,    45,    50,    52,    53,    54,    29,    44,    61,    62,
807       34,    50,    51,    28,    50,    15,    16,    17,    18,    25,
808       26,    30,    31,    32,    33,    20,    19,    27,    17,    30,
809       27,    28,    50,    19,    20,    29,    51,    11,    13,    48,
810       49,    49,    49,    49,    49,    49,    49,    49,    49,    48,
811       52,    54,    54,    44,    44,    62,    51,    51,    51,    29,
812       29
813 };
814 
815   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
816 static const yytype_int8 yyr1[] =
817 {
818        0,    35,    36,    37,    37,    38,    39,    40,    40,    41,
819       41,    42,    42,    42,    42,    42,    43,    43,    44,    44,
820       45,    46,    47,    48,    49,    49,    50,    50,    50,    50,
821       50,    50,    50,    50,    50,    50,    51,    51,    51,    51,
822       51,    52,    52,    52,    52,    52,    53,    54,    54,    54,
823       55,    56,    56,    57,    57,    58,    59,    60,    61,    61,
824       62,    62
825 };
826 
827   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
828 static const yytype_int8 yyr2[] =
829 {
830        0,     2,     1,     2,     1,     1,     3,     1,     3,     1,
831        2,     1,     3,     1,     3,     6,     3,     3,     1,     1,
832        1,     2,     1,     1,     1,     1,     3,     3,     3,     3,
833        3,     3,     3,     3,     3,     3,     3,     3,     4,     2,
834        1,     3,     3,     4,     2,     1,     1,     1,     3,     3,
835        2,     0,     1,     0,     1,     3,     2,     4,     3,     3,
836        1,     3
837 };
838 
839 
840 enum { YYENOMEM = -2 };
841 
842 #define yyerrok         (yyerrstatus = 0)
843 #define yyclearin       (yychar = TRACEFS_EMPTY)
844 
845 #define YYACCEPT        goto yyacceptlab
846 #define YYABORT         goto yyabortlab
847 #define YYERROR         goto yyerrorlab
848 
849 
850 #define YYRECOVERING()  (!!yyerrstatus)
851 
852 #define YYBACKUP(Token, Value)                                    \
853   do                                                              \
854     if (yychar == TRACEFS_EMPTY)                                        \
855       {                                                           \
856         yychar = (Token);                                         \
857         yylval = (Value);                                         \
858         YYPOPSTACK (yylen);                                       \
859         yystate = *yyssp;                                         \
860         goto yybackup;                                            \
861       }                                                           \
862     else                                                          \
863       {                                                           \
864         yyerror (sb, YY_("syntax error: cannot back up")); \
865         YYERROR;                                                  \
866       }                                                           \
867   while (0)
868 
869 /* Backward compatibility with an undocumented macro.
870    Use TRACEFS_error or TRACEFS_UNDEF. */
871 #define YYERRCODE TRACEFS_UNDEF
872 
873 
874 /* Enable debugging if requested.  */
875 #if TRACEFS_DEBUG
876 
877 # ifndef YYFPRINTF
878 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
879 #  define YYFPRINTF fprintf
880 # endif
881 
882 # define YYDPRINTF(Args)                        \
883 do {                                            \
884   if (yydebug)                                  \
885     YYFPRINTF Args;                             \
886 } while (0)
887 
888 /* This macro is provided for backward compatibility. */
889 # ifndef YY_LOCATION_PRINT
890 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
891 # endif
892 
893 
894 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
895 do {                                                                      \
896   if (yydebug)                                                            \
897     {                                                                     \
898       YYFPRINTF (stderr, "%s ", Title);                                   \
899       yy_symbol_print (stderr,                                            \
900                   Kind, Value, sb); \
901       YYFPRINTF (stderr, "\n");                                           \
902     }                                                                     \
903 } while (0)
904 
905 
906 /*-----------------------------------.
907 | Print this symbol's value on YYO.  |
908 `-----------------------------------*/
909 
910 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,struct sqlhist_bison * sb)911 yy_symbol_value_print (FILE *yyo,
912                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct sqlhist_bison *sb)
913 {
914   FILE *yyoutput = yyo;
915   YYUSE (yyoutput);
916   YYUSE (sb);
917   if (!yyvaluep)
918     return;
919 # ifdef YYPRINT
920   if (yykind < YYNTOKENS)
921     YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
922 # endif
923   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
924   YYUSE (yykind);
925   YY_IGNORE_MAYBE_UNINITIALIZED_END
926 }
927 
928 
929 /*---------------------------.
930 | Print this symbol on YYO.  |
931 `---------------------------*/
932 
933 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,struct sqlhist_bison * sb)934 yy_symbol_print (FILE *yyo,
935                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct sqlhist_bison *sb)
936 {
937   YYFPRINTF (yyo, "%s %s (",
938              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
939 
940   yy_symbol_value_print (yyo, yykind, yyvaluep, sb);
941   YYFPRINTF (yyo, ")");
942 }
943 
944 /*------------------------------------------------------------------.
945 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
946 | TOP (included).                                                   |
947 `------------------------------------------------------------------*/
948 
949 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)950 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
951 {
952   YYFPRINTF (stderr, "Stack now");
953   for (; yybottom <= yytop; yybottom++)
954     {
955       int yybot = *yybottom;
956       YYFPRINTF (stderr, " %d", yybot);
957     }
958   YYFPRINTF (stderr, "\n");
959 }
960 
961 # define YY_STACK_PRINT(Bottom, Top)                            \
962 do {                                                            \
963   if (yydebug)                                                  \
964     yy_stack_print ((Bottom), (Top));                           \
965 } while (0)
966 
967 
968 /*------------------------------------------------.
969 | Report that the YYRULE is going to be reduced.  |
970 `------------------------------------------------*/
971 
972 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule,struct sqlhist_bison * sb)973 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
974                  int yyrule, struct sqlhist_bison *sb)
975 {
976   int yylno = yyrline[yyrule];
977   int yynrhs = yyr2[yyrule];
978   int yyi;
979   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
980              yyrule - 1, yylno);
981   /* The symbols being reduced.  */
982   for (yyi = 0; yyi < yynrhs; yyi++)
983     {
984       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
985       yy_symbol_print (stderr,
986                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
987                        &yyvsp[(yyi + 1) - (yynrhs)], sb);
988       YYFPRINTF (stderr, "\n");
989     }
990 }
991 
992 # define YY_REDUCE_PRINT(Rule)          \
993 do {                                    \
994   if (yydebug)                          \
995     yy_reduce_print (yyssp, yyvsp, Rule, sb); \
996 } while (0)
997 
998 /* Nonzero means print parse trace.  It is left uninitialized so that
999    multiple parsers can coexist.  */
1000 int yydebug;
1001 #else /* !TRACEFS_DEBUG */
1002 # define YYDPRINTF(Args) ((void) 0)
1003 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1004 # define YY_STACK_PRINT(Bottom, Top)
1005 # define YY_REDUCE_PRINT(Rule)
1006 #endif /* !TRACEFS_DEBUG */
1007 
1008 
1009 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1010 #ifndef YYINITDEPTH
1011 # define YYINITDEPTH 200
1012 #endif
1013 
1014 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1015    if the built-in stack extension method is used).
1016 
1017    Do not make this value too large; the results are undefined if
1018    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1019    evaluated with infinite-precision integer arithmetic.  */
1020 
1021 #ifndef YYMAXDEPTH
1022 # define YYMAXDEPTH 10000
1023 #endif
1024 
1025 
1026 
1027 
1028 
1029 
1030 /*-----------------------------------------------.
1031 | Release the memory associated to this symbol.  |
1032 `-----------------------------------------------*/
1033 
1034 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep,struct sqlhist_bison * sb)1035 yydestruct (const char *yymsg,
1036             yysymbol_kind_t yykind, YYSTYPE *yyvaluep, struct sqlhist_bison *sb)
1037 {
1038   YYUSE (yyvaluep);
1039   YYUSE (sb);
1040   if (!yymsg)
1041     yymsg = "Deleting";
1042   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1043 
1044   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1045   YYUSE (yykind);
1046   YY_IGNORE_MAYBE_UNINITIALIZED_END
1047 }
1048 
1049 
1050 
1051 
1052 
1053 
1054 /*----------.
1055 | yyparse.  |
1056 `----------*/
1057 
1058 int
yyparse(struct sqlhist_bison * sb)1059 yyparse (struct sqlhist_bison *sb)
1060 {
1061 /* The lookahead symbol.  */
1062 int yychar;
1063 
1064 
1065 /* The semantic value of the lookahead symbol.  */
1066 /* Default value used for initialization, for pacifying older GCCs
1067    or non-GCC compilers.  */
1068 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1069 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1070 
1071     /* Number of syntax errors so far.  */
1072     int yynerrs;
1073 
1074     yy_state_fast_t yystate;
1075     /* Number of tokens to shift before error messages enabled.  */
1076     int yyerrstatus;
1077 
1078     /* The stacks and their tools:
1079        'yyss': related to states.
1080        'yyvs': related to semantic values.
1081 
1082        Refer to the stacks through separate pointers, to allow yyoverflow
1083        to reallocate them elsewhere.  */
1084 
1085     /* Their size.  */
1086     YYPTRDIFF_T yystacksize;
1087 
1088     /* The state stack.  */
1089     yy_state_t yyssa[YYINITDEPTH];
1090     yy_state_t *yyss;
1091     yy_state_t *yyssp;
1092 
1093     /* The semantic value stack.  */
1094     YYSTYPE yyvsa[YYINITDEPTH];
1095     YYSTYPE *yyvs;
1096     YYSTYPE *yyvsp;
1097 
1098   int yyn;
1099   /* The return value of yyparse.  */
1100   int yyresult;
1101   /* Lookahead token as an internal (translated) token number.  */
1102   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1103   /* The variables used to return semantic value and location from the
1104      action routines.  */
1105   YYSTYPE yyval;
1106 
1107 
1108 
1109 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1110 
1111   /* The number of symbols on the RHS of the reduced rule.
1112      Keep to zero when no symbol should be popped.  */
1113   int yylen = 0;
1114 
1115   yynerrs = 0;
1116   yystate = 0;
1117   yyerrstatus = 0;
1118 
1119   yystacksize = YYINITDEPTH;
1120   yyssp = yyss = yyssa;
1121   yyvsp = yyvs = yyvsa;
1122 
1123 
1124   YYDPRINTF ((stderr, "Starting parse\n"));
1125 
1126   yychar = TRACEFS_EMPTY; /* Cause a token to be read.  */
1127   goto yysetstate;
1128 
1129 
1130 /*------------------------------------------------------------.
1131 | yynewstate -- push a new state, which is found in yystate.  |
1132 `------------------------------------------------------------*/
1133 yynewstate:
1134   /* In all cases, when you get here, the value and location stacks
1135      have just been pushed.  So pushing a state here evens the stacks.  */
1136   yyssp++;
1137 
1138 
1139 /*--------------------------------------------------------------------.
1140 | yysetstate -- set current state (the top of the stack) to yystate.  |
1141 `--------------------------------------------------------------------*/
1142 yysetstate:
1143   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1144   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1145   YY_IGNORE_USELESS_CAST_BEGIN
1146   *yyssp = YY_CAST (yy_state_t, yystate);
1147   YY_IGNORE_USELESS_CAST_END
1148   YY_STACK_PRINT (yyss, yyssp);
1149 
1150   if (yyss + yystacksize - 1 <= yyssp)
1151 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1152     goto yyexhaustedlab;
1153 #else
1154     {
1155       /* Get the current used size of the three stacks, in elements.  */
1156       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1157 
1158 # if defined yyoverflow
1159       {
1160         /* Give user a chance to reallocate the stack.  Use copies of
1161            these so that the &'s don't force the real ones into
1162            memory.  */
1163         yy_state_t *yyss1 = yyss;
1164         YYSTYPE *yyvs1 = yyvs;
1165 
1166         /* Each stack pointer address is followed by the size of the
1167            data in use in that stack, in bytes.  This used to be a
1168            conditional around just the two extra args, but that might
1169            be undefined if yyoverflow is a macro.  */
1170         yyoverflow (YY_("memory exhausted"),
1171                     &yyss1, yysize * YYSIZEOF (*yyssp),
1172                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
1173                     &yystacksize);
1174         yyss = yyss1;
1175         yyvs = yyvs1;
1176       }
1177 # else /* defined YYSTACK_RELOCATE */
1178       /* Extend the stack our own way.  */
1179       if (YYMAXDEPTH <= yystacksize)
1180         goto yyexhaustedlab;
1181       yystacksize *= 2;
1182       if (YYMAXDEPTH < yystacksize)
1183         yystacksize = YYMAXDEPTH;
1184 
1185       {
1186         yy_state_t *yyss1 = yyss;
1187         union yyalloc *yyptr =
1188           YY_CAST (union yyalloc *,
1189                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1190         if (! yyptr)
1191           goto yyexhaustedlab;
1192         YYSTACK_RELOCATE (yyss_alloc, yyss);
1193         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1194 #  undef YYSTACK_RELOCATE
1195         if (yyss1 != yyssa)
1196           YYSTACK_FREE (yyss1);
1197       }
1198 # endif
1199 
1200       yyssp = yyss + yysize - 1;
1201       yyvsp = yyvs + yysize - 1;
1202 
1203       YY_IGNORE_USELESS_CAST_BEGIN
1204       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1205                   YY_CAST (long, yystacksize)));
1206       YY_IGNORE_USELESS_CAST_END
1207 
1208       if (yyss + yystacksize - 1 <= yyssp)
1209         YYABORT;
1210     }
1211 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1212 
1213   if (yystate == YYFINAL)
1214     YYACCEPT;
1215 
1216   goto yybackup;
1217 
1218 
1219 /*-----------.
1220 | yybackup.  |
1221 `-----------*/
1222 yybackup:
1223   /* Do appropriate processing given the current state.  Read a
1224      lookahead token if we need one and don't already have one.  */
1225 
1226   /* First try to decide what to do without reference to lookahead token.  */
1227   yyn = yypact[yystate];
1228   if (yypact_value_is_default (yyn))
1229     goto yydefault;
1230 
1231   /* Not known => get a lookahead token if don't already have one.  */
1232 
1233   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1234   if (yychar == TRACEFS_EMPTY)
1235     {
1236       YYDPRINTF ((stderr, "Reading a token\n"));
1237       yychar = yylex (&yylval, scanner);
1238     }
1239 
1240   if (yychar <= TRACEFS_EOF)
1241     {
1242       yychar = TRACEFS_EOF;
1243       yytoken = YYSYMBOL_YYEOF;
1244       YYDPRINTF ((stderr, "Now at end of input.\n"));
1245     }
1246   else if (yychar == TRACEFS_error)
1247     {
1248       /* The scanner already issued an error message, process directly
1249          to error recovery.  But do not keep the error token as
1250          lookahead, it is too special and may lead us to an endless
1251          loop in error recovery. */
1252       yychar = TRACEFS_UNDEF;
1253       yytoken = YYSYMBOL_YYerror;
1254       goto yyerrlab1;
1255     }
1256   else
1257     {
1258       yytoken = YYTRANSLATE (yychar);
1259       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1260     }
1261 
1262   /* If the proper action on seeing token YYTOKEN is to reduce or to
1263      detect an error, take that action.  */
1264   yyn += yytoken;
1265   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1266     goto yydefault;
1267   yyn = yytable[yyn];
1268   if (yyn <= 0)
1269     {
1270       if (yytable_value_is_error (yyn))
1271         goto yyerrlab;
1272       yyn = -yyn;
1273       goto yyreduce;
1274     }
1275 
1276   /* Count tokens shifted since error; after three, turn off error
1277      status.  */
1278   if (yyerrstatus)
1279     yyerrstatus--;
1280 
1281   /* Shift the lookahead token.  */
1282   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1283   yystate = yyn;
1284   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1285   *++yyvsp = yylval;
1286   YY_IGNORE_MAYBE_UNINITIALIZED_END
1287 
1288   /* Discard the shifted token.  */
1289   yychar = TRACEFS_EMPTY;
1290   goto yynewstate;
1291 
1292 
1293 /*-----------------------------------------------------------.
1294 | yydefault -- do the default action for the current state.  |
1295 `-----------------------------------------------------------*/
1296 yydefault:
1297   yyn = yydefact[yystate];
1298   if (yyn == 0)
1299     goto yyerrlab;
1300   goto yyreduce;
1301 
1302 
1303 /*-----------------------------.
1304 | yyreduce -- do a reduction.  |
1305 `-----------------------------*/
1306 yyreduce:
1307   /* yyn is the number of a rule to reduce with.  */
1308   yylen = yyr2[yyn];
1309 
1310   /* If YYLEN is nonzero, implement the default value of the action:
1311      '$$ = $1'.
1312 
1313      Otherwise, the following line sets YYVAL to garbage.
1314      This behavior is undocumented and Bison
1315      users should not rely upon it.  Assigning to YYVAL
1316      unconditionally makes the parser a bit smaller, and it avoids a
1317      GCC warning that YYVAL may be used uninitialized.  */
1318   yyval = yyvsp[1-yylen];
1319 
1320 
1321   YY_REDUCE_PRINT (yyn);
1322   switch (yyn)
1323     {
1324   case 3:
1325 #line 78 "sqlhist.y"
1326                 { CHECK_RETURN_PTR((yyval.string) = store_str(sb, (yyvsp[0].string))); }
1327 #line 1328 "sqlhist.tab.c"
1328     break;
1329 
1330   case 4:
1331 #line 79 "sqlhist.y"
1332         { CHECK_RETURN_PTR((yyval.string) = store_str(sb, (yyvsp[0].string))); }
1333 #line 1334 "sqlhist.tab.c"
1334     break;
1335 
1336   case 5:
1337 #line 82 "sqlhist.y"
1338                  { table_start(sb); }
1339 #line 1340 "sqlhist.tab.c"
1340     break;
1341 
1342   case 9:
1343 #line 96 "sqlhist.y"
1344                                 {
1345 					CHECK_RETURN_VAL(add_selection(sb, (yyvsp[0].expr), NULL));
1346 				}
1347 #line 1348 "sqlhist.tab.c"
1348     break;
1349 
1350   case 10:
1351 #line 100 "sqlhist.y"
1352                                 {
1353 					CHECK_RETURN_VAL(add_selection(sb, (yyvsp[-1].expr), (yyvsp[0].string)));
1354 				}
1355 #line 1356 "sqlhist.tab.c"
1356     break;
1357 
1358   case 12:
1359 #line 107 "sqlhist.y"
1360                                 {  (yyval.expr) = (yyvsp[-1].expr); }
1361 #line 1362 "sqlhist.tab.c"
1362     break;
1363 
1364   case 14:
1365 #line 109 "sqlhist.y"
1366                                 {  (yyval.expr) = (yyvsp[-1].expr); }
1367 #line 1368 "sqlhist.tab.c"
1368     break;
1369 
1370   case 15:
1371 #line 110 "sqlhist.y"
1372                                 {
1373 					 (yyval.expr) = add_cast(sb, (yyvsp[-3].expr), (yyvsp[-1].string));
1374 					 CHECK_RETURN_PTR((yyval.expr));
1375 				}
1376 #line 1377 "sqlhist.tab.c"
1377     break;
1378 
1379   case 16:
1380 #line 118 "sqlhist.y"
1381                                 {
1382 					(yyval.expr) = add_compare(sb, (yyvsp[-2].expr), (yyvsp[0].expr), COMPARE_ADD);
1383 					CHECK_RETURN_PTR((yyval.expr));
1384 				}
1385 #line 1386 "sqlhist.tab.c"
1386     break;
1387 
1388   case 17:
1389 #line 123 "sqlhist.y"
1390                                 {
1391 					(yyval.expr) = add_compare(sb, (yyvsp[-2].expr), (yyvsp[0].expr), COMPARE_SUB);
1392 					CHECK_RETURN_PTR((yyval.expr));
1393 				}
1394 #line 1395 "sqlhist.tab.c"
1395     break;
1396 
1397   case 20:
1398 #line 135 "sqlhist.y"
1399                 { (yyval.expr) = add_field(sb, (yyvsp[0].string), NULL); CHECK_RETURN_PTR((yyval.expr)); }
1400 #line 1401 "sqlhist.tab.c"
1401     break;
1402 
1403   case 21:
1404 #line 139 "sqlhist.y"
1405                { (yyval.expr) = add_field(sb, (yyvsp[-1].string), (yyvsp[0].string)); CHECK_RETURN_PTR((yyval.expr)); }
1406 #line 1407 "sqlhist.tab.c"
1407     break;
1408 
1409   case 23:
1410 #line 147 "sqlhist.y"
1411                 { (yyval.expr) = add_string(sb, (yyvsp[0].string)); CHECK_RETURN_PTR((yyval.expr)); }
1412 #line 1413 "sqlhist.tab.c"
1413     break;
1414 
1415   case 25:
1416 #line 152 "sqlhist.y"
1417                 { (yyval.expr) = add_number(sb, (yyvsp[0].number)); CHECK_RETURN_PTR((yyval.expr)); }
1418 #line 1419 "sqlhist.tab.c"
1419     break;
1420 
1421   case 26:
1422 #line 157 "sqlhist.y"
1423                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_LT); CHECK_RETURN_PTR((yyval.expr)); }
1424 #line 1425 "sqlhist.tab.c"
1425     break;
1426 
1427   case 27:
1428 #line 158 "sqlhist.y"
1429                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_GT); CHECK_RETURN_PTR((yyval.expr)); }
1430 #line 1431 "sqlhist.tab.c"
1431     break;
1432 
1433   case 28:
1434 #line 159 "sqlhist.y"
1435                 { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_LE); CHECK_RETURN_PTR((yyval.expr)); }
1436 #line 1437 "sqlhist.tab.c"
1437     break;
1438 
1439   case 29:
1440 #line 160 "sqlhist.y"
1441                 { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_GE); CHECK_RETURN_PTR((yyval.expr)); }
1442 #line 1443 "sqlhist.tab.c"
1443     break;
1444 
1445   case 30:
1446 #line 161 "sqlhist.y"
1447                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_EQ); CHECK_RETURN_PTR((yyval.expr)); }
1448 #line 1449 "sqlhist.tab.c"
1449     break;
1450 
1451   case 31:
1452 #line 162 "sqlhist.y"
1453                 { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_EQ); CHECK_RETURN_PTR((yyval.expr)); }
1454 #line 1455 "sqlhist.tab.c"
1455     break;
1456 
1457   case 32:
1458 #line 163 "sqlhist.y"
1459                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_NE); CHECK_RETURN_PTR((yyval.expr)); }
1460 #line 1461 "sqlhist.tab.c"
1461     break;
1462 
1463   case 33:
1464 #line 164 "sqlhist.y"
1465                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_NE); CHECK_RETURN_PTR((yyval.expr)); }
1466 #line 1467 "sqlhist.tab.c"
1467     break;
1468 
1469   case 34:
1470 #line 165 "sqlhist.y"
1471                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_BIN_AND); CHECK_RETURN_PTR((yyval.expr)); }
1472 #line 1473 "sqlhist.tab.c"
1473     break;
1474 
1475   case 35:
1476 #line 166 "sqlhist.y"
1477                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_STR_CMP); CHECK_RETURN_PTR((yyval.expr)); }
1478 #line 1479 "sqlhist.tab.c"
1479     break;
1480 
1481   case 36:
1482 #line 170 "sqlhist.y"
1483                                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_OR); CHECK_RETURN_PTR((yyval.expr)); }
1484 #line 1485 "sqlhist.tab.c"
1485     break;
1486 
1487   case 37:
1488 #line 171 "sqlhist.y"
1489                                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_AND); CHECK_RETURN_PTR((yyval.expr)); }
1490 #line 1491 "sqlhist.tab.c"
1491     break;
1492 
1493   case 38:
1494 #line 172 "sqlhist.y"
1495                                         { (yyval.expr) = add_filter(sb, (yyvsp[-1].expr), NULL, FILTER_NOT_GROUP); CHECK_RETURN_PTR((yyval.expr)); }
1496 #line 1497 "sqlhist.tab.c"
1497     break;
1498 
1499   case 39:
1500 #line 173 "sqlhist.y"
1501                                         { (yyval.expr) = add_filter(sb, (yyvsp[0].expr), NULL, FILTER_NOT_GROUP); CHECK_RETURN_PTR((yyval.expr)); }
1502 #line 1503 "sqlhist.tab.c"
1503     break;
1504 
1505   case 41:
1506 #line 178 "sqlhist.y"
1507                                         { (yyval.expr) = add_filter(sb, (yyvsp[-2].expr), (yyvsp[0].expr), FILTER_OR); CHECK_RETURN_PTR((yyval.expr)); }
1508 #line 1509 "sqlhist.tab.c"
1509     break;
1510 
1511   case 42:
1512 #line 179 "sqlhist.y"
1513                                         { (yyval.expr) = add_filter(sb, (yyvsp[-1].expr), NULL, FILTER_GROUP); CHECK_RETURN_PTR((yyval.expr)); }
1514 #line 1515 "sqlhist.tab.c"
1515     break;
1516 
1517   case 43:
1518 #line 180 "sqlhist.y"
1519                                         { (yyval.expr) = add_filter(sb, (yyvsp[-1].expr), NULL, FILTER_NOT_GROUP); CHECK_RETURN_PTR((yyval.expr)); }
1520 #line 1521 "sqlhist.tab.c"
1521     break;
1522 
1523   case 44:
1524 #line 181 "sqlhist.y"
1525                                         { (yyval.expr) = add_filter(sb, (yyvsp[0].expr), NULL, FILTER_NOT_GROUP); CHECK_RETURN_PTR((yyval.expr)); }
1526 #line 1527 "sqlhist.tab.c"
1527     break;
1528 
1529   case 46:
1530 #line 186 "sqlhist.y"
1531                                 { CHECK_RETURN_VAL(add_where(sb, (yyvsp[0].expr))); }
1532 #line 1533 "sqlhist.tab.c"
1533     break;
1534 
1535   case 56:
1536 #line 219 "sqlhist.y"
1537                         { CHECK_RETURN_VAL(add_from(sb, (yyvsp[0].expr))); }
1538 #line 1539 "sqlhist.tab.c"
1539     break;
1540 
1541   case 57:
1542 #line 234 "sqlhist.y"
1543                                 { add_to(sb, (yyvsp[-2].expr)); }
1544 #line 1545 "sqlhist.tab.c"
1545     break;
1546 
1547   case 58:
1548 #line 238 "sqlhist.y"
1549                  { CHECK_RETURN_VAL(add_match(sb, (yyvsp[-2].expr), (yyvsp[0].expr))); }
1550 #line 1551 "sqlhist.tab.c"
1551     break;
1552 
1553   case 59:
1554 #line 239 "sqlhist.y"
1555                 { CHECK_RETURN_VAL(add_match(sb, (yyvsp[-2].expr), (yyvsp[0].expr))); }
1556 #line 1557 "sqlhist.tab.c"
1557     break;
1558 
1559 
1560 #line 1561 "sqlhist.tab.c"
1561 
1562       default: break;
1563     }
1564   /* User semantic actions sometimes alter yychar, and that requires
1565      that yytoken be updated with the new translation.  We take the
1566      approach of translating immediately before every use of yytoken.
1567      One alternative is translating here after every semantic action,
1568      but that translation would be missed if the semantic action invokes
1569      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1570      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1571      incorrect destructor might then be invoked immediately.  In the
1572      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1573      to an incorrect destructor call or verbose syntax error message
1574      before the lookahead is translated.  */
1575   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1576 
1577   YYPOPSTACK (yylen);
1578   yylen = 0;
1579 
1580   *++yyvsp = yyval;
1581 
1582   /* Now 'shift' the result of the reduction.  Determine what state
1583      that goes to, based on the state we popped back to and the rule
1584      number reduced by.  */
1585   {
1586     const int yylhs = yyr1[yyn] - YYNTOKENS;
1587     const int yyi = yypgoto[yylhs] + *yyssp;
1588     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1589                ? yytable[yyi]
1590                : yydefgoto[yylhs]);
1591   }
1592 
1593   goto yynewstate;
1594 
1595 
1596 /*--------------------------------------.
1597 | yyerrlab -- here on detecting error.  |
1598 `--------------------------------------*/
1599 yyerrlab:
1600   /* Make sure we have latest lookahead translation.  See comments at
1601      user semantic actions for why this is necessary.  */
1602   yytoken = yychar == TRACEFS_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1603   /* If not already recovering from an error, report this error.  */
1604   if (!yyerrstatus)
1605     {
1606       ++yynerrs;
1607       yyerror (sb, YY_("syntax error"));
1608     }
1609 
1610   if (yyerrstatus == 3)
1611     {
1612       /* If just tried and failed to reuse lookahead token after an
1613          error, discard it.  */
1614 
1615       if (yychar <= TRACEFS_EOF)
1616         {
1617           /* Return failure if at end of input.  */
1618           if (yychar == TRACEFS_EOF)
1619             YYABORT;
1620         }
1621       else
1622         {
1623           yydestruct ("Error: discarding",
1624                       yytoken, &yylval, sb);
1625           yychar = TRACEFS_EMPTY;
1626         }
1627     }
1628 
1629   /* Else will try to reuse lookahead token after shifting the error
1630      token.  */
1631   goto yyerrlab1;
1632 
1633 
1634 /*---------------------------------------------------.
1635 | yyerrorlab -- error raised explicitly by YYERROR.  |
1636 `---------------------------------------------------*/
1637 yyerrorlab:
1638   /* Pacify compilers when the user code never invokes YYERROR and the
1639      label yyerrorlab therefore never appears in user code.  */
1640   if (0)
1641     YYERROR;
1642 
1643   /* Do not reclaim the symbols of the rule whose action triggered
1644      this YYERROR.  */
1645   YYPOPSTACK (yylen);
1646   yylen = 0;
1647   YY_STACK_PRINT (yyss, yyssp);
1648   yystate = *yyssp;
1649   goto yyerrlab1;
1650 
1651 
1652 /*-------------------------------------------------------------.
1653 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1654 `-------------------------------------------------------------*/
1655 yyerrlab1:
1656   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1657 
1658   /* Pop stack until we find a state that shifts the error token.  */
1659   for (;;)
1660     {
1661       yyn = yypact[yystate];
1662       if (!yypact_value_is_default (yyn))
1663         {
1664           yyn += YYSYMBOL_YYerror;
1665           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1666             {
1667               yyn = yytable[yyn];
1668               if (0 < yyn)
1669                 break;
1670             }
1671         }
1672 
1673       /* Pop the current state because it cannot handle the error token.  */
1674       if (yyssp == yyss)
1675         YYABORT;
1676 
1677 
1678       yydestruct ("Error: popping",
1679                   YY_ACCESSING_SYMBOL (yystate), yyvsp, sb);
1680       YYPOPSTACK (1);
1681       yystate = *yyssp;
1682       YY_STACK_PRINT (yyss, yyssp);
1683     }
1684 
1685   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1686   *++yyvsp = yylval;
1687   YY_IGNORE_MAYBE_UNINITIALIZED_END
1688 
1689 
1690   /* Shift the error token.  */
1691   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1692 
1693   yystate = yyn;
1694   goto yynewstate;
1695 
1696 
1697 /*-------------------------------------.
1698 | yyacceptlab -- YYACCEPT comes here.  |
1699 `-------------------------------------*/
1700 yyacceptlab:
1701   yyresult = 0;
1702   goto yyreturn;
1703 
1704 
1705 /*-----------------------------------.
1706 | yyabortlab -- YYABORT comes here.  |
1707 `-----------------------------------*/
1708 yyabortlab:
1709   yyresult = 1;
1710   goto yyreturn;
1711 
1712 
1713 #if !defined yyoverflow
1714 /*-------------------------------------------------.
1715 | yyexhaustedlab -- memory exhaustion comes here.  |
1716 `-------------------------------------------------*/
1717 yyexhaustedlab:
1718   yyerror (sb, YY_("memory exhausted"));
1719   yyresult = 2;
1720   /* Fall through.  */
1721 #endif
1722 
1723 
1724 /*-----------------------------------------------------.
1725 | yyreturn -- parsing is finished, return the result.  |
1726 `-----------------------------------------------------*/
1727 yyreturn:
1728   if (yychar != TRACEFS_EMPTY)
1729     {
1730       /* Make sure we have latest lookahead translation.  See comments at
1731          user semantic actions for why this is necessary.  */
1732       yytoken = YYTRANSLATE (yychar);
1733       yydestruct ("Cleanup: discarding lookahead",
1734                   yytoken, &yylval, sb);
1735     }
1736   /* Do not reclaim the symbols of the rule whose action triggered
1737      this YYABORT or YYACCEPT.  */
1738   YYPOPSTACK (yylen);
1739   YY_STACK_PRINT (yyss, yyssp);
1740   while (yyssp != yyss)
1741     {
1742       yydestruct ("Cleanup: popping",
1743                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, sb);
1744       YYPOPSTACK (1);
1745     }
1746 #ifndef yyoverflow
1747   if (yyss != yyssa)
1748     YYSTACK_FREE (yyss);
1749 #endif
1750 
1751   return yyresult;
1752 }
1753 
1754 #line 248 "sqlhist.y"
1755 
1756