Drizzled Public API Documentation

parser.cc
1 /* A Bison parser, made by GNU Bison 2.7.12-4996. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
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.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34  simplifying the original so-called "semantic" parser. */
35 
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. */
42 
43 /* Identify Bison output. */
44 #define YYBISON 1
45 
46 /* Bison version. */
47 #define YYBISON_VERSION "2.7.12-4996"
48 
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers. */
53 #define YYPURE 1
54 
55 /* Push parsers. */
56 #define YYPUSH 0
57 
58 /* Pull parsers. */
59 #define YYPULL 1
60 
61 
62 /* Substitute the variable and function names. */
63 #define yyparse execute_parse
64 #define yylex execute_lex
65 #define yyerror execute_error
66 #define yylval execute_lval
67 #define yychar execute_char
68 #define yydebug execute_debug
69 #define yynerrs execute_nerrs
70 
71 /* Copy the first part of user declarations. */
72 /* Line 371 of yacc.c */
73 #line 40 "drizzled/execute/parser.yy"
74 
75 
76 #include <config.h>
77 #include <iostream>
78 #include <stdint.h>
79 #include "drizzled/execute/common.h"
80 #include <drizzled/execute/scanner.h>
81 #include <vector>
82 
83 #ifndef __INTEL_COMPILER
84 # pragma GCC diagnostic ignored "-Wold-style-cast"
85 #endif
86 
87 /* Line 371 of yacc.c */
88 #line 70 "drizzled/execute/parser.yy"
89 
90 
91 #define YYENABLE_NLS 0
92 #define YYLTYPE_IS_TRIVIAL 0
93 
94 std::string query;
95 #define parser_abort(A, B) do { parser::abort_func((A), (B)); YYABORT; } while (0)
96 
97 namespace drizzled { namespace execute { class Context; }}
98 
99 inline void execute_error(class drizzled::execute::Context *context, void *scanner, const char *error)
100 {
101  if (not context->end())
102  {
103  /* TODO: FIX ME!!! */
104  /*
105  context->abort(context, error);*/
106  }
107 }
108 
109 
110 /* Line 371 of yacc.c */
111 #line 112 "drizzled/execute/parser.cc"
112 
113 # ifndef YY_NULL
114 # if defined __cplusplus && 201103L <= __cplusplus
115 # define YY_NULL nullptr
116 # else
117 # define YY_NULL 0
118 # endif
119 # endif
120 
121 /* Enabling verbose error messages. */
122 #ifdef YYERROR_VERBOSE
123 # undef YYERROR_VERBOSE
124 # define YYERROR_VERBOSE 1
125 #else
126 # define YYERROR_VERBOSE 1
127 #endif
128 
129 /* In a future release of Bison, this section will be replaced
130  by #include "parser.h". */
131 #ifndef YY_EXECUTE_DRIZZLED_EXECUTE_PARSER_H_INCLUDED
132 # define YY_EXECUTE_DRIZZLED_EXECUTE_PARSER_H_INCLUDED
133 /* Enabling traces. */
134 #ifndef YYDEBUG
135 # define YYDEBUG 1
136 #endif
137 #if YYDEBUG
138 extern int execute_debug;
139 #endif
140 
141 /* Tokens. */
142 #ifndef YYTOKENTYPE
143 # define YYTOKENTYPE
144  /* Put the tokens into the symbol table, so that GDB and other debuggers
145  know about them. */
146  enum yytokentype {
147  STRING = 258,
148  QUOTED_STRING = 259,
149  UNKNOWN = 260
150  };
151 #endif
152 /* Tokens. */
153 #define STRING 258
154 #define QUOTED_STRING 259
155 #define UNKNOWN 260
156 
157 
158 
159 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
160 
161 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
162 # define YYSTYPE_IS_DECLARED 1
163 #endif
164 
165 
166 #ifdef YYPARSE_PARAM
167 #if defined __STDC__ || defined __cplusplus
168 int execute_parse (void *YYPARSE_PARAM);
169 #else
170 int execute_parse ();
171 #endif
172 #else /* ! YYPARSE_PARAM */
173 #if defined __STDC__ || defined __cplusplus
174 int execute_parse (class drizzled::execute::Context *context, void *scanner);
175 #else
176 int execute_parse ();
177 #endif
178 #endif /* ! YYPARSE_PARAM */
179 
180 #endif /* !YY_EXECUTE_DRIZZLED_EXECUTE_PARSER_H_INCLUDED */
181 
182 /* Copy the second part of user declarations. */
183 
184 /* Line 390 of yacc.c */
185 #line 186 "drizzled/execute/parser.cc"
186 
187 #ifdef short
188 # undef short
189 #endif
190 
191 #ifdef YYTYPE_UINT8
192 typedef YYTYPE_UINT8 yytype_uint8;
193 #else
194 typedef unsigned char yytype_uint8;
195 #endif
196 
197 #ifdef YYTYPE_INT8
198 typedef YYTYPE_INT8 yytype_int8;
199 #elif (defined __STDC__ || defined __C99__FUNC__ \
200  || defined __cplusplus || defined _MSC_VER)
201 typedef signed char yytype_int8;
202 #else
203 typedef short int yytype_int8;
204 #endif
205 
206 #ifdef YYTYPE_UINT16
207 typedef YYTYPE_UINT16 yytype_uint16;
208 #else
209 typedef unsigned short int yytype_uint16;
210 #endif
211 
212 #ifdef YYTYPE_INT16
213 typedef YYTYPE_INT16 yytype_int16;
214 #else
215 typedef short int yytype_int16;
216 #endif
217 
218 #ifndef YYSIZE_T
219 # ifdef __SIZE_TYPE__
220 # define YYSIZE_T __SIZE_TYPE__
221 # elif defined size_t
222 # define YYSIZE_T size_t
223 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
224  || defined __cplusplus || defined _MSC_VER)
225 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
226 # define YYSIZE_T size_t
227 # else
228 # define YYSIZE_T unsigned int
229 # endif
230 #endif
231 
232 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
233 
234 #ifndef YY_
235 # if defined YYENABLE_NLS && YYENABLE_NLS
236 # if ENABLE_NLS
237 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
238 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
239 # endif
240 # endif
241 # ifndef YY_
242 # define YY_(Msgid) Msgid
243 # endif
244 #endif
245 
246 #ifndef __attribute__
247 /* This feature is available in gcc versions 2.5 and later. */
248 # if (! defined __GNUC__ || __GNUC__ < 2 \
249  || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
250 # define __attribute__(Spec) /* empty */
251 # endif
252 #endif
253 
254 /* Suppress unused-variable warnings by "using" E. */
255 #if ! defined lint || defined __GNUC__
256 # define YYUSE(E) ((void) (E))
257 #else
258 # define YYUSE(E) /* empty */
259 #endif
260 
261 
262 /* Identity function, used to suppress warnings about constant conditions. */
263 #ifndef lint
264 # define YYID(N) (N)
265 #else
266 #if (defined __STDC__ || defined __C99__FUNC__ \
267  || defined __cplusplus || defined _MSC_VER)
268 static int
269 YYID (int yyi)
270 #else
271 static int
272 YYID (yyi)
273  int yyi;
274 #endif
275 {
276  return yyi;
277 }
278 #endif
279 
280 #if ! defined yyoverflow || YYERROR_VERBOSE
281 
282 /* The parser invokes alloca or malloc; define the necessary symbols. */
283 
284 # ifdef YYSTACK_USE_ALLOCA
285 # if YYSTACK_USE_ALLOCA
286 # ifdef __GNUC__
287 # define YYSTACK_ALLOC __builtin_alloca
288 # elif defined __BUILTIN_VA_ARG_INCR
289 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
290 # elif defined _AIX
291 # define YYSTACK_ALLOC __alloca
292 # elif defined _MSC_VER
293 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
294 # define alloca _alloca
295 # else
296 # define YYSTACK_ALLOC alloca
297 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
298  || defined __cplusplus || defined _MSC_VER)
299 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
300  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
301 # ifndef EXIT_SUCCESS
302 # define EXIT_SUCCESS 0
303 # endif
304 # endif
305 # endif
306 # endif
307 # endif
308 
309 # ifdef YYSTACK_ALLOC
310  /* Pacify GCC's `empty if-body' warning. */
311 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
312 # ifndef YYSTACK_ALLOC_MAXIMUM
313  /* The OS might guarantee only one guard page at the bottom of the stack,
314  and a page size can be as small as 4096 bytes. So we cannot safely
315  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
316  to allow for a few compiler-allocated temporary stack slots. */
317 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
318 # endif
319 # else
320 # define YYSTACK_ALLOC YYMALLOC
321 # define YYSTACK_FREE YYFREE
322 # ifndef YYSTACK_ALLOC_MAXIMUM
323 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
324 # endif
325 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
326  && ! ((defined YYMALLOC || defined malloc) \
327  && (defined YYFREE || defined free)))
328 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
329 # ifndef EXIT_SUCCESS
330 # define EXIT_SUCCESS 0
331 # endif
332 # endif
333 # ifndef YYMALLOC
334 # define YYMALLOC malloc
335 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
336  || defined __cplusplus || defined _MSC_VER)
337 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
338 # endif
339 # endif
340 # ifndef YYFREE
341 # define YYFREE free
342 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
343  || defined __cplusplus || defined _MSC_VER)
344 void free (void *); /* INFRINGES ON USER NAME SPACE */
345 # endif
346 # endif
347 # endif
348 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
349 
350 
351 #if (! defined yyoverflow \
352  && (! defined __cplusplus \
353  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
354 
355 /* A type that is properly aligned for any stack member. */
356 union yyalloc
357 {
358  yytype_int16 yyss_alloc;
359  YYSTYPE yyvs_alloc;
360 };
361 
362 /* The size of the maximum gap between one aligned stack and the next. */
363 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
364 
365 /* The size of an array large to enough to hold all stacks, each with
366  N elements. */
367 # define YYSTACK_BYTES(N) \
368  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
369  + YYSTACK_GAP_MAXIMUM)
370 
371 # define YYCOPY_NEEDED 1
372 
373 /* Relocate STACK from its old location to the new one. The
374  local variables YYSIZE and YYSTACKSIZE give the old and new number of
375  elements in the stack, and YYPTR gives the new location of the
376  stack. Advance YYPTR to a properly aligned location for the next
377  stack. */
378 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
379  do \
380  { \
381  YYSIZE_T yynewbytes; \
382  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
383  Stack = &yyptr->Stack_alloc; \
384  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
385  yyptr += yynewbytes / sizeof (*yyptr); \
386  } \
387  while (YYID (0))
388 
389 #endif
390 
391 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
392 /* Copy COUNT objects from SRC to DST. The source and destination do
393  not overlap. */
394 # ifndef YYCOPY
395 # if defined __GNUC__ && 1 < __GNUC__
396 # define YYCOPY(Dst, Src, Count) \
397  __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
398 # else
399 # define YYCOPY(Dst, Src, Count) \
400  do \
401  { \
402  YYSIZE_T yyi; \
403  for (yyi = 0; yyi < (Count); yyi++) \
404  (Dst)[yyi] = (Src)[yyi]; \
405  } \
406  while (YYID (0))
407 # endif
408 # endif
409 #endif /* !YYCOPY_NEEDED */
410 
411 /* YYFINAL -- State number of the termination state. */
412 #define YYFINAL 3
413 /* YYLAST -- Last index in YYTABLE. */
414 #define YYLAST 3
415 
416 /* YYNTOKENS -- Number of terminals. */
417 #define YYNTOKENS 6
418 /* YYNNTS -- Number of nonterminals. */
419 #define YYNNTS 2
420 /* YYNRULES -- Number of rules. */
421 #define YYNRULES 3
422 /* YYNRULES -- Number of states. */
423 #define YYNSTATES 5
424 
425 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
426 #define YYUNDEFTOK 2
427 #define YYMAXUTOK 260
428 
429 #define YYTRANSLATE(YYX) \
430  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
431 
432 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
433 static const yytype_uint8 yytranslate[] =
434 {
435  0, 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, 2, 2, 2, 2,
445  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
461  5
462 };
463 
464 #if YYDEBUG
465 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
466  YYRHS. */
467 static const yytype_uint8 yyprhs[] =
468 {
469  0, 0, 3, 5
470 };
471 
472 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
473 static const yytype_int8 yyrhs[] =
474 {
475  7, 0, -1, 3, -1, 7, 3, -1
476 };
477 
478 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
479 static const yytype_uint8 yyrline[] =
480 {
481  0, 101, 101, 107
482 };
483 #endif
484 
485 #if YYDEBUG || YYERROR_VERBOSE || 1
486 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
487  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
488 static const char *const yytname[] =
489 {
490  "$end", "error", "$undefined", "STRING", "QUOTED_STRING", "UNKNOWN",
491  "$accept", "begin", YY_NULL
492 };
493 #endif
494 
495 # ifdef YYPRINT
496 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
497  token YYLEX-NUM. */
498 static const yytype_uint16 yytoknum[] =
499 {
500  0, 256, 257, 258, 259, 260
501 };
502 # endif
503 
504 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
505 static const yytype_uint8 yyr1[] =
506 {
507  0, 6, 7, 7
508 };
509 
510 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
511 static const yytype_uint8 yyr2[] =
512 {
513  0, 2, 1, 2
514 };
515 
516 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
517  Performed when YYTABLE doesn't specify something else to do. Zero
518  means the default is an error. */
519 static const yytype_uint8 yydefact[] =
520 {
521  0, 2, 0, 1, 3
522 };
523 
524 /* YYDEFGOTO[NTERM-NUM]. */
525 static const yytype_int8 yydefgoto[] =
526 {
527  -1, 2
528 };
529 
530 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
531  STATE-NUM. */
532 #define YYPACT_NINF -3
533 static const yytype_int8 yypact[] =
534 {
535  -2, -3, 0, -3, -3
536 };
537 
538 /* YYPGOTO[NTERM-NUM]. */
539 static const yytype_int8 yypgoto[] =
540 {
541  -3, -3
542 };
543 
544 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
545  positive, shift that token. If negative, reduce the rule which
546  number is the opposite. If YYTABLE_NINF, syntax error. */
547 #define YYTABLE_NINF -1
548 static const yytype_uint8 yytable[] =
549 {
550  3, 1, 0, 4
551 };
552 
553 #define yypact_value_is_default(Yystate) \
554  (!!((Yystate) == (-3)))
555 
556 #define yytable_value_is_error(Yytable_value) \
557  YYID (0)
558 
559 static const yytype_int8 yycheck[] =
560 {
561  0, 3, -1, 3
562 };
563 
564 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
565  symbol of state STATE-NUM. */
566 static const yytype_uint8 yystos[] =
567 {
568  0, 3, 7, 0, 3
569 };
570 
571 #define yyerrok (yyerrstatus = 0)
572 #define yyclearin (yychar = YYEMPTY)
573 #define YYEMPTY (-2)
574 #define YYEOF 0
575 
576 #define YYACCEPT goto yyacceptlab
577 #define YYABORT goto yyabortlab
578 #define YYERROR goto yyerrorlab
579 
580 
581 /* Like YYERROR except do call yyerror. This remains here temporarily
582  to ease the transition to the new meaning of YYERROR, for GCC.
583  Once GCC version 2 has supplanted version 1, this can go. However,
584  YYFAIL appears to be in use. Nevertheless, it is formally deprecated
585  in Bison 2.4.2's NEWS entry, where a plan to phase it out is
586  discussed. */
587 
588 #define YYFAIL goto yyerrlab
589 #if defined YYFAIL
590  /* This is here to suppress warnings from the GCC cpp's
591  -Wunused-macros. Normally we don't worry about that warning, but
592  some users do, and we want to make it easy for users to remove
593  YYFAIL uses, which will produce warnings from Bison 2.5. */
594 #endif
595 
596 #define YYRECOVERING() (!!yyerrstatus)
597 
598 #define YYBACKUP(Token, Value) \
599 do \
600  if (yychar == YYEMPTY) \
601  { \
602  yychar = (Token); \
603  yylval = (Value); \
604  YYPOPSTACK (yylen); \
605  yystate = *yyssp; \
606  goto yybackup; \
607  } \
608  else \
609  { \
610  yyerror (context, scanner, YY_("syntax error: cannot back up")); \
611  YYERROR; \
612  } \
613 while (YYID (0))
614 
615 /* Error token number */
616 #define YYTERROR 1
617 #define YYERRCODE 256
618 
619 
620 /* This macro is provided for backward compatibility. */
621 #ifndef YY_LOCATION_PRINT
622 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
623 #endif
624 
625 
626 /* YYLEX -- calling `yylex' with the right arguments. */
627 #ifdef YYLEX_PARAM
628 # define YYLEX yylex (&yylval, YYLEX_PARAM)
629 #else
630 # define YYLEX yylex (&yylval, scanner)
631 #endif
632 
633 /* Enable debugging if requested. */
634 #if YYDEBUG
635 
636 # ifndef YYFPRINTF
637 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
638 # define YYFPRINTF fprintf
639 # endif
640 
641 # define YYDPRINTF(Args) \
642 do { \
643  if (yydebug) \
644  YYFPRINTF Args; \
645 } while (YYID (0))
646 
647 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
648 do { \
649  if (yydebug) \
650  { \
651  YYFPRINTF (stderr, "%s ", Title); \
652  yy_symbol_print (stderr, \
653  Type, Value, context, scanner); \
654  YYFPRINTF (stderr, "\n"); \
655  } \
656 } while (YYID (0))
657 
658 
659 /*--------------------------------.
660 | Print this symbol on YYOUTPUT. |
661 `--------------------------------*/
662 
663 /*ARGSUSED*/
664 #if (defined __STDC__ || defined __C99__FUNC__ \
665  || defined __cplusplus || defined _MSC_VER)
666 static void
667 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, class drizzled::execute::Context *context, void *scanner)
668 #else
669 static void
670 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context, scanner)
671  FILE *yyoutput;
672  int yytype;
673  YYSTYPE const * const yyvaluep;
674  class drizzled::execute::Context *context;
675  void *scanner;
676 #endif
677 {
678  FILE *yyo = yyoutput;
679  YYUSE (yyo);
680  if (!yyvaluep)
681  return;
682  YYUSE (context);
683  YYUSE (scanner);
684 # ifdef YYPRINT
685  if (yytype < YYNTOKENS)
686  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
687 # else
688  YYUSE (yyoutput);
689 # endif
690  YYUSE (yytype);
691 }
692 
693 
694 /*--------------------------------.
695 | Print this symbol on YYOUTPUT. |
696 `--------------------------------*/
697 
698 #if (defined __STDC__ || defined __C99__FUNC__ \
699  || defined __cplusplus || defined _MSC_VER)
700 static void
701 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, class drizzled::execute::Context *context, void *scanner)
702 #else
703 static void
704 yy_symbol_print (yyoutput, yytype, yyvaluep, context, scanner)
705  FILE *yyoutput;
706  int yytype;
707  YYSTYPE const * const yyvaluep;
708  class drizzled::execute::Context *context;
709  void *scanner;
710 #endif
711 {
712  if (yytype < YYNTOKENS)
713  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
714  else
715  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
716 
717  yy_symbol_value_print (yyoutput, yytype, yyvaluep, context, scanner);
718  YYFPRINTF (yyoutput, ")");
719 }
720 
721 /*------------------------------------------------------------------.
722 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
723 | TOP (included). |
724 `------------------------------------------------------------------*/
725 
726 #if (defined __STDC__ || defined __C99__FUNC__ \
727  || defined __cplusplus || defined _MSC_VER)
728 static void
729 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
730 #else
731 static void
732 yy_stack_print (yybottom, yytop)
733  yytype_int16 *yybottom;
734  yytype_int16 *yytop;
735 #endif
736 {
737  YYFPRINTF (stderr, "Stack now");
738  for (; yybottom <= yytop; yybottom++)
739  {
740  int yybot = *yybottom;
741  YYFPRINTF (stderr, " %d", yybot);
742  }
743  YYFPRINTF (stderr, "\n");
744 }
745 
746 # define YY_STACK_PRINT(Bottom, Top) \
747 do { \
748  if (yydebug) \
749  yy_stack_print ((Bottom), (Top)); \
750 } while (YYID (0))
751 
752 
753 /*------------------------------------------------.
754 | Report that the YYRULE is going to be reduced. |
755 `------------------------------------------------*/
756 
757 #if (defined __STDC__ || defined __C99__FUNC__ \
758  || defined __cplusplus || defined _MSC_VER)
759 static void
760 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, class drizzled::execute::Context *context, void *scanner)
761 #else
762 static void
763 yy_reduce_print (yyvsp, yyrule, context, scanner)
764  YYSTYPE *yyvsp;
765  int yyrule;
766  class drizzled::execute::Context *context;
767  void *scanner;
768 #endif
769 {
770  int yynrhs = yyr2[yyrule];
771  int yyi;
772  unsigned long int yylno = yyrline[yyrule];
773  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
774  yyrule - 1, yylno);
775  /* The symbols being reduced. */
776  for (yyi = 0; yyi < yynrhs; yyi++)
777  {
778  YYFPRINTF (stderr, " $%d = ", yyi + 1);
779  yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
780  &(yyvsp[(yyi + 1) - (yynrhs)])
781  , context, scanner);
782  YYFPRINTF (stderr, "\n");
783  }
784 }
785 
786 # define YY_REDUCE_PRINT(Rule) \
787 do { \
788  if (yydebug) \
789  yy_reduce_print (yyvsp, Rule, context, scanner); \
790 } while (YYID (0))
791 
792 /* Nonzero means print parse trace. It is left uninitialized so that
793  multiple parsers can coexist. */
794 int yydebug;
795 #else /* !YYDEBUG */
796 # define YYDPRINTF(Args)
797 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
798 # define YY_STACK_PRINT(Bottom, Top)
799 # define YY_REDUCE_PRINT(Rule)
800 #endif /* !YYDEBUG */
801 
802 
803 /* YYINITDEPTH -- initial size of the parser's stacks. */
804 #ifndef YYINITDEPTH
805 # define YYINITDEPTH 200
806 #endif
807 
808 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
809  if the built-in stack extension method is used).
810 
811  Do not make this value too large; the results are undefined if
812  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
813  evaluated with infinite-precision integer arithmetic. */
814 
815 #ifndef YYMAXDEPTH
816 # define YYMAXDEPTH 10000
817 #endif
818 
819 
820 #if YYERROR_VERBOSE
821 
822 # ifndef yystrlen
823 # if defined __GLIBC__ && defined _STRING_H
824 # define yystrlen strlen
825 # else
826 /* Return the length of YYSTR. */
827 #if (defined __STDC__ || defined __C99__FUNC__ \
828  || defined __cplusplus || defined _MSC_VER)
829 static YYSIZE_T
830 yystrlen (const char *yystr)
831 #else
832 static YYSIZE_T
833 yystrlen (yystr)
834  const char *yystr;
835 #endif
836 {
837  YYSIZE_T yylen;
838  for (yylen = 0; yystr[yylen]; yylen++)
839  continue;
840  return yylen;
841 }
842 # endif
843 # endif
844 
845 # ifndef yystpcpy
846 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
847 # define yystpcpy stpcpy
848 # else
849 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
850  YYDEST. */
851 #if (defined __STDC__ || defined __C99__FUNC__ \
852  || defined __cplusplus || defined _MSC_VER)
853 static char *
854 yystpcpy (char *yydest, const char *yysrc)
855 #else
856 static char *
857 yystpcpy (yydest, yysrc)
858  char *yydest;
859  const char *yysrc;
860 #endif
861 {
862  char *yyd = yydest;
863  const char *yys = yysrc;
864 
865  while ((*yyd++ = *yys++) != '\0')
866  continue;
867 
868  return yyd - 1;
869 }
870 # endif
871 # endif
872 
873 # ifndef yytnamerr
874 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
875  quotes and backslashes, so that it's suitable for yyerror. The
876  heuristic is that double-quoting is unnecessary unless the string
877  contains an apostrophe, a comma, or backslash (other than
878  backslash-backslash). YYSTR is taken from yytname. If YYRES is
879  null, do not copy; instead, return the length of what the result
880  would have been. */
881 static YYSIZE_T
882 yytnamerr (char *yyres, const char *yystr)
883 {
884  if (*yystr == '"')
885  {
886  YYSIZE_T yyn = 0;
887  char const *yyp = yystr;
888 
889  for (;;)
890  switch (*++yyp)
891  {
892  case '\'':
893  case ',':
894  goto do_not_strip_quotes;
895 
896  case '\\':
897  if (*++yyp != '\\')
898  goto do_not_strip_quotes;
899  /* Fall through. */
900  default:
901  if (yyres)
902  yyres[yyn] = *yyp;
903  yyn++;
904  break;
905 
906  case '"':
907  if (yyres)
908  yyres[yyn] = '\0';
909  return yyn;
910  }
911  do_not_strip_quotes: ;
912  }
913 
914  if (! yyres)
915  return yystrlen (yystr);
916 
917  return yystpcpy (yyres, yystr) - yyres;
918 }
919 # endif
920 
921 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
922  about the unexpected token YYTOKEN for the state stack whose top is
923  YYSSP.
924 
925  Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
926  not large enough to hold the message. In that case, also set
927  *YYMSG_ALLOC to the required number of bytes. Return 2 if the
928  required number of bytes is too large to store. */
929 static int
930 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
931  yytype_int16 *yyssp, int yytoken)
932 {
933  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
934  YYSIZE_T yysize = yysize0;
935  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
936  /* Internationalized format string. */
937  const char *yyformat = YY_NULL;
938  /* Arguments of yyformat. */
939  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
940  /* Number of reported tokens (one for the "unexpected", one per
941  "expected"). */
942  int yycount = 0;
943 
944  /* There are many possibilities here to consider:
945  - Assume YYFAIL is not used. It's too flawed to consider. See
946  <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
947  for details. YYERROR is fine as it does not invoke this
948  function.
949  - If this state is a consistent state with a default action, then
950  the only way this function was invoked is if the default action
951  is an error action. In that case, don't check for expected
952  tokens because there are none.
953  - The only way there can be no lookahead present (in yychar) is if
954  this state is a consistent state with a default action. Thus,
955  detecting the absence of a lookahead is sufficient to determine
956  that there is no unexpected or expected token to report. In that
957  case, just report a simple "syntax error".
958  - Don't assume there isn't a lookahead just because this state is a
959  consistent state with a default action. There might have been a
960  previous inconsistent state, consistent state with a non-default
961  action, or user semantic action that manipulated yychar.
962  - Of course, the expected token list depends on states to have
963  correct lookahead information, and it depends on the parser not
964  to perform extra reductions after fetching a lookahead from the
965  scanner and before detecting a syntax error. Thus, state merging
966  (from LALR or IELR) and default reductions corrupt the expected
967  token list. However, the list is correct for canonical LR with
968  one exception: it will still contain any token that will not be
969  accepted due to an error action in a later state.
970  */
971  if (yytoken != YYEMPTY)
972  {
973  int yyn = yypact[*yyssp];
974  yyarg[yycount++] = yytname[yytoken];
975  if (!yypact_value_is_default (yyn))
976  {
977  /* Start YYX at -YYN if negative to avoid negative indexes in
978  YYCHECK. In other words, skip the first -YYN actions for
979  this state because they are default actions. */
980  int yyxbegin = yyn < 0 ? -yyn : 0;
981  /* Stay within bounds of both yycheck and yytname. */
982  int yychecklim = YYLAST - yyn + 1;
983  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
984  int yyx;
985 
986  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
987  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
988  && !yytable_value_is_error (yytable[yyx + yyn]))
989  {
990  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
991  {
992  yycount = 1;
993  yysize = yysize0;
994  break;
995  }
996  yyarg[yycount++] = yytname[yyx];
997  {
998  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
999  if (! (yysize <= yysize1
1000  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1001  return 2;
1002  yysize = yysize1;
1003  }
1004  }
1005  }
1006  }
1007 
1008  switch (yycount)
1009  {
1010 # define YYCASE_(N, S) \
1011  case N: \
1012  yyformat = S; \
1013  break
1014  YYCASE_(0, YY_("syntax error"));
1015  YYCASE_(1, YY_("syntax error, unexpected %s"));
1016  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1017  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1018  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1019  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1020 # undef YYCASE_
1021  }
1022 
1023  {
1024  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1025  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1026  return 2;
1027  yysize = yysize1;
1028  }
1029 
1030  if (*yymsg_alloc < yysize)
1031  {
1032  *yymsg_alloc = 2 * yysize;
1033  if (! (yysize <= *yymsg_alloc
1034  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1035  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1036  return 1;
1037  }
1038 
1039  /* Avoid sprintf, as that infringes on the user's name space.
1040  Don't have undefined behavior even if the translation
1041  produced a string with the wrong number of "%s"s. */
1042  {
1043  char *yyp = *yymsg;
1044  int yyi = 0;
1045  while ((*yyp = *yyformat) != '\0')
1046  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1047  {
1048  yyp += yytnamerr (yyp, yyarg[yyi++]);
1049  yyformat += 2;
1050  }
1051  else
1052  {
1053  yyp++;
1054  yyformat++;
1055  }
1056  }
1057  return 0;
1058 }
1059 #endif /* YYERROR_VERBOSE */
1060 
1061 /*-----------------------------------------------.
1062 | Release the memory associated to this symbol. |
1063 `-----------------------------------------------*/
1064 
1065 /*ARGSUSED*/
1066 #if (defined __STDC__ || defined __C99__FUNC__ \
1067  || defined __cplusplus || defined _MSC_VER)
1068 static void
1069 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, class drizzled::execute::Context *context, void *scanner)
1070 #else
1071 static void
1072 yydestruct (yymsg, yytype, yyvaluep, context, scanner)
1073  const char *yymsg;
1074  int yytype;
1075  YYSTYPE *yyvaluep;
1076  class drizzled::execute::Context *context;
1077  void *scanner;
1078 #endif
1079 {
1080  YYUSE (yyvaluep);
1081  YYUSE (context);
1082  YYUSE (scanner);
1083 
1084  if (!yymsg)
1085  yymsg = "Deleting";
1086  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1087 
1088  YYUSE (yytype);
1089 }
1090 
1091 
1092 
1093 
1094 /*----------.
1095 | yyparse. |
1096 `----------*/
1097 
1098 #ifdef YYPARSE_PARAM
1099 #if (defined __STDC__ || defined __C99__FUNC__ \
1100  || defined __cplusplus || defined _MSC_VER)
1101 int
1102 yyparse (void *YYPARSE_PARAM)
1103 #else
1104 int
1105 yyparse (YYPARSE_PARAM)
1106  void *YYPARSE_PARAM;
1107 #endif
1108 #else /* ! YYPARSE_PARAM */
1109 #if (defined __STDC__ || defined __C99__FUNC__ \
1110  || defined __cplusplus || defined _MSC_VER)
1111 int
1112 yyparse (class drizzled::execute::Context *context, void *scanner)
1113 #else
1114 int
1115 yyparse (context, scanner)
1116  class drizzled::execute::Context *context;
1117  void *scanner;
1118 #endif
1119 #endif
1120 {
1121 /* The lookahead symbol. */
1122 int yychar;
1123 
1124 
1125 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1126 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1127 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1128  _Pragma ("GCC diagnostic push") \
1129  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1130  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1131 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1132  _Pragma ("GCC diagnostic pop")
1133 #else
1134 /* Default value used for initialization, for pacifying older GCCs
1135  or non-GCC compilers. */
1136 static YYSTYPE yyval_default;
1137 # define YY_INITIAL_VALUE(Value) = Value
1138 #endif
1139 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1140 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1141 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1142 #endif
1143 #ifndef YY_INITIAL_VALUE
1144 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1145 #endif
1146 
1147 /* The semantic value of the lookahead symbol. */
1148 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1149 
1150  /* Number of syntax errors so far. */
1151  int yynerrs;
1152 
1153  int yystate;
1154  /* Number of tokens to shift before error messages enabled. */
1155  int yyerrstatus;
1156 
1157  /* The stacks and their tools:
1158  `yyss': related to states.
1159  `yyvs': related to semantic values.
1160 
1161  Refer to the stacks through separate pointers, to allow yyoverflow
1162  to reallocate them elsewhere. */
1163 
1164  /* The state stack. */
1165  yytype_int16 yyssa[YYINITDEPTH];
1166  yytype_int16 *yyss;
1167  yytype_int16 *yyssp;
1168 
1169  /* The semantic value stack. */
1170  YYSTYPE yyvsa[YYINITDEPTH];
1171  YYSTYPE *yyvs;
1172  YYSTYPE *yyvsp;
1173 
1174  YYSIZE_T yystacksize;
1175 
1176  int yyn;
1177  int yyresult;
1178  /* Lookahead token as an internal (translated) token number. */
1179  int yytoken = 0;
1180  /* The variables used to return semantic value and location from the
1181  action routines. */
1182  YYSTYPE yyval;
1183 
1184 #if YYERROR_VERBOSE
1185  /* Buffer for error messages, and its allocated size. */
1186  char yymsgbuf[128];
1187  char *yymsg = yymsgbuf;
1188  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1189 #endif
1190 
1191 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1192 
1193  /* The number of symbols on the RHS of the reduced rule.
1194  Keep to zero when no symbol should be popped. */
1195  int yylen = 0;
1196 
1197  yyssp = yyss = yyssa;
1198  yyvsp = yyvs = yyvsa;
1199  yystacksize = YYINITDEPTH;
1200 
1201  YYDPRINTF ((stderr, "Starting parse\n"));
1202 
1203  yystate = 0;
1204  yyerrstatus = 0;
1205  yynerrs = 0;
1206  yychar = YYEMPTY; /* Cause a token to be read. */
1207  goto yysetstate;
1208 
1209 /*------------------------------------------------------------.
1210 | yynewstate -- Push a new state, which is found in yystate. |
1211 `------------------------------------------------------------*/
1212  yynewstate:
1213  /* In all cases, when you get here, the value and location stacks
1214  have just been pushed. So pushing a state here evens the stacks. */
1215  yyssp++;
1216 
1217  yysetstate:
1218  *yyssp = yystate;
1219 
1220  if (yyss + yystacksize - 1 <= yyssp)
1221  {
1222  /* Get the current used size of the three stacks, in elements. */
1223  YYSIZE_T yysize = yyssp - yyss + 1;
1224 
1225 #ifdef yyoverflow
1226  {
1227  /* Give user a chance to reallocate the stack. Use copies of
1228  these so that the &'s don't force the real ones into
1229  memory. */
1230  YYSTYPE *yyvs1 = yyvs;
1231  yytype_int16 *yyss1 = yyss;
1232 
1233  /* Each stack pointer address is followed by the size of the
1234  data in use in that stack, in bytes. This used to be a
1235  conditional around just the two extra args, but that might
1236  be undefined if yyoverflow is a macro. */
1237  yyoverflow (YY_("memory exhausted"),
1238  &yyss1, yysize * sizeof (*yyssp),
1239  &yyvs1, yysize * sizeof (*yyvsp),
1240  &yystacksize);
1241 
1242  yyss = yyss1;
1243  yyvs = yyvs1;
1244  }
1245 #else /* no yyoverflow */
1246 # ifndef YYSTACK_RELOCATE
1247  goto yyexhaustedlab;
1248 # else
1249  /* Extend the stack our own way. */
1250  if (YYMAXDEPTH <= yystacksize)
1251  goto yyexhaustedlab;
1252  yystacksize *= 2;
1253  if (YYMAXDEPTH < yystacksize)
1254  yystacksize = YYMAXDEPTH;
1255 
1256  {
1257  yytype_int16 *yyss1 = yyss;
1258  union yyalloc *yyptr =
1259  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1260  if (! yyptr)
1261  goto yyexhaustedlab;
1262  YYSTACK_RELOCATE (yyss_alloc, yyss);
1263  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1264 # undef YYSTACK_RELOCATE
1265  if (yyss1 != yyssa)
1266  YYSTACK_FREE (yyss1);
1267  }
1268 # endif
1269 #endif /* no yyoverflow */
1270 
1271  yyssp = yyss + yysize - 1;
1272  yyvsp = yyvs + yysize - 1;
1273 
1274  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1275  (unsigned long int) yystacksize));
1276 
1277  if (yyss + yystacksize - 1 <= yyssp)
1278  YYABORT;
1279  }
1280 
1281  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1282 
1283  if (yystate == YYFINAL)
1284  YYACCEPT;
1285 
1286  goto yybackup;
1287 
1288 /*-----------.
1289 | yybackup. |
1290 `-----------*/
1291 yybackup:
1292 
1293  /* Do appropriate processing given the current state. Read a
1294  lookahead token if we need one and don't already have one. */
1295 
1296  /* First try to decide what to do without reference to lookahead token. */
1297  yyn = yypact[yystate];
1298  if (yypact_value_is_default (yyn))
1299  goto yydefault;
1300 
1301  /* Not known => get a lookahead token if don't already have one. */
1302 
1303  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1304  if (yychar == YYEMPTY)
1305  {
1306  YYDPRINTF ((stderr, "Reading a token: "));
1307  yychar = YYLEX;
1308  }
1309 
1310  if (yychar <= YYEOF)
1311  {
1312  yychar = yytoken = YYEOF;
1313  YYDPRINTF ((stderr, "Now at end of input.\n"));
1314  }
1315  else
1316  {
1317  yytoken = YYTRANSLATE (yychar);
1318  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1319  }
1320 
1321  /* If the proper action on seeing token YYTOKEN is to reduce or to
1322  detect an error, take that action. */
1323  yyn += yytoken;
1324  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1325  goto yydefault;
1326  yyn = yytable[yyn];
1327  if (yyn <= 0)
1328  {
1329  if (yytable_value_is_error (yyn))
1330  goto yyerrlab;
1331  yyn = -yyn;
1332  goto yyreduce;
1333  }
1334 
1335  /* Count tokens shifted since error; after three, turn off error
1336  status. */
1337  if (yyerrstatus)
1338  yyerrstatus--;
1339 
1340  /* Shift the lookahead token. */
1341  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1342 
1343  /* Discard the shifted token. */
1344  yychar = YYEMPTY;
1345 
1346  yystate = yyn;
1347  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1348  *++yyvsp = yylval;
1349  YY_IGNORE_MAYBE_UNINITIALIZED_END
1350 
1351  goto yynewstate;
1352 
1353 
1354 /*-----------------------------------------------------------.
1355 | yydefault -- do the default action for the current state. |
1356 `-----------------------------------------------------------*/
1357 yydefault:
1358  yyn = yydefact[yystate];
1359  if (yyn == 0)
1360  goto yyerrlab;
1361  goto yyreduce;
1362 
1363 
1364 /*-----------------------------.
1365 | yyreduce -- Do a reduction. |
1366 `-----------------------------*/
1367 yyreduce:
1368  /* yyn is the number of a rule to reduce with. */
1369  yylen = yyr2[yyn];
1370 
1371  /* If YYLEN is nonzero, implement the default value of the action:
1372  `$$ = $1'.
1373 
1374  Otherwise, the following line sets YYVAL to garbage.
1375  This behavior is undocumented and Bison
1376  users should not rely upon it. Assigning to YYVAL
1377  unconditionally makes the parser a bit smaller, and it avoids a
1378  GCC warning that YYVAL may be used uninitialized. */
1379  yyval = yyvsp[1-yylen];
1380 
1381 
1382  YY_REDUCE_PRINT (yyn);
1383  switch (yyn)
1384  {
1385  case 2:
1386 /* Line 1787 of yacc.c */
1387 #line 101 "drizzled/execute/parser.yy"
1388  {
1389  query.append((yyvsp[(1) - (1)].string).data(), (yyvsp[(1) - (1)].string).size());
1390  query.push_back(' ');
1391  }
1392  break;
1393 
1394  case 3:
1395 /* Line 1787 of yacc.c */
1396 #line 107 "drizzled/execute/parser.yy"
1397  {
1398  query.append((yyvsp[(2) - (2)].string).data(), (yyvsp[(2) - (2)].string).size());
1399  query.push_back(' ');
1400  }
1401  break;
1402 
1403 
1404 /* Line 1787 of yacc.c */
1405 #line 1406 "drizzled/execute/parser.cc"
1406  default: break;
1407  }
1408  /* User semantic actions sometimes alter yychar, and that requires
1409  that yytoken be updated with the new translation. We take the
1410  approach of translating immediately before every use of yytoken.
1411  One alternative is translating here after every semantic action,
1412  but that translation would be missed if the semantic action invokes
1413  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1414  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1415  incorrect destructor might then be invoked immediately. In the
1416  case of YYERROR or YYBACKUP, subsequent parser actions might lead
1417  to an incorrect destructor call or verbose syntax error message
1418  before the lookahead is translated. */
1419  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1420 
1421  YYPOPSTACK (yylen);
1422  yylen = 0;
1423  YY_STACK_PRINT (yyss, yyssp);
1424 
1425  *++yyvsp = yyval;
1426 
1427  /* Now `shift' the result of the reduction. Determine what state
1428  that goes to, based on the state we popped back to and the rule
1429  number reduced by. */
1430 
1431  yyn = yyr1[yyn];
1432 
1433  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1434  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1435  yystate = yytable[yystate];
1436  else
1437  yystate = yydefgoto[yyn - YYNTOKENS];
1438 
1439  goto yynewstate;
1440 
1441 
1442 /*------------------------------------.
1443 | yyerrlab -- here on detecting error |
1444 `------------------------------------*/
1445 yyerrlab:
1446  /* Make sure we have latest lookahead translation. See comments at
1447  user semantic actions for why this is necessary. */
1448  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1449 
1450  /* If not already recovering from an error, report this error. */
1451  if (!yyerrstatus)
1452  {
1453  ++yynerrs;
1454 #if ! YYERROR_VERBOSE
1455  yyerror (context, scanner, YY_("syntax error"));
1456 #else
1457 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1458  yyssp, yytoken)
1459  {
1460  char const *yymsgp = YY_("syntax error");
1461  int yysyntax_error_status;
1462  yysyntax_error_status = YYSYNTAX_ERROR;
1463  if (yysyntax_error_status == 0)
1464  yymsgp = yymsg;
1465  else if (yysyntax_error_status == 1)
1466  {
1467  if (yymsg != yymsgbuf)
1468  YYSTACK_FREE (yymsg);
1469  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1470  if (!yymsg)
1471  {
1472  yymsg = yymsgbuf;
1473  yymsg_alloc = sizeof yymsgbuf;
1474  yysyntax_error_status = 2;
1475  }
1476  else
1477  {
1478  yysyntax_error_status = YYSYNTAX_ERROR;
1479  yymsgp = yymsg;
1480  }
1481  }
1482  yyerror (context, scanner, yymsgp);
1483  if (yysyntax_error_status == 2)
1484  goto yyexhaustedlab;
1485  }
1486 # undef YYSYNTAX_ERROR
1487 #endif
1488  }
1489 
1490 
1491 
1492  if (yyerrstatus == 3)
1493  {
1494  /* If just tried and failed to reuse lookahead token after an
1495  error, discard it. */
1496 
1497  if (yychar <= YYEOF)
1498  {
1499  /* Return failure if at end of input. */
1500  if (yychar == YYEOF)
1501  YYABORT;
1502  }
1503  else
1504  {
1505  yydestruct ("Error: discarding",
1506  yytoken, &yylval, context, scanner);
1507  yychar = YYEMPTY;
1508  }
1509  }
1510 
1511  /* Else will try to reuse lookahead token after shifting the error
1512  token. */
1513  goto yyerrlab1;
1514 
1515 
1516 /*---------------------------------------------------.
1517 | yyerrorlab -- error raised explicitly by YYERROR. |
1518 `---------------------------------------------------*/
1519 yyerrorlab:
1520 
1521  /* Pacify compilers like GCC when the user code never invokes
1522  YYERROR and the label yyerrorlab therefore never appears in user
1523  code. */
1524  if (/*CONSTCOND*/ 0)
1525  goto yyerrorlab;
1526 
1527  /* Do not reclaim the symbols of the rule which action triggered
1528  this YYERROR. */
1529  YYPOPSTACK (yylen);
1530  yylen = 0;
1531  YY_STACK_PRINT (yyss, yyssp);
1532  yystate = *yyssp;
1533  goto yyerrlab1;
1534 
1535 
1536 /*-------------------------------------------------------------.
1537 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1538 `-------------------------------------------------------------*/
1539 yyerrlab1:
1540  yyerrstatus = 3; /* Each real token shifted decrements this. */
1541 
1542  for (;;)
1543  {
1544  yyn = yypact[yystate];
1545  if (!yypact_value_is_default (yyn))
1546  {
1547  yyn += YYTERROR;
1548  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1549  {
1550  yyn = yytable[yyn];
1551  if (0 < yyn)
1552  break;
1553  }
1554  }
1555 
1556  /* Pop the current state because it cannot handle the error token. */
1557  if (yyssp == yyss)
1558  YYABORT;
1559 
1560 
1561  yydestruct ("Error: popping",
1562  yystos[yystate], yyvsp, context, scanner);
1563  YYPOPSTACK (1);
1564  yystate = *yyssp;
1565  YY_STACK_PRINT (yyss, yyssp);
1566  }
1567 
1568  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1569  *++yyvsp = yylval;
1570  YY_IGNORE_MAYBE_UNINITIALIZED_END
1571 
1572 
1573  /* Shift the error token. */
1574  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1575 
1576  yystate = yyn;
1577  goto yynewstate;
1578 
1579 
1580 /*-------------------------------------.
1581 | yyacceptlab -- YYACCEPT comes here. |
1582 `-------------------------------------*/
1583 yyacceptlab:
1584  yyresult = 0;
1585  goto yyreturn;
1586 
1587 /*-----------------------------------.
1588 | yyabortlab -- YYABORT comes here. |
1589 `-----------------------------------*/
1590 yyabortlab:
1591  yyresult = 1;
1592  goto yyreturn;
1593 
1594 #if !defined yyoverflow || YYERROR_VERBOSE
1595 /*-------------------------------------------------.
1596 | yyexhaustedlab -- memory exhaustion comes here. |
1597 `-------------------------------------------------*/
1598 yyexhaustedlab:
1599  yyerror (context, scanner, YY_("memory exhausted"));
1600  yyresult = 2;
1601  /* Fall through. */
1602 #endif
1603 
1604 yyreturn:
1605  if (yychar != YYEMPTY)
1606  {
1607  /* Make sure we have latest lookahead translation. See comments at
1608  user semantic actions for why this is necessary. */
1609  yytoken = YYTRANSLATE (yychar);
1610  yydestruct ("Cleanup: discarding lookahead",
1611  yytoken, &yylval, context, scanner);
1612  }
1613  /* Do not reclaim the symbols of the rule which action triggered
1614  this YYABORT or YYACCEPT. */
1615  YYPOPSTACK (yylen);
1616  YY_STACK_PRINT (yyss, yyssp);
1617  while (yyssp != yyss)
1618  {
1619  yydestruct ("Cleanup: popping",
1620  yystos[*yyssp], yyvsp, context, scanner);
1621  YYPOPSTACK (1);
1622  }
1623 #ifndef yyoverflow
1624  if (yyss != yyssa)
1625  YYSTACK_FREE (yyss);
1626 #endif
1627 #if YYERROR_VERBOSE
1628  if (yymsg != yymsgbuf)
1629  YYSTACK_FREE (yymsg);
1630 #endif
1631  /* Make sure YYID is used. */
1632  return YYID (yyresult);
1633 }
1634 
1635 
1636 /* Line 2050 of yacc.c */
1637 #line 114 "drizzled/execute/parser.yy"
1638 
1639 
1640 
1641 namespace drizzled {
1642 namespace execute {
1643 
1644 std::vector<std::string> Context::start()
1645 {
1646  execute_parse(this, (void **)scanner);
1647  std::vector<std::string> parsed_queries;
1648  size_t start_pos= 0;
1649  while ((pos= query.find(';', start_pos)) != std::string::npos)
1650  {
1651  if ((pos > 0) && (query[pos-1] == '\\'))
1652  {
1653  start_pos= pos + 1;
1654  continue;
1655  }
1656  parsed_queries.push_back(query.substr(0, pos));
1657  pos++;
1658  if (query[pos] == ' ')
1659  {
1660  pos++;
1661  }
1662  query.erase(0, pos);
1663  }
1664  parsed_queries.push_back(query);
1665  query.clear();
1666 
1667  return parsed_queries;
1668 }
1669 
1670 } // namespace execute
1671 } // namespace drizzled