Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.8.2. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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, and Bison version. */
49 : #define YYBISON 30802
50 :
51 : /* Bison version string. */
52 : #define YYBISON_VERSION "3.8.2"
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 :
67 : /* Substitute the variable and function names. */
68 : #define yyparse swqparse
69 : #define yylex swqlex
70 : #define yyerror swqerror
71 : #define yydebug swqdebug
72 : #define yynerrs swqnerrs
73 :
74 : /* First part of user prologue. */
75 :
76 : /******************************************************************************
77 : *
78 : * Component: OGR SQL Engine
79 : * Purpose: expression and select parser grammar.
80 : * Requires Bison 2.4.0 or newer to process. Use "make parser" target.
81 : * Author: Frank Warmerdam <warmerdam@pobox.com>
82 : *
83 : ******************************************************************************
84 : * Copyright (C) 2010 Frank Warmerdam <warmerdam@pobox.com>
85 : *
86 : * SPDX-License-Identifier: MIT
87 : ****************************************************************************/
88 :
89 : #include "cpl_port.h"
90 : #include "ogr_swq.h"
91 :
92 : #include <cstdlib>
93 : #include <cstring>
94 : #include <limits>
95 :
96 : #include "cpl_conv.h"
97 : #include "cpl_error.h"
98 : #include "cpl_string.h"
99 : #include "ogr_core.h"
100 : #include "ogr_geometry.h"
101 :
102 :
103 : #define YYSTYPE swq_expr_node *
104 :
105 : /* Defining YYSTYPE_IS_TRIVIAL is needed because the parser is generated as a C++ file. */
106 : /* See http://www.gnu.org/s/bison/manual/html_node/Memory-Management.html that suggests */
107 : /* increase YYINITDEPTH instead, but this will consume memory. */
108 : /* Setting YYSTYPE_IS_TRIVIAL overcomes this limitation, but might be fragile because */
109 : /* it appears to be a non documented feature of Bison */
110 : #define YYSTYPE_IS_TRIVIAL 1
111 :
112 :
113 : # ifndef YY_CAST
114 : # ifdef __cplusplus
115 : # define YY_CAST(Type, Val) static_cast<Type> (Val)
116 : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
117 : # else
118 : # define YY_CAST(Type, Val) ((Type) (Val))
119 : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
120 : # endif
121 : # endif
122 : # ifndef YY_NULLPTR
123 : # if defined __cplusplus
124 : # if 201103L <= __cplusplus
125 : # define YY_NULLPTR nullptr
126 : # else
127 : # define YY_NULLPTR 0
128 : # endif
129 : # else
130 : # define YY_NULLPTR ((void*)0)
131 : # endif
132 : # endif
133 :
134 : #include "swq_parser.hpp"
135 : /* Symbol kind. */
136 : enum yysymbol_kind_t
137 : {
138 : YYSYMBOL_YYEMPTY = -2,
139 : YYSYMBOL_YYEOF = 0, /* "end of string" */
140 : YYSYMBOL_YYerror = 1, /* error */
141 : YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
142 : YYSYMBOL_SWQT_INTEGER_NUMBER = 3, /* "integer number" */
143 : YYSYMBOL_SWQT_FLOAT_NUMBER = 4, /* "floating point number" */
144 : YYSYMBOL_SWQT_STRING = 5, /* "string" */
145 : YYSYMBOL_SWQT_IDENTIFIER = 6, /* "identifier" */
146 : YYSYMBOL_SWQT_IN = 7, /* "IN" */
147 : YYSYMBOL_SWQT_LIKE = 8, /* "LIKE" */
148 : YYSYMBOL_SWQT_ILIKE = 9, /* "ILIKE" */
149 : YYSYMBOL_SWQT_ESCAPE = 10, /* "ESCAPE" */
150 : YYSYMBOL_SWQT_BETWEEN = 11, /* "BETWEEN" */
151 : YYSYMBOL_SWQT_NULL = 12, /* "NULL" */
152 : YYSYMBOL_SWQT_IS = 13, /* "IS" */
153 : YYSYMBOL_SWQT_SELECT = 14, /* "SELECT" */
154 : YYSYMBOL_SWQT_LEFT = 15, /* "LEFT" */
155 : YYSYMBOL_SWQT_JOIN = 16, /* "JOIN" */
156 : YYSYMBOL_SWQT_WHERE = 17, /* "WHERE" */
157 : YYSYMBOL_SWQT_ON = 18, /* "ON" */
158 : YYSYMBOL_SWQT_ORDER = 19, /* "ORDER" */
159 : YYSYMBOL_SWQT_BY = 20, /* "BY" */
160 : YYSYMBOL_SWQT_FROM = 21, /* "FROM" */
161 : YYSYMBOL_SWQT_AS = 22, /* "AS" */
162 : YYSYMBOL_SWQT_ASC = 23, /* "ASC" */
163 : YYSYMBOL_SWQT_DESC = 24, /* "DESC" */
164 : YYSYMBOL_SWQT_DISTINCT = 25, /* "DISTINCT" */
165 : YYSYMBOL_SWQT_CAST = 26, /* "CAST" */
166 : YYSYMBOL_SWQT_UNION = 27, /* "UNION" */
167 : YYSYMBOL_SWQT_ALL = 28, /* "ALL" */
168 : YYSYMBOL_SWQT_LIMIT = 29, /* "LIMIT" */
169 : YYSYMBOL_SWQT_OFFSET = 30, /* "OFFSET" */
170 : YYSYMBOL_SWQT_EXCEPT = 31, /* "EXCEPT" */
171 : YYSYMBOL_SWQT_EXCLUDE = 32, /* "EXCLUDE" */
172 : YYSYMBOL_SWQT_HIDDEN = 33, /* "HIDDEN" */
173 : YYSYMBOL_SWQT_VALUE_START = 34, /* SWQT_VALUE_START */
174 : YYSYMBOL_SWQT_SELECT_START = 35, /* SWQT_SELECT_START */
175 : YYSYMBOL_SWQT_NOT = 36, /* "NOT" */
176 : YYSYMBOL_SWQT_OR = 37, /* "OR" */
177 : YYSYMBOL_SWQT_AND = 38, /* "AND" */
178 : YYSYMBOL_39_ = 39, /* '=' */
179 : YYSYMBOL_40_ = 40, /* '<' */
180 : YYSYMBOL_41_ = 41, /* '>' */
181 : YYSYMBOL_42_ = 42, /* '!' */
182 : YYSYMBOL_43_ = 43, /* '+' */
183 : YYSYMBOL_44_ = 44, /* '-' */
184 : YYSYMBOL_45_ = 45, /* '*' */
185 : YYSYMBOL_46_ = 46, /* '/' */
186 : YYSYMBOL_47_ = 47, /* '%' */
187 : YYSYMBOL_SWQT_UMINUS = 48, /* SWQT_UMINUS */
188 : YYSYMBOL_SWQT_RESERVED_KEYWORD = 49, /* "reserved keyword" */
189 : YYSYMBOL_50_ = 50, /* '(' */
190 : YYSYMBOL_51_ = 51, /* ')' */
191 : YYSYMBOL_52_ = 52, /* ',' */
192 : YYSYMBOL_53_ = 53, /* '.' */
193 : YYSYMBOL_YYACCEPT = 54, /* $accept */
194 : YYSYMBOL_input = 55, /* input */
195 : YYSYMBOL_value_expr = 56, /* value_expr */
196 : YYSYMBOL_value_expr_list = 57, /* value_expr_list */
197 : YYSYMBOL_identifier = 58, /* identifier */
198 : YYSYMBOL_field_value = 59, /* field_value */
199 : YYSYMBOL_value_expr_non_logical = 60, /* value_expr_non_logical */
200 : YYSYMBOL_type_def = 61, /* type_def */
201 : YYSYMBOL_select_statement = 62, /* select_statement */
202 : YYSYMBOL_select_core = 63, /* select_core */
203 : YYSYMBOL_opt_union_all = 64, /* opt_union_all */
204 : YYSYMBOL_union_all = 65, /* union_all */
205 : YYSYMBOL_select_field_list = 66, /* select_field_list */
206 : YYSYMBOL_exclude_field = 67, /* exclude_field */
207 : YYSYMBOL_exclude_field_list = 68, /* exclude_field_list */
208 : YYSYMBOL_except_or_exclude = 69, /* except_or_exclude */
209 : YYSYMBOL_column_spec = 70, /* column_spec */
210 : YYSYMBOL_as_clause = 71, /* as_clause */
211 : YYSYMBOL_as_clause_with_hidden = 72, /* as_clause_with_hidden */
212 : YYSYMBOL_opt_where = 73, /* opt_where */
213 : YYSYMBOL_opt_joins = 74, /* opt_joins */
214 : YYSYMBOL_opt_order_by = 75, /* opt_order_by */
215 : YYSYMBOL_sort_spec_list = 76, /* sort_spec_list */
216 : YYSYMBOL_sort_spec = 77, /* sort_spec */
217 : YYSYMBOL_opt_limit = 78, /* opt_limit */
218 : YYSYMBOL_opt_offset = 79, /* opt_offset */
219 : YYSYMBOL_table_def = 80 /* table_def */
220 : };
221 : typedef enum yysymbol_kind_t yysymbol_kind_t;
222 :
223 :
224 :
225 :
226 : #ifdef short
227 : # undef short
228 : #endif
229 :
230 : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
231 : <limits.h> and (if available) <stdint.h> are included
232 : so that the code can choose integer types of a good width. */
233 :
234 : #ifndef __PTRDIFF_MAX__
235 : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
236 : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
237 : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
238 : # define YY_STDINT_H
239 : # endif
240 : #endif
241 :
242 : /* Narrow types that promote to a signed type and that can represent a
243 : signed or unsigned integer of at least N bits. In tables they can
244 : save space and decrease cache pressure. Promoting to a signed type
245 : helps avoid bugs in integer arithmetic. */
246 :
247 : #ifdef __INT_LEAST8_MAX__
248 : typedef __INT_LEAST8_TYPE__ yytype_int8;
249 : #elif defined YY_STDINT_H
250 : typedef int_least8_t yytype_int8;
251 : #else
252 : typedef signed char yytype_int8;
253 : #endif
254 :
255 : #ifdef __INT_LEAST16_MAX__
256 : typedef __INT_LEAST16_TYPE__ yytype_int16;
257 : #elif defined YY_STDINT_H
258 : typedef int_least16_t yytype_int16;
259 : #else
260 : typedef short yytype_int16;
261 : #endif
262 :
263 : /* Work around bug in HP-UX 11.23, which defines these macros
264 : incorrectly for preprocessor constants. This workaround can likely
265 : be removed in 2023, as HPE has promised support for HP-UX 11.23
266 : (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
267 : <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
268 : #ifdef __hpux
269 : # undef UINT_LEAST8_MAX
270 : # undef UINT_LEAST16_MAX
271 : # define UINT_LEAST8_MAX 255
272 : # define UINT_LEAST16_MAX 65535
273 : #endif
274 :
275 : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
276 : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
277 : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
278 : && UINT_LEAST8_MAX <= INT_MAX)
279 : typedef uint_least8_t yytype_uint8;
280 : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
281 : typedef unsigned char yytype_uint8;
282 : #else
283 : typedef short yytype_uint8;
284 : #endif
285 :
286 : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
287 : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
288 : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
289 : && UINT_LEAST16_MAX <= INT_MAX)
290 : typedef uint_least16_t yytype_uint16;
291 : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
292 : typedef unsigned short yytype_uint16;
293 : #else
294 : typedef int yytype_uint16;
295 : #endif
296 :
297 : #ifndef YYPTRDIFF_T
298 : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
299 : # define YYPTRDIFF_T __PTRDIFF_TYPE__
300 : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
301 : # elif defined PTRDIFF_MAX
302 : # ifndef ptrdiff_t
303 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
304 : # endif
305 : # define YYPTRDIFF_T ptrdiff_t
306 : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
307 : # else
308 : # define YYPTRDIFF_T long
309 : # define YYPTRDIFF_MAXIMUM LONG_MAX
310 : # endif
311 : #endif
312 :
313 : #ifndef YYSIZE_T
314 : # ifdef __SIZE_TYPE__
315 : # define YYSIZE_T __SIZE_TYPE__
316 : # elif defined size_t
317 : # define YYSIZE_T size_t
318 : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
319 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
320 : # define YYSIZE_T size_t
321 : # else
322 : # define YYSIZE_T unsigned
323 : # endif
324 : #endif
325 :
326 : #define YYSIZE_MAXIMUM \
327 : YY_CAST (YYPTRDIFF_T, \
328 : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
329 : ? YYPTRDIFF_MAXIMUM \
330 : : YY_CAST (YYSIZE_T, -1)))
331 :
332 : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
333 :
334 :
335 : /* Stored state numbers (used for stacks). */
336 : typedef yytype_uint8 yy_state_t;
337 :
338 : /* State numbers in computations. */
339 : typedef int yy_state_fast_t;
340 :
341 : #ifndef YY_
342 : # if defined YYENABLE_NLS && YYENABLE_NLS
343 : # if ENABLE_NLS
344 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
345 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
346 : # endif
347 : # endif
348 : # ifndef YY_
349 : # define YY_(Msgid) Msgid
350 : # endif
351 : #endif
352 :
353 :
354 : #ifndef YY_ATTRIBUTE_PURE
355 : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
356 : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
357 : # else
358 : # define YY_ATTRIBUTE_PURE
359 : # endif
360 : #endif
361 :
362 : #ifndef YY_ATTRIBUTE_UNUSED
363 : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
364 : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
365 : # else
366 : # define YY_ATTRIBUTE_UNUSED
367 : # endif
368 : #endif
369 :
370 : /* Suppress unused-variable warnings by "using" E. */
371 : #if ! defined lint || defined __GNUC__
372 : # define YY_USE(E) ((void) (E))
373 : #else
374 : # define YY_USE(E) /* empty */
375 : #endif
376 :
377 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
378 : #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
379 : # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
380 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
381 : _Pragma ("GCC diagnostic push") \
382 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
383 : # else
384 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
385 : _Pragma ("GCC diagnostic push") \
386 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
387 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
388 : # endif
389 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
390 : _Pragma ("GCC diagnostic pop")
391 : #else
392 : # define YY_INITIAL_VALUE(Value) Value
393 : #endif
394 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
395 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
396 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
397 : #endif
398 : #ifndef YY_INITIAL_VALUE
399 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
400 : #endif
401 :
402 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
403 : # define YY_IGNORE_USELESS_CAST_BEGIN \
404 : _Pragma ("GCC diagnostic push") \
405 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
406 : # define YY_IGNORE_USELESS_CAST_END \
407 : _Pragma ("GCC diagnostic pop")
408 : #endif
409 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
410 : # define YY_IGNORE_USELESS_CAST_BEGIN
411 : # define YY_IGNORE_USELESS_CAST_END
412 : #endif
413 :
414 :
415 : #define YY_ASSERT(E) ((void) (0 && (E)))
416 :
417 : #if 1
418 :
419 : /* The parser invokes alloca or malloc; define the necessary symbols. */
420 :
421 : # ifdef YYSTACK_USE_ALLOCA
422 : # if YYSTACK_USE_ALLOCA
423 : # ifdef __GNUC__
424 : # define YYSTACK_ALLOC __builtin_alloca
425 : # elif defined __BUILTIN_VA_ARG_INCR
426 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
427 : # elif defined _AIX
428 : # define YYSTACK_ALLOC __alloca
429 : # elif defined _MSC_VER
430 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
431 : # define alloca _alloca
432 : # else
433 : # define YYSTACK_ALLOC alloca
434 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
435 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
436 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
437 : # ifndef EXIT_SUCCESS
438 : # define EXIT_SUCCESS 0
439 : # endif
440 : # endif
441 : # endif
442 : # endif
443 : # endif
444 :
445 : # ifdef YYSTACK_ALLOC
446 : /* Pacify GCC's 'empty if-body' warning. */
447 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
448 : # ifndef YYSTACK_ALLOC_MAXIMUM
449 : /* The OS might guarantee only one guard page at the bottom of the stack,
450 : and a page size can be as small as 4096 bytes. So we cannot safely
451 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
452 : to allow for a few compiler-allocated temporary stack slots. */
453 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
454 : # endif
455 : # else
456 : # define YYSTACK_ALLOC YYMALLOC
457 : # define YYSTACK_FREE YYFREE
458 : # ifndef YYSTACK_ALLOC_MAXIMUM
459 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
460 : # endif
461 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
462 : && ! ((defined YYMALLOC || defined malloc) \
463 : && (defined YYFREE || defined free)))
464 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
465 : # ifndef EXIT_SUCCESS
466 : # define EXIT_SUCCESS 0
467 : # endif
468 : # endif
469 : # ifndef YYMALLOC
470 : # define YYMALLOC malloc
471 : # if ! defined malloc && ! defined EXIT_SUCCESS
472 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
473 : # endif
474 : # endif
475 : # ifndef YYFREE
476 : # define YYFREE free
477 : # if ! defined free && ! defined EXIT_SUCCESS
478 : void free (void *); /* INFRINGES ON USER NAME SPACE */
479 : # endif
480 : # endif
481 : # endif
482 : #endif /* 1 */
483 :
484 : #if (! defined yyoverflow \
485 : && (! defined __cplusplus \
486 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
487 :
488 : /* A type that is properly aligned for any stack member. */
489 : union yyalloc
490 : {
491 : yy_state_t yyss_alloc;
492 : YYSTYPE yyvs_alloc;
493 : };
494 :
495 : /* The size of the maximum gap between one aligned stack and the next. */
496 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
497 :
498 : /* The size of an array large to enough to hold all stacks, each with
499 : N elements. */
500 : # define YYSTACK_BYTES(N) \
501 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
502 : + YYSTACK_GAP_MAXIMUM)
503 :
504 : # define YYCOPY_NEEDED 1
505 :
506 : /* Relocate STACK from its old location to the new one. The
507 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
508 : elements in the stack, and YYPTR gives the new location of the
509 : stack. Advance YYPTR to a properly aligned location for the next
510 : stack. */
511 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
512 : do \
513 : { \
514 : YYPTRDIFF_T yynewbytes; \
515 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
516 : Stack = &yyptr->Stack_alloc; \
517 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
518 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
519 : } \
520 : while (0)
521 :
522 : #endif
523 :
524 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
525 : /* Copy COUNT objects from SRC to DST. The source and destination do
526 : not overlap. */
527 : # ifndef YYCOPY
528 : # if defined __GNUC__ && 1 < __GNUC__
529 : # define YYCOPY(Dst, Src, Count) \
530 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
531 : # else
532 : # define YYCOPY(Dst, Src, Count) \
533 : do \
534 : { \
535 : YYPTRDIFF_T yyi; \
536 : for (yyi = 0; yyi < (Count); yyi++) \
537 : (Dst)[yyi] = (Src)[yyi]; \
538 : } \
539 : while (0)
540 : # endif
541 : # endif
542 : #endif /* !YYCOPY_NEEDED */
543 :
544 : /* YYFINAL -- State number of the termination state. */
545 : #define YYFINAL 22
546 : /* YYLAST -- Last index in YYTABLE. */
547 : #define YYLAST 469
548 :
549 : /* YYNTOKENS -- Number of terminals. */
550 : #define YYNTOKENS 54
551 : /* YYNNTS -- Number of nonterminals. */
552 : #define YYNNTS 27
553 : /* YYNRULES -- Number of rules. */
554 : #define YYNRULES 105
555 : /* YYNSTATES -- Number of states. */
556 : #define YYNSTATES 215
557 :
558 : /* YYMAXUTOK -- Last valid token kind. */
559 : #define YYMAXUTOK 295
560 :
561 :
562 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
563 : as returned by yylex, with out-of-bounds checking. */
564 : #define YYTRANSLATE(YYX) \
565 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
566 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
567 : : YYSYMBOL_YYUNDEF)
568 :
569 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
570 : as returned by yylex. */
571 : static const yytype_int8 yytranslate[] =
572 : {
573 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 : 2, 2, 2, 42, 2, 2, 2, 47, 2, 2,
577 : 50, 51, 45, 43, 52, 44, 53, 46, 2, 2,
578 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 : 40, 39, 41, 2, 2, 2, 2, 2, 2, 2,
580 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
599 : 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
600 : 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
601 : 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
602 : 35, 36, 37, 38, 48, 49
603 : };
604 :
605 : #if YYDEBUG
606 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
607 : static const yytype_int16 yyrline[] =
608 : {
609 : 0, 109, 109, 110, 116, 123, 128, 133, 138, 145,
610 : 153, 161, 169, 177, 185, 193, 201, 209, 217, 225,
611 : 237, 246, 259, 267, 279, 288, 301, 310, 323, 332,
612 : 345, 352, 364, 370, 377, 379, 382, 390, 403, 408,
613 : 413, 417, 422, 427, 432, 467, 474, 481, 488, 495,
614 : 502, 538, 546, 552, 559, 568, 586, 606, 607, 610,
615 : 615, 621, 622, 624, 632, 633, 636, 646, 647, 650,
616 : 651, 654, 663, 674, 689, 704, 725, 756, 791, 816,
617 : 845, 851, 854, 856, 865, 866, 871, 872, 878, 885,
618 : 886, 889, 890, 893, 899, 905, 912, 913, 920, 921,
619 : 929, 939, 950, 961, 974, 985
620 : };
621 : #endif
622 :
623 : /** Accessing symbol of state STATE. */
624 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
625 :
626 : #if 0
627 : /* The user-facing name of the symbol whose (internal) number is
628 : YYSYMBOL. No bounds checking. */
629 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
630 : #endif
631 :
632 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
633 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
634 : static const char *const yytname[] =
635 : {
636 : "\"end of string\"", "error", "\"invalid token\"", "\"integer number\"",
637 : "\"floating point number\"", "\"string\"", "\"identifier\"", "\"IN\"",
638 : "\"LIKE\"", "\"ILIKE\"", "\"ESCAPE\"", "\"BETWEEN\"", "\"NULL\"",
639 : "\"IS\"", "\"SELECT\"", "\"LEFT\"", "\"JOIN\"", "\"WHERE\"", "\"ON\"",
640 : "\"ORDER\"", "\"BY\"", "\"FROM\"", "\"AS\"", "\"ASC\"", "\"DESC\"",
641 : "\"DISTINCT\"", "\"CAST\"", "\"UNION\"", "\"ALL\"", "\"LIMIT\"",
642 : "\"OFFSET\"", "\"EXCEPT\"", "\"EXCLUDE\"", "\"HIDDEN\"",
643 : "SWQT_VALUE_START", "SWQT_SELECT_START", "\"NOT\"", "\"OR\"", "\"AND\"",
644 : "'='", "'<'", "'>'", "'!'", "'+'", "'-'", "'*'", "'/'", "'%'",
645 : "SWQT_UMINUS", "\"reserved keyword\"", "'('", "')'", "','", "'.'",
646 : "$accept", "input", "value_expr", "value_expr_list", "identifier",
647 : "field_value", "value_expr_non_logical", "type_def", "select_statement",
648 : "select_core", "opt_union_all", "union_all", "select_field_list",
649 : "exclude_field", "exclude_field_list", "except_or_exclude",
650 : "column_spec", "as_clause", "as_clause_with_hidden", "opt_where",
651 : "opt_joins", "opt_order_by", "sort_spec_list", "sort_spec", "opt_limit",
652 : "opt_offset", "table_def", YY_NULLPTR
653 : };
654 :
655 : #if 0
656 : static const char *
657 : yysymbol_name (yysymbol_kind_t yysymbol)
658 : {
659 : return yytname[yysymbol];
660 : }
661 : #endif
662 :
663 : #define YYPACT_NINF (-136)
664 :
665 : #define yypact_value_is_default(Yyn) \
666 : ((Yyn) == YYPACT_NINF)
667 :
668 : #define YYTABLE_NINF (-1)
669 :
670 : #define yytable_value_is_error(Yyn) \
671 : 0
672 :
673 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
674 : STATE-NUM. */
675 : static const yytype_int16 yypact[] =
676 : {
677 : 66, 93, -13, 11, -136, -136, -136, -136, -136, -24,
678 : -136, 93, 292, 93, 413, -34, -136, 174, 136, 21,
679 : -136, 30, -136, 93, 427, -136, 315, -9, 93, 93,
680 : 292, 2, 116, 93, 93, 172, 197, 239, 25, 93,
681 : 0, 292, 292, 292, 292, 292, 258, 84, 356, -32,
682 : 27, 19, 23, 48, -136, -13, 377, -136, 93, 73,
683 : 75, 145, -136, 92, 57, 93, 93, 292, 420, 298,
684 : 93, 93, -136, 93, 93, -136, 93, -136, 93, 308,
685 : 62, -136, -22, -22, -136, -136, -136, 107, -136, -136,
686 : 72, 0, -136, 111, -136, 223, 14, 7, 258, 30,
687 : -136, -136, 0, 95, 93, 93, 292, -136, 93, 144,
688 : 149, 399, -136, -136, -136, -136, -136, -136, 93, -136,
689 : 7, 0, -136, -136, 0, 109, -136, 110, 55, 102,
690 : -136, -136, 114, 115, -136, -136, -136, 174, 117, 93,
691 : 93, 292, -136, 102, 118, -136, 121, 119, 128, 9,
692 : 0, 0, -136, 151, 7, 165, -1, -136, -136, -136,
693 : -136, 174, 165, 0, -136, 9, -136, 9, 9, 7,
694 : 167, 93, 176, 83, 101, 176, -136, -136, -136, -136,
695 : 175, 93, 413, 179, 178, -136, 193, -136, 201, 178,
696 : 93, 364, 0, 207, 181, 163, 164, 181, 364, -136,
697 : 134, -136, 173, -136, 221, -136, -136, -136, -136, -136,
698 : -136, -136, 0, -136, -136
699 : };
700 :
701 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
702 : Performed when YYTABLE does not specify something else to do. Zero
703 : means the default is an error. */
704 : static const yytype_int8 yydefact[] =
705 : {
706 : 2, 0, 0, 0, 38, 39, 40, 34, 43, 0,
707 : 35, 0, 0, 0, 3, 36, 41, 5, 0, 0,
708 : 4, 61, 1, 0, 8, 44, 0, 0, 0, 0,
709 : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
710 : 0, 0, 0, 0, 0, 0, 0, 74, 71, 36,
711 : 0, 64, 0, 0, 57, 0, 0, 42, 0, 18,
712 : 22, 0, 30, 0, 0, 0, 0, 0, 7, 6,
713 : 0, 0, 9, 0, 0, 12, 0, 13, 0, 33,
714 : 0, 37, 45, 46, 47, 48, 49, 0, 69, 70,
715 : 0, 0, 81, 82, 72, 0, 0, 0, 0, 61,
716 : 63, 62, 0, 0, 0, 0, 0, 31, 0, 19,
717 : 23, 0, 15, 16, 14, 10, 17, 11, 0, 50,
718 : 0, 0, 80, 83, 0, 0, 75, 0, 100, 86,
719 : 65, 58, 52, 0, 26, 20, 24, 28, 0, 0,
720 : 0, 0, 32, 86, 36, 66, 67, 0, 0, 76,
721 : 0, 0, 101, 0, 0, 84, 0, 51, 27, 21,
722 : 25, 29, 84, 0, 73, 78, 77, 102, 104, 0,
723 : 0, 0, 89, 0, 0, 89, 68, 79, 103, 105,
724 : 0, 0, 85, 0, 96, 53, 0, 55, 0, 96,
725 : 0, 86, 0, 0, 98, 0, 0, 98, 86, 87,
726 : 93, 90, 92, 97, 0, 59, 54, 56, 60, 88,
727 : 94, 95, 0, 99, 91
728 : };
729 :
730 : /* YYPGOTO[NTERM-NUM]. */
731 : static const yytype_int16 yypgoto[] =
732 : {
733 : -136, -136, 16, -48, -18, -117, 24, -136, 177, 212,
734 : 135, -136, -43, -136, 74, -136, -136, -56, -136, 77,
735 : -135, 65, 34, -136, 61, 56, -111
736 : };
737 :
738 : /* YYDEFGOTO[NTERM-NUM]. */
739 : static const yytype_uint8 yydefgoto[] =
740 : {
741 : 0, 3, 79, 80, 15, 16, 17, 133, 20, 21,
742 : 54, 55, 50, 146, 147, 90, 51, 93, 94, 172,
743 : 155, 184, 201, 202, 194, 205, 129
744 : };
745 :
746 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
747 : positive, shift that token. If negative, reduce the rule whose
748 : number is the opposite. If YYTABLE_NINF, syntax error. */
749 : static const yytype_uint8 yytable[] =
750 : {
751 : 49, 18, 173, 87, 145, 7, 7, 148, 162, 143,
752 : 103, 22, 127, 7, 62, 7, 39, 14, 95, 40,
753 : 7, 96, 81, 43, 44, 45, 23, 24, 49, 26,
754 : 92, 91, 10, 10, 48, 18, 25, 19, 63, 56,
755 : 10, 58, 10, 170, 59, 60, 145, 10, 97, 68,
756 : 69, 72, 75, 77, 61, 130, 199, 53, 180, 126,
757 : 138, 7, 48, 209, 78, 82, 83, 84, 85, 86,
758 : 142, 98, 152, 122, 99, 200, 100, 91, 81, 128,
759 : 49, 109, 110, 104, 132, 105, 112, 113, 10, 114,
760 : 115, 111, 116, 166, 117, 200, 4, 5, 6, 7,
761 : 1, 2, 128, 144, 107, 8, 144, 108, 151, 177,
762 : 92, 178, 179, 119, 48, 88, 89, 153, 154, 9,
763 : 135, 136, 121, 64, 65, 66, 10, 67, 120, 11,
764 : 137, 92, 167, 168, 185, 186, 128, 12, 174, 4,
765 : 5, 6, 7, 13, 123, 144, 134, 92, 8, 92,
766 : 92, 128, 187, 188, 139, 159, 160, 210, 211, 140,
767 : 149, 46, 9, 150, 156, 161, 157, 169, 158, 10,
768 : 164, 40, 11, 163, 144, 4, 5, 6, 7, 165,
769 : 12, 47, 171, 106, 8, 181, 13, 182, 41, 42,
770 : 43, 44, 45, 190, 144, 183, 195, 191, 9, 192,
771 : 4, 5, 6, 7, 196, 10, 198, 193, 11, 8,
772 : 203, 204, 70, 71, 206, 207, 12, 41, 42, 43,
773 : 44, 45, 13, 9, 213, 212, 4, 5, 6, 7,
774 : 10, 52, 101, 11, 131, 8, 73, 176, 74, 175,
775 : 189, 12, 4, 5, 6, 7, 214, 13, 124, 9,
776 : 197, 8, 0, 208, 0, 0, 10, 0, 0, 11,
777 : 0, 4, 5, 6, 7, 9, 0, 12, 125, 0,
778 : 8, 0, 10, 13, 0, 11, 0, 0, 76, 0,
779 : 0, 0, 0, 12, 9, 0, 0, 0, 0, 13,
780 : 0, 10, 0, 0, 11, 4, 5, 6, 7, 0,
781 : 0, 0, 12, 47, 8, 27, 28, 29, 13, 30,
782 : 0, 31, 0, 0, 0, 27, 28, 29, 9, 30,
783 : 0, 31, 27, 28, 29, 10, 30, 0, 31, 0,
784 : 0, 0, 0, 0, 32, 0, 12, 35, 36, 37,
785 : 38, 0, 13, 0, 32, 33, 34, 35, 36, 37,
786 : 38, 32, 33, 34, 35, 36, 37, 38, 0, 0,
787 : 118, 0, 7, 27, 28, 29, 57, 30, 0, 31,
788 : 0, 27, 28, 29, 0, 30, 0, 31, 91, 153,
789 : 154, 0, 0, 0, 27, 28, 29, 0, 30, 10,
790 : 31, 0, 32, 33, 34, 35, 36, 37, 38, 102,
791 : 32, 33, 34, 35, 36, 37, 38, 0, 0, 0,
792 : 0, 0, 0, 32, 33, 34, 35, 36, 37, 38,
793 : 27, 28, 29, 0, 30, 0, 31, 27, 28, 29,
794 : 0, 30, 0, 31, 27, 28, 29, 141, 30, 0,
795 : 31, 0, 41, 42, 43, 44, 45, 0, 0, 32,
796 : 33, 34, 35, 36, 37, 38, 32, 0, 34, 35,
797 : 36, 37, 38, 0, 0, 0, 35, 36, 37, 38
798 : };
799 :
800 : static const yytype_int16 yycheck[] =
801 : {
802 : 18, 14, 3, 46, 121, 6, 6, 124, 143, 120,
803 : 58, 0, 5, 6, 12, 6, 50, 1, 50, 53,
804 : 6, 53, 40, 45, 46, 47, 50, 11, 46, 13,
805 : 48, 22, 33, 33, 18, 14, 12, 50, 36, 23,
806 : 33, 50, 33, 154, 28, 29, 163, 33, 21, 33,
807 : 34, 35, 36, 37, 30, 98, 191, 27, 169, 45,
808 : 108, 6, 46, 198, 39, 41, 42, 43, 44, 45,
809 : 118, 52, 128, 91, 51, 192, 28, 22, 96, 97,
810 : 98, 65, 66, 10, 102, 10, 70, 71, 33, 73,
811 : 74, 67, 76, 149, 78, 212, 3, 4, 5, 6,
812 : 34, 35, 120, 121, 12, 12, 124, 50, 53, 165,
813 : 128, 167, 168, 51, 98, 31, 32, 15, 16, 26,
814 : 104, 105, 50, 7, 8, 9, 33, 11, 21, 36,
815 : 106, 149, 150, 151, 51, 52, 154, 44, 156, 3,
816 : 4, 5, 6, 50, 33, 163, 51, 165, 12, 167,
817 : 168, 169, 51, 52, 10, 139, 140, 23, 24, 10,
818 : 51, 25, 26, 53, 50, 141, 51, 16, 51, 33,
819 : 51, 53, 36, 52, 192, 3, 4, 5, 6, 51,
820 : 44, 45, 17, 38, 12, 18, 50, 171, 43, 44,
821 : 45, 46, 47, 18, 212, 19, 3, 181, 26, 20,
822 : 3, 4, 5, 6, 3, 33, 190, 29, 36, 12,
823 : 3, 30, 40, 41, 51, 51, 44, 43, 44, 45,
824 : 46, 47, 50, 26, 3, 52, 3, 4, 5, 6,
825 : 33, 19, 55, 36, 99, 12, 39, 163, 41, 162,
826 : 175, 44, 3, 4, 5, 6, 212, 50, 25, 26,
827 : 189, 12, -1, 197, -1, -1, 33, -1, -1, 36,
828 : -1, 3, 4, 5, 6, 26, -1, 44, 45, -1,
829 : 12, -1, 33, 50, -1, 36, -1, -1, 39, -1,
830 : -1, -1, -1, 44, 26, -1, -1, -1, -1, 50,
831 : -1, 33, -1, -1, 36, 3, 4, 5, 6, -1,
832 : -1, -1, 44, 45, 12, 7, 8, 9, 50, 11,
833 : -1, 13, -1, -1, -1, 7, 8, 9, 26, 11,
834 : -1, 13, 7, 8, 9, 33, 11, -1, 13, -1,
835 : -1, -1, -1, -1, 36, -1, 44, 39, 40, 41,
836 : 42, -1, 50, -1, 36, 37, 38, 39, 40, 41,
837 : 42, 36, 37, 38, 39, 40, 41, 42, -1, -1,
838 : 52, -1, 6, 7, 8, 9, 51, 11, -1, 13,
839 : -1, 7, 8, 9, -1, 11, -1, 13, 22, 15,
840 : 16, -1, -1, -1, 7, 8, 9, -1, 11, 33,
841 : 13, -1, 36, 37, 38, 39, 40, 41, 42, 22,
842 : 36, 37, 38, 39, 40, 41, 42, -1, -1, -1,
843 : -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
844 : 7, 8, 9, -1, 11, -1, 13, 7, 8, 9,
845 : -1, 11, -1, 13, 7, 8, 9, 38, 11, -1,
846 : 13, -1, 43, 44, 45, 46, 47, -1, -1, 36,
847 : 37, 38, 39, 40, 41, 42, 36, -1, 38, 39,
848 : 40, 41, 42, -1, -1, -1, 39, 40, 41, 42
849 : };
850 :
851 : /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
852 : state STATE-NUM. */
853 : static const yytype_int8 yystos[] =
854 : {
855 : 0, 34, 35, 55, 3, 4, 5, 6, 12, 26,
856 : 33, 36, 44, 50, 56, 58, 59, 60, 14, 50,
857 : 62, 63, 0, 50, 56, 60, 56, 7, 8, 9,
858 : 11, 13, 36, 37, 38, 39, 40, 41, 42, 50,
859 : 53, 43, 44, 45, 46, 47, 25, 45, 56, 58,
860 : 66, 70, 63, 27, 64, 65, 56, 51, 50, 56,
861 : 56, 60, 12, 36, 7, 8, 9, 11, 56, 56,
862 : 40, 41, 56, 39, 41, 56, 39, 56, 39, 56,
863 : 57, 58, 60, 60, 60, 60, 60, 66, 31, 32,
864 : 69, 22, 58, 71, 72, 50, 53, 21, 52, 51,
865 : 28, 62, 22, 57, 10, 10, 38, 12, 50, 56,
866 : 56, 60, 56, 56, 56, 56, 56, 56, 52, 51,
867 : 21, 50, 58, 33, 25, 45, 45, 5, 58, 80,
868 : 66, 64, 58, 61, 51, 56, 56, 60, 57, 10,
869 : 10, 38, 57, 80, 58, 59, 67, 68, 59, 51,
870 : 53, 53, 71, 15, 16, 74, 50, 51, 51, 56,
871 : 56, 60, 74, 52, 51, 51, 71, 58, 58, 16,
872 : 80, 17, 73, 3, 58, 73, 68, 71, 71, 71,
873 : 80, 18, 56, 19, 75, 51, 52, 51, 52, 75,
874 : 18, 56, 20, 29, 78, 3, 3, 78, 56, 74,
875 : 59, 76, 77, 3, 30, 79, 51, 51, 79, 74,
876 : 23, 24, 52, 3, 76
877 : };
878 :
879 : /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
880 : static const yytype_int8 yyr1[] =
881 : {
882 : 0, 54, 55, 55, 55, 56, 56, 56, 56, 56,
883 : 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
884 : 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
885 : 56, 56, 57, 57, 58, 58, 59, 59, 60, 60,
886 : 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
887 : 60, 60, 61, 61, 61, 61, 61, 62, 62, 63,
888 : 63, 64, 64, 65, 66, 66, 67, 68, 68, 69,
889 : 69, 70, 70, 70, 70, 70, 70, 70, 70, 70,
890 : 71, 71, 72, 72, 73, 73, 74, 74, 74, 75,
891 : 75, 76, 76, 77, 77, 77, 78, 78, 79, 79,
892 : 80, 80, 80, 80, 80, 80
893 : };
894 :
895 : /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
896 : static const yytype_int8 yyr2[] =
897 : {
898 : 0, 2, 0, 2, 2, 1, 3, 3, 2, 3,
899 : 4, 4, 3, 3, 4, 4, 4, 4, 3, 4,
900 : 5, 6, 3, 4, 5, 6, 5, 6, 5, 6,
901 : 3, 4, 3, 1, 1, 1, 1, 3, 1, 1,
902 : 1, 1, 3, 1, 2, 3, 3, 3, 3, 3,
903 : 4, 6, 1, 4, 6, 4, 6, 2, 4, 9,
904 : 10, 0, 2, 2, 1, 3, 1, 1, 3, 1,
905 : 1, 1, 2, 5, 1, 3, 4, 5, 5, 6,
906 : 2, 1, 1, 2, 0, 2, 0, 5, 6, 0,
907 : 3, 3, 1, 1, 2, 2, 0, 2, 0, 2,
908 : 1, 2, 3, 4, 3, 4
909 : };
910 :
911 :
912 : enum { YYENOMEM = -2 };
913 :
914 : #define yyerrok (yyerrstatus = 0)
915 : #define yyclearin (yychar = YYEMPTY)
916 :
917 : #define YYACCEPT goto yyacceptlab
918 : #define YYABORT goto yyabortlab
919 : #define YYERROR goto yyerrorlab
920 : #define YYNOMEM goto yyexhaustedlab
921 :
922 :
923 : #define YYRECOVERING() (!!yyerrstatus)
924 :
925 : #define YYBACKUP(Token, Value) \
926 : do \
927 : if (yychar == YYEMPTY) \
928 : { \
929 : yychar = (Token); \
930 : yylval = (Value); \
931 : YYPOPSTACK (yylen); \
932 : yystate = *yyssp; \
933 : goto yybackup; \
934 : } \
935 : else \
936 : { \
937 : yyerror (context, YY_("syntax error: cannot back up")); \
938 : YYERROR; \
939 : } \
940 : while (0)
941 :
942 : /* Backward compatibility with an undocumented macro.
943 : Use YYerror or YYUNDEF. */
944 : #define YYERRCODE YYUNDEF
945 :
946 :
947 : /* Enable debugging if requested. */
948 : #if YYDEBUG
949 :
950 : # ifndef YYFPRINTF
951 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
952 : # define YYFPRINTF fprintf
953 : # endif
954 :
955 : # define YYDPRINTF(Args) \
956 : do { \
957 : if (yydebug) \
958 : YYFPRINTF Args; \
959 : } while (0)
960 :
961 :
962 :
963 :
964 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
965 : do { \
966 : if (yydebug) \
967 : { \
968 : YYFPRINTF (stderr, "%s ", Title); \
969 : yy_symbol_print (stderr, \
970 : Kind, Value, context); \
971 : YYFPRINTF (stderr, "\n"); \
972 : } \
973 : } while (0)
974 :
975 :
976 : /*-----------------------------------.
977 : | Print this symbol's value on YYO. |
978 : `-----------------------------------*/
979 :
980 : static void
981 : yy_symbol_value_print (FILE *yyo,
982 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, swq_parse_context *context)
983 : {
984 : FILE *yyoutput = yyo;
985 : YY_USE (yyoutput);
986 : YY_USE (context);
987 : if (!yyvaluep)
988 : return;
989 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
990 : YY_USE (yykind);
991 : YY_IGNORE_MAYBE_UNINITIALIZED_END
992 : }
993 :
994 :
995 : /*---------------------------.
996 : | Print this symbol on YYO. |
997 : `---------------------------*/
998 :
999 : static void
1000 : yy_symbol_print (FILE *yyo,
1001 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, swq_parse_context *context)
1002 : {
1003 : YYFPRINTF (yyo, "%s %s (",
1004 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1005 :
1006 : yy_symbol_value_print (yyo, yykind, yyvaluep, context);
1007 : YYFPRINTF (yyo, ")");
1008 : }
1009 :
1010 : /*------------------------------------------------------------------.
1011 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1012 : | TOP (included). |
1013 : `------------------------------------------------------------------*/
1014 :
1015 : static void
1016 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1017 : {
1018 : YYFPRINTF (stderr, "Stack now");
1019 : for (; yybottom <= yytop; yybottom++)
1020 : {
1021 : int yybot = *yybottom;
1022 : YYFPRINTF (stderr, " %d", yybot);
1023 : }
1024 : YYFPRINTF (stderr, "\n");
1025 : }
1026 :
1027 : # define YY_STACK_PRINT(Bottom, Top) \
1028 : do { \
1029 : if (yydebug) \
1030 : yy_stack_print ((Bottom), (Top)); \
1031 : } while (0)
1032 :
1033 :
1034 : /*------------------------------------------------.
1035 : | Report that the YYRULE is going to be reduced. |
1036 : `------------------------------------------------*/
1037 :
1038 : static void
1039 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1040 : int yyrule, swq_parse_context *context)
1041 : {
1042 : int yylno = yyrline[yyrule];
1043 : int yynrhs = yyr2[yyrule];
1044 : int yyi;
1045 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1046 : yyrule - 1, yylno);
1047 : /* The symbols being reduced. */
1048 : for (yyi = 0; yyi < yynrhs; yyi++)
1049 : {
1050 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
1051 : yy_symbol_print (stderr,
1052 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1053 : &yyvsp[(yyi + 1) - (yynrhs)], context);
1054 : YYFPRINTF (stderr, "\n");
1055 : }
1056 : }
1057 :
1058 : # define YY_REDUCE_PRINT(Rule) \
1059 : do { \
1060 : if (yydebug) \
1061 : yy_reduce_print (yyssp, yyvsp, Rule, context); \
1062 : } while (0)
1063 :
1064 : /* Nonzero means print parse trace. It is left uninitialized so that
1065 : multiple parsers can coexist. */
1066 : int yydebug;
1067 : #else /* !YYDEBUG */
1068 : # define YYDPRINTF(Args) ((void) 0)
1069 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1070 : # define YY_STACK_PRINT(Bottom, Top)
1071 : # define YY_REDUCE_PRINT(Rule)
1072 : #endif /* !YYDEBUG */
1073 :
1074 :
1075 : /* YYINITDEPTH -- initial size of the parser's stacks. */
1076 : #ifndef YYINITDEPTH
1077 : # define YYINITDEPTH 200
1078 : #endif
1079 :
1080 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1081 : if the built-in stack extension method is used).
1082 :
1083 : Do not make this value too large; the results are undefined if
1084 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1085 : evaluated with infinite-precision integer arithmetic. */
1086 :
1087 : #ifndef YYMAXDEPTH
1088 : # define YYMAXDEPTH 10000
1089 : #endif
1090 :
1091 :
1092 : /* Context of a parse error. */
1093 : typedef struct
1094 : {
1095 : yy_state_t *yyssp;
1096 : yysymbol_kind_t yytoken;
1097 : } yypcontext_t;
1098 :
1099 : /* Put in YYARG at most YYARGN of the expected tokens given the
1100 : current YYCTX, and return the number of tokens stored in YYARG. If
1101 : YYARG is null, return the number of expected tokens (guaranteed to
1102 : be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
1103 : Return 0 if there are more than YYARGN expected tokens, yet fill
1104 : YYARG up to YYARGN. */
1105 : static int
1106 110 : yypcontext_expected_tokens (const yypcontext_t *yyctx,
1107 : yysymbol_kind_t yyarg[], int yyargn)
1108 : {
1109 : /* Actual size of YYARG. */
1110 110 : int yycount = 0;
1111 110 : int yyn = yypact[+*yyctx->yyssp];
1112 110 : if (!yypact_value_is_default (yyn))
1113 : {
1114 : /* Start YYX at -YYN if negative to avoid negative indexes in
1115 : YYCHECK. In other words, skip the first -YYN actions for
1116 : this state because they are default actions. */
1117 110 : int yyxbegin = yyn < 0 ? -yyn : 0;
1118 : /* Stay within bounds of both yycheck and yytname. */
1119 110 : int yychecklim = YYLAST - yyn + 1;
1120 110 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1121 : int yyx;
1122 4676 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1123 4569 : if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
1124 : && !yytable_value_is_error (yytable[yyx + yyn]))
1125 : {
1126 226 : if (!yyarg)
1127 0 : ++yycount;
1128 226 : else if (yycount == yyargn)
1129 3 : return 0;
1130 : else
1131 223 : yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1132 : }
1133 : }
1134 107 : if (yyarg && yycount == 0 && 0 < yyargn)
1135 0 : yyarg[0] = YYSYMBOL_YYEMPTY;
1136 107 : return yycount;
1137 : }
1138 :
1139 :
1140 :
1141 :
1142 : #ifndef yystrlen
1143 : # if defined __GLIBC__ && defined _STRING_H
1144 : # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1145 : # else
1146 : /* Return the length of YYSTR. */
1147 : static YYPTRDIFF_T
1148 : yystrlen (const char *yystr)
1149 : {
1150 : YYPTRDIFF_T yylen;
1151 : for (yylen = 0; yystr[yylen]; yylen++)
1152 : continue;
1153 : return yylen;
1154 : }
1155 : # endif
1156 : #endif
1157 :
1158 : #ifndef yystpcpy
1159 : # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1160 : # define yystpcpy stpcpy
1161 : # else
1162 : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1163 : YYDEST. */
1164 : static char *
1165 : yystpcpy (char *yydest, const char *yysrc)
1166 : {
1167 : char *yyd = yydest;
1168 : const char *yys = yysrc;
1169 :
1170 : while ((*yyd++ = *yys++) != '\0')
1171 : continue;
1172 :
1173 : return yyd - 1;
1174 : }
1175 : # endif
1176 : #endif
1177 :
1178 : #ifndef yytnamerr
1179 : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1180 : quotes and backslashes, so that it's suitable for yyerror. The
1181 : heuristic is that double-quoting is unnecessary unless the string
1182 : contains an apostrophe, a comma, or backslash (other than
1183 : backslash-backslash). YYSTR is taken from yytname. If YYRES is
1184 : null, do not copy; instead, return the length of what the result
1185 : would have been. */
1186 : static YYPTRDIFF_T
1187 642 : yytnamerr (char *yyres, const char *yystr)
1188 : {
1189 642 : if (*yystr == '"')
1190 : {
1191 436 : YYPTRDIFF_T yyn = 0;
1192 436 : char const *yyp = yystr;
1193 : for (;;)
1194 3952 : switch (*++yyp)
1195 : {
1196 0 : case '\'':
1197 : case ',':
1198 0 : goto do_not_strip_quotes;
1199 :
1200 0 : case '\\':
1201 0 : if (*++yyp != '\\')
1202 0 : goto do_not_strip_quotes;
1203 : else
1204 0 : goto append;
1205 :
1206 3516 : append:
1207 : default:
1208 3516 : if (yyres)
1209 1758 : yyres[yyn] = *yyp;
1210 3516 : yyn++;
1211 3516 : break;
1212 :
1213 436 : case '"':
1214 436 : if (yyres)
1215 218 : yyres[yyn] = '\0';
1216 436 : return yyn;
1217 : }
1218 0 : do_not_strip_quotes: ;
1219 : }
1220 :
1221 206 : if (yyres)
1222 103 : return yystpcpy (yyres, yystr) - yyres;
1223 : else
1224 103 : return yystrlen (yystr);
1225 : }
1226 : #endif
1227 :
1228 :
1229 : static int
1230 110 : yy_syntax_error_arguments (const yypcontext_t *yyctx,
1231 : yysymbol_kind_t yyarg[], int yyargn)
1232 : {
1233 : /* Actual size of YYARG. */
1234 110 : int yycount = 0;
1235 : /* There are many possibilities here to consider:
1236 : - If this state is a consistent state with a default action, then
1237 : the only way this function was invoked is if the default action
1238 : is an error action. In that case, don't check for expected
1239 : tokens because there are none.
1240 : - The only way there can be no lookahead present (in yychar) is if
1241 : this state is a consistent state with a default action. Thus,
1242 : detecting the absence of a lookahead is sufficient to determine
1243 : that there is no unexpected or expected token to report. In that
1244 : case, just report a simple "syntax error".
1245 : - Don't assume there isn't a lookahead just because this state is a
1246 : consistent state with a default action. There might have been a
1247 : previous inconsistent state, consistent state with a non-default
1248 : action, or user semantic action that manipulated yychar.
1249 : - Of course, the expected token list depends on states to have
1250 : correct lookahead information, and it depends on the parser not
1251 : to perform extra reductions after fetching a lookahead from the
1252 : scanner and before detecting a syntax error. Thus, state merging
1253 : (from LALR or IELR) and default reductions corrupt the expected
1254 : token list. However, the list is correct for canonical LR with
1255 : one exception: it will still contain any token that will not be
1256 : accepted due to an error action in a later state.
1257 : */
1258 110 : if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1259 : {
1260 : int yyn;
1261 110 : if (yyarg)
1262 110 : yyarg[yycount] = yyctx->yytoken;
1263 110 : ++yycount;
1264 110 : yyn = yypcontext_expected_tokens (yyctx,
1265 : yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1266 110 : if (yyn == YYENOMEM)
1267 0 : return YYENOMEM;
1268 : else
1269 110 : yycount += yyn;
1270 : }
1271 110 : return yycount;
1272 : }
1273 :
1274 : /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1275 : about the unexpected token YYTOKEN for the state stack whose top is
1276 : YYSSP.
1277 :
1278 : Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1279 : not large enough to hold the message. In that case, also set
1280 : *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1281 : required number of bytes is too large to store. */
1282 : static int
1283 110 : yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1284 : const yypcontext_t *yyctx)
1285 : {
1286 : enum { YYARGS_MAX = 5 };
1287 : /* Internationalized format string. */
1288 110 : const char *yyformat = YY_NULLPTR;
1289 : /* Arguments of yyformat: reported tokens (one for the "unexpected",
1290 : one per "expected"). */
1291 : yysymbol_kind_t yyarg[YYARGS_MAX];
1292 : /* Cumulated lengths of YYARG. */
1293 110 : YYPTRDIFF_T yysize = 0;
1294 :
1295 : /* Actual size of YYARG. */
1296 110 : int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1297 110 : if (yycount == YYENOMEM)
1298 0 : return YYENOMEM;
1299 :
1300 110 : switch (yycount)
1301 : {
1302 : #define YYCASE_(N, S) \
1303 : case N: \
1304 : yyformat = S; \
1305 : break
1306 0 : default: /* Avoid compiler warnings. */
1307 0 : YYCASE_(0, YY_("syntax error"));
1308 3 : YYCASE_(1, YY_("syntax error, unexpected %s"));
1309 4 : YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1310 102 : YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1311 1 : YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1312 0 : YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1313 : #undef YYCASE_
1314 : }
1315 :
1316 : /* Compute error message size. Don't count the "%s"s, but reserve
1317 : room for the terminator. */
1318 110 : yysize = yystrlen (yyformat) - 2 * yycount + 1;
1319 : {
1320 : int yyi;
1321 431 : for (yyi = 0; yyi < yycount; ++yyi)
1322 : {
1323 : YYPTRDIFF_T yysize1
1324 321 : = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1325 321 : if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1326 321 : yysize = yysize1;
1327 : else
1328 0 : return YYENOMEM;
1329 : }
1330 : }
1331 :
1332 110 : if (*yymsg_alloc < yysize)
1333 : {
1334 0 : *yymsg_alloc = 2 * yysize;
1335 0 : if (! (yysize <= *yymsg_alloc
1336 : && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1337 0 : *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1338 0 : return -1;
1339 : }
1340 :
1341 : /* Avoid sprintf, as that infringes on the user's name space.
1342 : Don't have undefined behavior even if the translation
1343 : produced a string with the wrong number of "%s"s. */
1344 : {
1345 110 : char *yyp = *yymsg;
1346 110 : int yyi = 0;
1347 4881 : while ((*yyp = *yyformat) != '\0')
1348 4771 : if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1349 : {
1350 321 : yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1351 321 : yyformat += 2;
1352 : }
1353 : else
1354 : {
1355 4450 : ++yyp;
1356 4450 : ++yyformat;
1357 : }
1358 : }
1359 110 : return 0;
1360 : }
1361 :
1362 :
1363 : /*-----------------------------------------------.
1364 : | Release the memory associated to this symbol. |
1365 : `-----------------------------------------------*/
1366 :
1367 : static void
1368 16156 : yydestruct (const char *yymsg,
1369 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep, swq_parse_context *context)
1370 : {
1371 : YY_USE (yyvaluep);
1372 : YY_USE (context);
1373 16156 : if (!yymsg)
1374 0 : yymsg = "Deleting";
1375 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1376 :
1377 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1378 16156 : switch (yykind)
1379 : {
1380 0 : case YYSYMBOL_SWQT_INTEGER_NUMBER: /* "integer number" */
1381 0 : { delete (*yyvaluep); }
1382 0 : break;
1383 :
1384 0 : case YYSYMBOL_SWQT_FLOAT_NUMBER: /* "floating point number" */
1385 0 : { delete (*yyvaluep); }
1386 0 : break;
1387 :
1388 3 : case YYSYMBOL_SWQT_STRING: /* "string" */
1389 3 : { delete (*yyvaluep); }
1390 3 : break;
1391 :
1392 96 : case YYSYMBOL_SWQT_IDENTIFIER: /* "identifier" */
1393 96 : { delete (*yyvaluep); }
1394 96 : break;
1395 :
1396 0 : case YYSYMBOL_SWQT_HIDDEN: /* "HIDDEN" */
1397 0 : { delete (*yyvaluep); }
1398 0 : break;
1399 :
1400 3 : case YYSYMBOL_value_expr: /* value_expr */
1401 3 : { delete (*yyvaluep); }
1402 3 : break;
1403 :
1404 0 : case YYSYMBOL_value_expr_list: /* value_expr_list */
1405 0 : { delete (*yyvaluep); }
1406 0 : break;
1407 :
1408 1 : case YYSYMBOL_identifier: /* identifier */
1409 1 : { delete (*yyvaluep); }
1410 1 : break;
1411 :
1412 0 : case YYSYMBOL_field_value: /* field_value */
1413 0 : { delete (*yyvaluep); }
1414 0 : break;
1415 :
1416 0 : case YYSYMBOL_value_expr_non_logical: /* value_expr_non_logical */
1417 0 : { delete (*yyvaluep); }
1418 0 : break;
1419 :
1420 0 : case YYSYMBOL_type_def: /* type_def */
1421 0 : { delete (*yyvaluep); }
1422 0 : break;
1423 :
1424 0 : case YYSYMBOL_as_clause: /* as_clause */
1425 0 : { delete (*yyvaluep); }
1426 0 : break;
1427 :
1428 0 : case YYSYMBOL_as_clause_with_hidden: /* as_clause_with_hidden */
1429 0 : { delete (*yyvaluep); }
1430 0 : break;
1431 :
1432 0 : case YYSYMBOL_table_def: /* table_def */
1433 0 : { delete (*yyvaluep); }
1434 0 : break;
1435 :
1436 16053 : default:
1437 16053 : break;
1438 : }
1439 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1440 16156 : }
1441 :
1442 :
1443 :
1444 :
1445 :
1446 :
1447 : /*----------.
1448 : | yyparse. |
1449 : `----------*/
1450 :
1451 : int
1452 8043 : yyparse (swq_parse_context *context)
1453 : {
1454 : /* Lookahead token kind. */
1455 : int yychar;
1456 :
1457 :
1458 : /* The semantic value of the lookahead symbol. */
1459 : /* Default value used for initialization, for pacifying older GCCs
1460 : or non-GCC compilers. */
1461 : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1462 : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1463 :
1464 : /* Number of syntax errors so far. */
1465 8043 : int yynerrs = 0;
1466 :
1467 8043 : yy_state_fast_t yystate = 0;
1468 : /* Number of tokens to shift before error messages enabled. */
1469 8043 : int yyerrstatus = 0;
1470 :
1471 : /* Refer to the stacks through separate pointers, to allow yyoverflow
1472 : to reallocate them elsewhere. */
1473 :
1474 : /* Their size. */
1475 8043 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
1476 :
1477 : /* The state stack: array, bottom, top. */
1478 : yy_state_t yyssa[YYINITDEPTH];
1479 8043 : yy_state_t *yyss = yyssa;
1480 8043 : yy_state_t *yyssp = yyss;
1481 :
1482 : /* The semantic value stack: array, bottom, top. */
1483 : YYSTYPE yyvsa[YYINITDEPTH];
1484 8043 : YYSTYPE *yyvs = yyvsa;
1485 8043 : YYSTYPE *yyvsp = yyvs;
1486 :
1487 : int yyn;
1488 : /* The return value of yyparse. */
1489 : int yyresult;
1490 : /* Lookahead symbol kind. */
1491 8043 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1492 : /* The variables used to return semantic value and location from the
1493 : action routines. */
1494 : YYSTYPE yyval;
1495 :
1496 : /* Buffer for error messages, and its allocated size. */
1497 : char yymsgbuf[128];
1498 8043 : char *yymsg = yymsgbuf;
1499 8043 : YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1500 :
1501 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1502 :
1503 : /* The number of symbols on the RHS of the reduced rule.
1504 : Keep to zero when no symbol should be popped. */
1505 8043 : int yylen = 0;
1506 :
1507 : YYDPRINTF ((stderr, "Starting parse\n"));
1508 :
1509 8043 : yychar = YYEMPTY; /* Cause a token to be read. */
1510 :
1511 8043 : goto yysetstate;
1512 :
1513 :
1514 : /*------------------------------------------------------------.
1515 : | yynewstate -- push a new state, which is found in yystate. |
1516 : `------------------------------------------------------------*/
1517 213918 : yynewstate:
1518 : /* In all cases, when you get here, the value and location stacks
1519 : have just been pushed. So pushing a state here evens the stacks. */
1520 213918 : yyssp++;
1521 :
1522 :
1523 : /*--------------------------------------------------------------------.
1524 : | yysetstate -- set current state (the top of the stack) to yystate. |
1525 : `--------------------------------------------------------------------*/
1526 221961 : yysetstate:
1527 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1528 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1529 : YY_IGNORE_USELESS_CAST_BEGIN
1530 221961 : *yyssp = YY_CAST (yy_state_t, yystate);
1531 : YY_IGNORE_USELESS_CAST_END
1532 : YY_STACK_PRINT (yyss, yyssp);
1533 :
1534 221961 : if (yyss + yystacksize - 1 <= yyssp)
1535 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1536 : YYNOMEM;
1537 : #else
1538 : {
1539 : /* Get the current used size of the three stacks, in elements. */
1540 4 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
1541 :
1542 : # if defined yyoverflow
1543 : {
1544 : /* Give user a chance to reallocate the stack. Use copies of
1545 : these so that the &'s don't force the real ones into
1546 : memory. */
1547 : yy_state_t *yyss1 = yyss;
1548 : YYSTYPE *yyvs1 = yyvs;
1549 :
1550 : /* Each stack pointer address is followed by the size of the
1551 : data in use in that stack, in bytes. This used to be a
1552 : conditional around just the two extra args, but that might
1553 : be undefined if yyoverflow is a macro. */
1554 : yyoverflow (YY_("memory exhausted"),
1555 : &yyss1, yysize * YYSIZEOF (*yyssp),
1556 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
1557 : &yystacksize);
1558 : yyss = yyss1;
1559 : yyvs = yyvs1;
1560 : }
1561 : # else /* defined YYSTACK_RELOCATE */
1562 : /* Extend the stack our own way. */
1563 4 : if (YYMAXDEPTH <= yystacksize)
1564 0 : YYNOMEM;
1565 4 : yystacksize *= 2;
1566 4 : if (YYMAXDEPTH < yystacksize)
1567 0 : yystacksize = YYMAXDEPTH;
1568 :
1569 : {
1570 4 : yy_state_t *yyss1 = yyss;
1571 : union yyalloc *yyptr =
1572 4 : YY_CAST (union yyalloc *,
1573 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1574 4 : if (! yyptr)
1575 0 : YYNOMEM;
1576 4 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1577 4 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1578 : # undef YYSTACK_RELOCATE
1579 4 : if (yyss1 != yyssa)
1580 3 : YYSTACK_FREE (yyss1);
1581 : }
1582 : # endif
1583 :
1584 4 : yyssp = yyss + yysize - 1;
1585 4 : yyvsp = yyvs + yysize - 1;
1586 :
1587 : YY_IGNORE_USELESS_CAST_BEGIN
1588 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1589 : YY_CAST (long, yystacksize)));
1590 : YY_IGNORE_USELESS_CAST_END
1591 :
1592 4 : if (yyss + yystacksize - 1 <= yyssp)
1593 0 : YYABORT;
1594 : }
1595 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1596 :
1597 :
1598 221961 : if (yystate == YYFINAL)
1599 7926 : YYACCEPT;
1600 :
1601 214035 : goto yybackup;
1602 :
1603 :
1604 : /*-----------.
1605 : | yybackup. |
1606 : `-----------*/
1607 214035 : yybackup:
1608 : /* Do appropriate processing given the current state. Read a
1609 : lookahead token if we need one and don't already have one. */
1610 :
1611 : /* First try to decide what to do without reference to lookahead token. */
1612 214035 : yyn = yypact[yystate];
1613 214035 : if (yypact_value_is_default (yyn))
1614 63262 : goto yydefault;
1615 :
1616 : /* Not known => get a lookahead token if don't already have one. */
1617 :
1618 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1619 150773 : if (yychar == YYEMPTY)
1620 : {
1621 : YYDPRINTF ((stderr, "Reading a token\n"));
1622 78952 : yychar = yylex (&yylval, context);
1623 : }
1624 :
1625 150773 : if (yychar <= END)
1626 : {
1627 36611 : yychar = END;
1628 36611 : yytoken = YYSYMBOL_YYEOF;
1629 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1630 : }
1631 114162 : else if (yychar == YYerror)
1632 : {
1633 : /* The scanner already issued an error message, process directly
1634 : to error recovery. But do not keep the error token as
1635 : lookahead, it is too special and may lead us to an endless
1636 : loop in error recovery. */
1637 1 : yychar = YYUNDEF;
1638 1 : yytoken = YYSYMBOL_YYerror;
1639 1 : goto yyerrlab1;
1640 : }
1641 : else
1642 : {
1643 114161 : yytoken = YYTRANSLATE (yychar);
1644 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1645 : }
1646 :
1647 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1648 : detect an error, take that action. */
1649 150772 : yyn += yytoken;
1650 150772 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1651 71934 : goto yydefault;
1652 78838 : yyn = yytable[yyn];
1653 78838 : if (yyn <= 0)
1654 : {
1655 : if (yytable_value_is_error (yyn))
1656 : goto yyerrlab;
1657 0 : yyn = -yyn;
1658 0 : goto yyreduce;
1659 : }
1660 :
1661 : /* Count tokens shifted since error; after three, turn off error
1662 : status. */
1663 78838 : if (yyerrstatus)
1664 0 : yyerrstatus--;
1665 :
1666 : /* Shift the lookahead token. */
1667 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1668 78838 : yystate = yyn;
1669 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1670 78838 : *++yyvsp = yylval;
1671 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1672 :
1673 : /* Discard the shifted token. */
1674 78838 : yychar = YYEMPTY;
1675 78838 : goto yynewstate;
1676 :
1677 :
1678 : /*-----------------------------------------------------------.
1679 : | yydefault -- do the default action for the current state. |
1680 : `-----------------------------------------------------------*/
1681 135196 : yydefault:
1682 135196 : yyn = yydefact[yystate];
1683 135196 : if (yyn == 0)
1684 110 : goto yyerrlab;
1685 135086 : goto yyreduce;
1686 :
1687 :
1688 : /*-----------------------------.
1689 : | yyreduce -- do a reduction. |
1690 : `-----------------------------*/
1691 135086 : yyreduce:
1692 : /* yyn is the number of a rule to reduce with. */
1693 135086 : yylen = yyr2[yyn];
1694 :
1695 : /* If YYLEN is nonzero, implement the default value of the action:
1696 : '$$ = $1'.
1697 :
1698 : Otherwise, the following line sets YYVAL to garbage.
1699 : This behavior is undocumented and Bison
1700 : users should not rely upon it. Assigning to YYVAL
1701 : unconditionally makes the parser a bit smaller, and it avoids a
1702 : GCC warning that YYVAL may be used uninitialized. */
1703 135086 : yyval = yyvsp[1-yylen];
1704 :
1705 :
1706 : YY_REDUCE_PRINT (yyn);
1707 135086 : switch (yyn)
1708 : {
1709 5133 : case 3: /* input: SWQT_VALUE_START value_expr */
1710 : {
1711 5133 : context->poRoot = yyvsp[0];
1712 5133 : swq_fixup(context);
1713 : }
1714 5133 : break;
1715 :
1716 2793 : case 4: /* input: SWQT_SELECT_START select_statement */
1717 : {
1718 2793 : context->poRoot = yyvsp[0];
1719 : // swq_fixup() must be done by caller
1720 : }
1721 2793 : break;
1722 :
1723 24816 : case 5: /* value_expr: value_expr_non_logical */
1724 : {
1725 24816 : yyval = yyvsp[0];
1726 : }
1727 24816 : break;
1728 :
1729 2473 : case 6: /* value_expr: value_expr "AND" value_expr */
1730 : {
1731 2473 : yyval = swq_create_and_or_or( SWQ_AND, yyvsp[-2], yyvsp[0] );
1732 : }
1733 2473 : break;
1734 :
1735 2277 : case 7: /* value_expr: value_expr "OR" value_expr */
1736 : {
1737 2277 : yyval = swq_create_and_or_or( SWQ_OR, yyvsp[-2], yyvsp[0] );
1738 : }
1739 2277 : break;
1740 :
1741 132 : case 8: /* value_expr: "NOT" value_expr */
1742 : {
1743 132 : yyval = new swq_expr_node( SWQ_NOT );
1744 132 : yyval->field_type = SWQ_BOOLEAN;
1745 132 : yyval->PushSubExpression( yyvsp[0] );
1746 : }
1747 132 : break;
1748 :
1749 9308 : case 9: /* value_expr: value_expr '=' value_expr */
1750 : {
1751 9308 : yyval = new swq_expr_node( SWQ_EQ );
1752 9308 : yyval->field_type = SWQ_BOOLEAN;
1753 9308 : yyval->PushSubExpression( yyvsp[-2] );
1754 9308 : yyval->PushSubExpression( yyvsp[0] );
1755 : }
1756 9308 : break;
1757 :
1758 674 : case 10: /* value_expr: value_expr '<' '>' value_expr */
1759 : {
1760 674 : yyval = new swq_expr_node( SWQ_NE );
1761 674 : yyval->field_type = SWQ_BOOLEAN;
1762 674 : yyval->PushSubExpression( yyvsp[-3] );
1763 674 : yyval->PushSubExpression( yyvsp[0] );
1764 : }
1765 674 : break;
1766 :
1767 54 : case 11: /* value_expr: value_expr '!' '=' value_expr */
1768 : {
1769 54 : yyval = new swq_expr_node( SWQ_NE );
1770 54 : yyval->field_type = SWQ_BOOLEAN;
1771 54 : yyval->PushSubExpression( yyvsp[-3] );
1772 54 : yyval->PushSubExpression( yyvsp[0] );
1773 : }
1774 54 : break;
1775 :
1776 202 : case 12: /* value_expr: value_expr '<' value_expr */
1777 : {
1778 202 : yyval = new swq_expr_node( SWQ_LT );
1779 202 : yyval->field_type = SWQ_BOOLEAN;
1780 202 : yyval->PushSubExpression( yyvsp[-2] );
1781 202 : yyval->PushSubExpression( yyvsp[0] );
1782 : }
1783 202 : break;
1784 :
1785 203 : case 13: /* value_expr: value_expr '>' value_expr */
1786 : {
1787 203 : yyval = new swq_expr_node( SWQ_GT );
1788 203 : yyval->field_type = SWQ_BOOLEAN;
1789 203 : yyval->PushSubExpression( yyvsp[-2] );
1790 203 : yyval->PushSubExpression( yyvsp[0] );
1791 : }
1792 203 : break;
1793 :
1794 110 : case 14: /* value_expr: value_expr '<' '=' value_expr */
1795 : {
1796 110 : yyval = new swq_expr_node( SWQ_LE );
1797 110 : yyval->field_type = SWQ_BOOLEAN;
1798 110 : yyval->PushSubExpression( yyvsp[-3] );
1799 110 : yyval->PushSubExpression( yyvsp[0] );
1800 : }
1801 110 : break;
1802 :
1803 0 : case 15: /* value_expr: value_expr '=' '<' value_expr */
1804 : {
1805 0 : yyval = new swq_expr_node( SWQ_LE );
1806 0 : yyval->field_type = SWQ_BOOLEAN;
1807 0 : yyval->PushSubExpression( yyvsp[-3] );
1808 0 : yyval->PushSubExpression( yyvsp[0] );
1809 : }
1810 0 : break;
1811 :
1812 0 : case 16: /* value_expr: value_expr '=' '>' value_expr */
1813 : {
1814 0 : yyval = new swq_expr_node( SWQ_LE );
1815 0 : yyval->field_type = SWQ_BOOLEAN;
1816 0 : yyval->PushSubExpression( yyvsp[-3] );
1817 0 : yyval->PushSubExpression( yyvsp[0] );
1818 : }
1819 0 : break;
1820 :
1821 128 : case 17: /* value_expr: value_expr '>' '=' value_expr */
1822 : {
1823 128 : yyval = new swq_expr_node( SWQ_GE );
1824 128 : yyval->field_type = SWQ_BOOLEAN;
1825 128 : yyval->PushSubExpression( yyvsp[-3] );
1826 128 : yyval->PushSubExpression( yyvsp[0] );
1827 : }
1828 128 : break;
1829 :
1830 49 : case 18: /* value_expr: value_expr "LIKE" value_expr */
1831 : {
1832 49 : yyval = new swq_expr_node( SWQ_LIKE );
1833 49 : yyval->field_type = SWQ_BOOLEAN;
1834 49 : yyval->PushSubExpression( yyvsp[-2] );
1835 49 : yyval->PushSubExpression( yyvsp[0] );
1836 : }
1837 49 : break;
1838 :
1839 1 : case 19: /* value_expr: value_expr "NOT" "LIKE" value_expr */
1840 : {
1841 1 : swq_expr_node *like = new swq_expr_node( SWQ_LIKE );
1842 1 : like->field_type = SWQ_BOOLEAN;
1843 1 : like->PushSubExpression( yyvsp[-3] );
1844 1 : like->PushSubExpression( yyvsp[0] );
1845 :
1846 1 : yyval = new swq_expr_node( SWQ_NOT );
1847 1 : yyval->field_type = SWQ_BOOLEAN;
1848 1 : yyval->PushSubExpression( like );
1849 : }
1850 1 : break;
1851 :
1852 3 : case 20: /* value_expr: value_expr "LIKE" value_expr "ESCAPE" value_expr */
1853 : {
1854 3 : yyval = new swq_expr_node( SWQ_LIKE );
1855 3 : yyval->field_type = SWQ_BOOLEAN;
1856 3 : yyval->PushSubExpression( yyvsp[-4] );
1857 3 : yyval->PushSubExpression( yyvsp[-2] );
1858 3 : yyval->PushSubExpression( yyvsp[0] );
1859 : }
1860 3 : break;
1861 :
1862 0 : case 21: /* value_expr: value_expr "NOT" "LIKE" value_expr "ESCAPE" value_expr */
1863 : {
1864 0 : swq_expr_node *like = new swq_expr_node( SWQ_LIKE );
1865 0 : like->field_type = SWQ_BOOLEAN;
1866 0 : like->PushSubExpression( yyvsp[-5] );
1867 0 : like->PushSubExpression( yyvsp[-2] );
1868 0 : like->PushSubExpression( yyvsp[0] );
1869 :
1870 0 : yyval = new swq_expr_node( SWQ_NOT );
1871 0 : yyval->field_type = SWQ_BOOLEAN;
1872 0 : yyval->PushSubExpression( like );
1873 : }
1874 0 : break;
1875 :
1876 31 : case 22: /* value_expr: value_expr "ILIKE" value_expr */
1877 : {
1878 31 : yyval = new swq_expr_node( SWQ_ILIKE );
1879 31 : yyval->field_type = SWQ_BOOLEAN;
1880 31 : yyval->PushSubExpression( yyvsp[-2] );
1881 31 : yyval->PushSubExpression( yyvsp[0] );
1882 : }
1883 31 : break;
1884 :
1885 0 : case 23: /* value_expr: value_expr "NOT" "ILIKE" value_expr */
1886 : {
1887 0 : swq_expr_node *like = new swq_expr_node( SWQ_ILIKE );
1888 0 : like->field_type = SWQ_BOOLEAN;
1889 0 : like->PushSubExpression( yyvsp[-3] );
1890 0 : like->PushSubExpression( yyvsp[0] );
1891 :
1892 0 : yyval = new swq_expr_node( SWQ_NOT );
1893 0 : yyval->field_type = SWQ_BOOLEAN;
1894 0 : yyval->PushSubExpression( like );
1895 : }
1896 0 : break;
1897 :
1898 0 : case 24: /* value_expr: value_expr "ILIKE" value_expr "ESCAPE" value_expr */
1899 : {
1900 0 : yyval = new swq_expr_node( SWQ_ILIKE );
1901 0 : yyval->field_type = SWQ_BOOLEAN;
1902 0 : yyval->PushSubExpression( yyvsp[-4] );
1903 0 : yyval->PushSubExpression( yyvsp[-2] );
1904 0 : yyval->PushSubExpression( yyvsp[0] );
1905 : }
1906 0 : break;
1907 :
1908 0 : case 25: /* value_expr: value_expr "NOT" "ILIKE" value_expr "ESCAPE" value_expr */
1909 : {
1910 0 : swq_expr_node *like = new swq_expr_node( SWQ_ILIKE );
1911 0 : like->field_type = SWQ_BOOLEAN;
1912 0 : like->PushSubExpression( yyvsp[-5] );
1913 0 : like->PushSubExpression( yyvsp[-2] );
1914 0 : like->PushSubExpression( yyvsp[0] );
1915 :
1916 0 : yyval = new swq_expr_node( SWQ_NOT );
1917 0 : yyval->field_type = SWQ_BOOLEAN;
1918 0 : yyval->PushSubExpression( like );
1919 : }
1920 0 : break;
1921 :
1922 129 : case 26: /* value_expr: value_expr "IN" '(' value_expr_list ')' */
1923 : {
1924 129 : yyval = yyvsp[-1];
1925 129 : yyval->field_type = SWQ_BOOLEAN;
1926 129 : yyval->nOperation = SWQ_IN;
1927 129 : yyval->PushSubExpression( yyvsp[-4] );
1928 129 : yyval->ReverseSubExpressions();
1929 : }
1930 129 : break;
1931 :
1932 21 : case 27: /* value_expr: value_expr "NOT" "IN" '(' value_expr_list ')' */
1933 : {
1934 21 : swq_expr_node *in = yyvsp[-1];
1935 21 : in->field_type = SWQ_BOOLEAN;
1936 21 : in->nOperation = SWQ_IN;
1937 21 : in->PushSubExpression( yyvsp[-5] );
1938 21 : in->ReverseSubExpressions();
1939 :
1940 21 : yyval = new swq_expr_node( SWQ_NOT );
1941 21 : yyval->field_type = SWQ_BOOLEAN;
1942 21 : yyval->PushSubExpression( in );
1943 : }
1944 21 : break;
1945 :
1946 28 : case 28: /* value_expr: value_expr "BETWEEN" value_expr_non_logical "AND" value_expr_non_logical */
1947 : {
1948 28 : yyval = new swq_expr_node( SWQ_BETWEEN );
1949 28 : yyval->field_type = SWQ_BOOLEAN;
1950 28 : yyval->PushSubExpression( yyvsp[-4] );
1951 28 : yyval->PushSubExpression( yyvsp[-2] );
1952 28 : yyval->PushSubExpression( yyvsp[0] );
1953 : }
1954 28 : break;
1955 :
1956 1 : case 29: /* value_expr: value_expr "NOT" "BETWEEN" value_expr_non_logical "AND" value_expr_non_logical */
1957 : {
1958 1 : swq_expr_node *between = new swq_expr_node( SWQ_BETWEEN );
1959 1 : between->field_type = SWQ_BOOLEAN;
1960 1 : between->PushSubExpression( yyvsp[-5] );
1961 1 : between->PushSubExpression( yyvsp[-2] );
1962 1 : between->PushSubExpression( yyvsp[0] );
1963 :
1964 1 : yyval = new swq_expr_node( SWQ_NOT );
1965 1 : yyval->field_type = SWQ_BOOLEAN;
1966 1 : yyval->PushSubExpression( between );
1967 : }
1968 1 : break;
1969 :
1970 109 : case 30: /* value_expr: value_expr "IS" "NULL" */
1971 : {
1972 109 : yyval = new swq_expr_node( SWQ_ISNULL );
1973 109 : yyval->field_type = SWQ_BOOLEAN;
1974 109 : yyval->PushSubExpression( yyvsp[-2] );
1975 : }
1976 109 : break;
1977 :
1978 110 : case 31: /* value_expr: value_expr "IS" "NOT" "NULL" */
1979 : {
1980 110 : swq_expr_node *isnull = new swq_expr_node( SWQ_ISNULL );
1981 110 : isnull->field_type = SWQ_BOOLEAN;
1982 110 : isnull->PushSubExpression( yyvsp[-3] );
1983 :
1984 110 : yyval = new swq_expr_node( SWQ_NOT );
1985 110 : yyval->field_type = SWQ_BOOLEAN;
1986 110 : yyval->PushSubExpression( isnull );
1987 : }
1988 110 : break;
1989 :
1990 309 : case 32: /* value_expr_list: value_expr ',' value_expr_list */
1991 : {
1992 309 : yyval = yyvsp[0];
1993 309 : yyvsp[0]->PushSubExpression( yyvsp[-2] );
1994 : }
1995 309 : break;
1996 :
1997 495 : case 33: /* value_expr_list: value_expr */
1998 : {
1999 495 : yyval = new swq_expr_node( SWQ_ARGUMENT_LIST ); /* temporary value */
2000 495 : yyval->PushSubExpression( yyvsp[0] );
2001 : }
2002 495 : break;
2003 :
2004 9807 : case 36: /* field_value: identifier */
2005 : {
2006 9807 : yyval = yyvsp[0]; // validation deferred.
2007 9807 : yyval->eNodeType = SNT_COLUMN;
2008 9807 : yyval->field_index = -1;
2009 9807 : yyval->table_index = -1;
2010 : }
2011 9807 : break;
2012 :
2013 195 : case 37: /* field_value: identifier '.' identifier */
2014 : {
2015 195 : yyval = yyvsp[-2]; // validation deferred.
2016 195 : yyval->eNodeType = SNT_COLUMN;
2017 195 : yyval->field_index = -1;
2018 195 : yyval->table_index = -1;
2019 195 : yyval->table_name = yyval->string_value;
2020 195 : yyval->string_value = CPLStrdup(yyvsp[0]->string_value);
2021 195 : delete yyvsp[0];
2022 195 : yyvsp[0] = nullptr;
2023 : }
2024 195 : break;
2025 :
2026 12064 : case 38: /* value_expr_non_logical: "integer number" */
2027 : {
2028 12064 : yyval = yyvsp[0];
2029 : }
2030 12064 : break;
2031 :
2032 494 : case 39: /* value_expr_non_logical: "floating point number" */
2033 : {
2034 494 : yyval = yyvsp[0];
2035 : }
2036 494 : break;
2037 :
2038 1708 : case 40: /* value_expr_non_logical: "string" */
2039 : {
2040 1708 : yyval = yyvsp[0];
2041 : }
2042 1708 : break;
2043 :
2044 9862 : case 41: /* value_expr_non_logical: field_value */
2045 : {
2046 9862 : yyval = yyvsp[0];
2047 : }
2048 9862 : break;
2049 :
2050 338 : case 42: /* value_expr_non_logical: '(' value_expr ')' */
2051 : {
2052 338 : yyval = yyvsp[-1];
2053 : }
2054 338 : break;
2055 :
2056 84 : case 43: /* value_expr_non_logical: "NULL" */
2057 : {
2058 84 : yyval = new swq_expr_node(static_cast<const char*>(nullptr));
2059 : }
2060 84 : break;
2061 :
2062 2396 : case 44: /* value_expr_non_logical: '-' value_expr_non_logical */
2063 : {
2064 2396 : if (yyvsp[0]->eNodeType == SNT_CONSTANT)
2065 : {
2066 2395 : if( yyvsp[0]->field_type == SWQ_FLOAT &&
2067 32 : yyvsp[0]->string_value &&
2068 10 : strcmp(yyvsp[0]->string_value, "9223372036854775808") == 0 )
2069 : {
2070 10 : yyval = yyvsp[0];
2071 10 : yyval->field_type = SWQ_INTEGER64;
2072 10 : yyval->int_value = std::numeric_limits<GIntBig>::min();
2073 10 : yyval->float_value = static_cast<double>(std::numeric_limits<GIntBig>::min());
2074 : }
2075 : // - (-9223372036854775808) cannot be represented on int64
2076 : // the classic overflow is that its negation is itself.
2077 2397 : else if( yyvsp[0]->field_type == SWQ_INTEGER64 &&
2078 12 : yyvsp[0]->int_value == std::numeric_limits<GIntBig>::min() )
2079 : {
2080 1 : yyval = yyvsp[0];
2081 : }
2082 : else
2083 : {
2084 2384 : yyval = yyvsp[0];
2085 2384 : yyval->int_value *= -1;
2086 2384 : yyval->float_value *= -1;
2087 : }
2088 : }
2089 : else
2090 : {
2091 1 : yyval = new swq_expr_node( SWQ_MULTIPLY );
2092 1 : yyval->PushSubExpression( new swq_expr_node(-1) );
2093 1 : yyval->PushSubExpression( yyvsp[0] );
2094 : }
2095 : }
2096 2396 : break;
2097 :
2098 38 : case 45: /* value_expr_non_logical: value_expr_non_logical '+' value_expr_non_logical */
2099 : {
2100 38 : yyval = new swq_expr_node( SWQ_ADD );
2101 38 : yyval->PushSubExpression( yyvsp[-2] );
2102 38 : yyval->PushSubExpression( yyvsp[0] );
2103 : }
2104 38 : break;
2105 :
2106 15 : case 46: /* value_expr_non_logical: value_expr_non_logical '-' value_expr_non_logical */
2107 : {
2108 15 : yyval = new swq_expr_node( SWQ_SUBTRACT );
2109 15 : yyval->PushSubExpression( yyvsp[-2] );
2110 15 : yyval->PushSubExpression( yyvsp[0] );
2111 : }
2112 15 : break;
2113 :
2114 26 : case 47: /* value_expr_non_logical: value_expr_non_logical '*' value_expr_non_logical */
2115 : {
2116 26 : yyval = new swq_expr_node( SWQ_MULTIPLY );
2117 26 : yyval->PushSubExpression( yyvsp[-2] );
2118 26 : yyval->PushSubExpression( yyvsp[0] );
2119 : }
2120 26 : break;
2121 :
2122 19 : case 48: /* value_expr_non_logical: value_expr_non_logical '/' value_expr_non_logical */
2123 : {
2124 19 : yyval = new swq_expr_node( SWQ_DIVIDE );
2125 19 : yyval->PushSubExpression( yyvsp[-2] );
2126 19 : yyval->PushSubExpression( yyvsp[0] );
2127 : }
2128 19 : break;
2129 :
2130 11 : case 49: /* value_expr_non_logical: value_expr_non_logical '%' value_expr_non_logical */
2131 : {
2132 11 : yyval = new swq_expr_node( SWQ_MODULUS );
2133 11 : yyval->PushSubExpression( yyvsp[-2] );
2134 11 : yyval->PushSubExpression( yyvsp[0] );
2135 : }
2136 11 : break;
2137 :
2138 345 : case 50: /* value_expr_non_logical: identifier '(' value_expr_list ')' */
2139 : {
2140 : const swq_operation *poOp =
2141 345 : swq_op_registrar::GetOperator( yyvsp[-3]->string_value );
2142 :
2143 345 : if( poOp == nullptr )
2144 : {
2145 128 : if( context->bAcceptCustomFuncs )
2146 : {
2147 128 : yyval = yyvsp[-1];
2148 128 : yyval->eNodeType = SNT_OPERATION;
2149 128 : yyval->nOperation = SWQ_CUSTOM_FUNC;
2150 128 : yyval->string_value = CPLStrdup(yyvsp[-3]->string_value);
2151 128 : yyval->ReverseSubExpressions();
2152 128 : delete yyvsp[-3];
2153 : }
2154 : else
2155 : {
2156 0 : CPLError( CE_Failure, CPLE_AppDefined,
2157 : "Undefined function '%s' used.",
2158 0 : yyvsp[-3]->string_value );
2159 0 : delete yyvsp[-3];
2160 0 : delete yyvsp[-1];
2161 0 : YYERROR;
2162 : }
2163 : }
2164 : else
2165 : {
2166 217 : yyval = yyvsp[-1];
2167 217 : yyval->eNodeType = SNT_OPERATION;
2168 217 : yyval->nOperation = poOp->eOperation;
2169 217 : yyval->ReverseSubExpressions();
2170 217 : delete yyvsp[-3];
2171 : }
2172 : }
2173 345 : break;
2174 :
2175 88 : case 51: /* value_expr_non_logical: "CAST" '(' value_expr "AS" type_def ')' */
2176 : {
2177 88 : yyval = yyvsp[-1];
2178 88 : yyval->PushSubExpression( yyvsp[-3] );
2179 88 : yyval->ReverseSubExpressions();
2180 : }
2181 88 : break;
2182 :
2183 70 : case 52: /* type_def: identifier */
2184 : {
2185 70 : yyval = new swq_expr_node( SWQ_CAST );
2186 70 : yyval->PushSubExpression( yyvsp[0] );
2187 : }
2188 70 : break;
2189 :
2190 6 : case 53: /* type_def: identifier '(' "integer number" ')' */
2191 : {
2192 6 : yyval = new swq_expr_node( SWQ_CAST );
2193 6 : yyval->PushSubExpression( yyvsp[-1] );
2194 6 : yyval->PushSubExpression( yyvsp[-3] );
2195 : }
2196 6 : break;
2197 :
2198 2 : case 54: /* type_def: identifier '(' "integer number" ',' "integer number" ')' */
2199 : {
2200 2 : yyval = new swq_expr_node( SWQ_CAST );
2201 2 : yyval->PushSubExpression( yyvsp[-1] );
2202 2 : yyval->PushSubExpression( yyvsp[-3] );
2203 2 : yyval->PushSubExpression( yyvsp[-5] );
2204 : }
2205 2 : break;
2206 :
2207 8 : case 55: /* type_def: identifier '(' identifier ')' */
2208 : {
2209 8 : OGRwkbGeometryType eType = OGRFromOGCGeomType(yyvsp[-1]->string_value);
2210 16 : if( !EQUAL(yyvsp[-3]->string_value, "GEOMETRY") ||
2211 8 : (wkbFlatten(eType) == wkbUnknown &&
2212 1 : !STARTS_WITH_CI(yyvsp[-1]->string_value, "GEOMETRY")) )
2213 : {
2214 1 : yyerror (context, "syntax error");
2215 1 : delete yyvsp[-3];
2216 1 : delete yyvsp[-1];
2217 1 : YYERROR;
2218 : }
2219 7 : yyval = new swq_expr_node( SWQ_CAST );
2220 7 : yyval->PushSubExpression( yyvsp[-1] );
2221 7 : yyval->PushSubExpression( yyvsp[-3] );
2222 : }
2223 7 : break;
2224 :
2225 4 : case 56: /* type_def: identifier '(' identifier ',' "integer number" ')' */
2226 : {
2227 4 : OGRwkbGeometryType eType = OGRFromOGCGeomType(yyvsp[-3]->string_value);
2228 8 : if( !EQUAL(yyvsp[-5]->string_value, "GEOMETRY") ||
2229 4 : (wkbFlatten(eType) == wkbUnknown &&
2230 1 : !STARTS_WITH_CI(yyvsp[-3]->string_value, "GEOMETRY")) )
2231 : {
2232 1 : yyerror (context, "syntax error");
2233 1 : delete yyvsp[-5];
2234 1 : delete yyvsp[-3];
2235 1 : delete yyvsp[-1];
2236 1 : YYERROR;
2237 : }
2238 3 : yyval = new swq_expr_node( SWQ_CAST );
2239 3 : yyval->PushSubExpression( yyvsp[-1] );
2240 3 : yyval->PushSubExpression( yyvsp[-3] );
2241 3 : yyval->PushSubExpression( yyvsp[-5] );
2242 : }
2243 3 : break;
2244 :
2245 2764 : case 59: /* select_core: "SELECT" select_field_list "FROM" table_def opt_joins opt_where opt_order_by opt_limit opt_offset */
2246 : {
2247 2764 : delete yyvsp[-5];
2248 : }
2249 2764 : break;
2250 :
2251 34 : case 60: /* select_core: "SELECT" "DISTINCT" select_field_list "FROM" table_def opt_joins opt_where opt_order_by opt_limit opt_offset */
2252 : {
2253 34 : context->poCurSelect->query_mode = SWQM_DISTINCT_LIST;
2254 34 : delete yyvsp[-5];
2255 : }
2256 34 : break;
2257 :
2258 5 : case 63: /* union_all: "UNION" "ALL" */
2259 : {
2260 5 : swq_select* poNewSelect = new swq_select();
2261 5 : context->poCurSelect->PushUnionAll(poNewSelect);
2262 5 : context->poCurSelect = poNewSelect;
2263 : }
2264 5 : break;
2265 :
2266 17 : case 66: /* exclude_field: field_value */
2267 : {
2268 17 : if ( !context->poCurSelect->PushExcludeField( yyvsp[0] ) )
2269 : {
2270 1 : delete yyvsp[0];
2271 1 : YYERROR;
2272 : }
2273 : }
2274 16 : break;
2275 :
2276 1625 : case 71: /* column_spec: value_expr */
2277 : {
2278 1625 : if( !context->poCurSelect->PushField( yyvsp[0], nullptr, false, false ) )
2279 : {
2280 2 : delete yyvsp[0];
2281 2 : YYERROR;
2282 : }
2283 : }
2284 1623 : break;
2285 :
2286 67 : case 72: /* column_spec: value_expr as_clause_with_hidden */
2287 : {
2288 67 : if( !context->poCurSelect->PushField( yyvsp[-1], yyvsp[0]->string_value, false, yyvsp[0]->bHidden ) )
2289 : {
2290 1 : delete yyvsp[-1];
2291 1 : delete yyvsp[0];
2292 1 : YYERROR;
2293 : }
2294 66 : delete yyvsp[0];
2295 : }
2296 66 : break;
2297 :
2298 9 : case 73: /* column_spec: '*' except_or_exclude '(' exclude_field_list ')' */
2299 : {
2300 9 : swq_expr_node *poNode = new swq_expr_node();
2301 9 : poNode->eNodeType = SNT_COLUMN;
2302 9 : poNode->string_value = CPLStrdup( "*" );
2303 9 : poNode->table_index = -1;
2304 9 : poNode->field_index = -1;
2305 :
2306 9 : if( !context->poCurSelect->PushField( poNode, nullptr, false, false ) )
2307 : {
2308 0 : delete poNode;
2309 0 : YYERROR;
2310 : }
2311 : }
2312 9 : break;
2313 :
2314 1913 : case 74: /* column_spec: '*' */
2315 : {
2316 1913 : swq_expr_node *poNode = new swq_expr_node();
2317 1913 : poNode->eNodeType = SNT_COLUMN;
2318 1913 : poNode->string_value = CPLStrdup( "*" );
2319 1913 : poNode->table_index = -1;
2320 1913 : poNode->field_index = -1;
2321 :
2322 1913 : if( !context->poCurSelect->PushField( poNode, nullptr, false, false ) )
2323 : {
2324 0 : delete poNode;
2325 0 : YYERROR;
2326 : }
2327 : }
2328 1913 : break;
2329 :
2330 17 : case 75: /* column_spec: identifier '.' '*' */
2331 : {
2332 17 : CPLString osTableName = yyvsp[-2]->string_value;
2333 :
2334 17 : delete yyvsp[-2];
2335 17 : yyvsp[-2] = nullptr;
2336 :
2337 17 : swq_expr_node *poNode = new swq_expr_node();
2338 17 : poNode->eNodeType = SNT_COLUMN;
2339 17 : poNode->table_name = CPLStrdup(osTableName );
2340 17 : poNode->string_value = CPLStrdup( "*" );
2341 17 : poNode->table_index = -1;
2342 17 : poNode->field_index = -1;
2343 :
2344 17 : if( !context->poCurSelect->PushField( poNode, nullptr, false, false ) )
2345 : {
2346 0 : delete poNode;
2347 0 : YYERROR;
2348 : }
2349 : }
2350 17 : break;
2351 :
2352 407 : case 76: /* column_spec: identifier '(' '*' ')' */
2353 : {
2354 : // special case for COUNT(*), confirm it.
2355 407 : if( !EQUAL(yyvsp[-3]->string_value, "COUNT") )
2356 : {
2357 0 : CPLError( CE_Failure, CPLE_AppDefined,
2358 : "Syntax Error with %s(*).",
2359 0 : yyvsp[-3]->string_value );
2360 0 : delete yyvsp[-3];
2361 0 : YYERROR;
2362 : }
2363 :
2364 407 : delete yyvsp[-3];
2365 407 : yyvsp[-3] = nullptr;
2366 :
2367 407 : swq_expr_node *poNode = new swq_expr_node();
2368 407 : poNode->eNodeType = SNT_COLUMN;
2369 407 : poNode->string_value = CPLStrdup( "*" );
2370 407 : poNode->table_index = -1;
2371 407 : poNode->field_index = -1;
2372 :
2373 407 : swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
2374 407 : count->PushSubExpression( poNode );
2375 :
2376 407 : if( !context->poCurSelect->PushField( count, nullptr, false, false ) )
2377 : {
2378 0 : delete count;
2379 0 : YYERROR;
2380 : }
2381 : }
2382 407 : break;
2383 :
2384 0 : case 77: /* column_spec: identifier '(' '*' ')' as_clause */
2385 : {
2386 : // special case for COUNT(*), confirm it.
2387 0 : if( !EQUAL(yyvsp[-4]->string_value, "COUNT") )
2388 : {
2389 0 : CPLError( CE_Failure, CPLE_AppDefined,
2390 : "Syntax Error with %s(*).",
2391 0 : yyvsp[-4]->string_value );
2392 0 : delete yyvsp[-4];
2393 0 : delete yyvsp[0];
2394 0 : YYERROR;
2395 : }
2396 :
2397 0 : delete yyvsp[-4];
2398 0 : yyvsp[-4] = nullptr;
2399 :
2400 0 : swq_expr_node *poNode = new swq_expr_node();
2401 0 : poNode->eNodeType = SNT_COLUMN;
2402 0 : poNode->string_value = CPLStrdup( "*" );
2403 0 : poNode->table_index = -1;
2404 0 : poNode->field_index = -1;
2405 :
2406 0 : swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
2407 0 : count->PushSubExpression( poNode );
2408 :
2409 0 : if( !context->poCurSelect->PushField( count, yyvsp[0]->string_value, false, yyvsp[0]->bHidden ) )
2410 : {
2411 0 : delete count;
2412 0 : delete yyvsp[0];
2413 0 : YYERROR;
2414 : }
2415 :
2416 0 : delete yyvsp[0];
2417 : }
2418 0 : break;
2419 :
2420 9 : case 78: /* column_spec: identifier '(' "DISTINCT" field_value ')' */
2421 : {
2422 : // special case for COUNT(DISTINCT x), confirm it.
2423 9 : if( !EQUAL(yyvsp[-4]->string_value, "COUNT") )
2424 : {
2425 0 : CPLError(
2426 : CE_Failure, CPLE_AppDefined,
2427 : "DISTINCT keyword can only be used in COUNT() operator." );
2428 0 : delete yyvsp[-4];
2429 0 : delete yyvsp[-1];
2430 0 : YYERROR;
2431 : }
2432 :
2433 9 : delete yyvsp[-4];
2434 :
2435 9 : swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
2436 9 : count->PushSubExpression( yyvsp[-1] );
2437 :
2438 9 : if( !context->poCurSelect->PushField( count, nullptr, true, false ) )
2439 : {
2440 0 : delete count;
2441 0 : YYERROR;
2442 : }
2443 : }
2444 9 : break;
2445 :
2446 1 : case 79: /* column_spec: identifier '(' "DISTINCT" field_value ')' as_clause */
2447 : {
2448 : // special case for COUNT(DISTINCT x), confirm it.
2449 1 : if( !EQUAL(yyvsp[-5]->string_value, "COUNT") )
2450 : {
2451 0 : CPLError( CE_Failure, CPLE_AppDefined,
2452 : "DISTINCT keyword can only be used in COUNT() operator." );
2453 0 : delete yyvsp[-5];
2454 0 : delete yyvsp[-2];
2455 0 : delete yyvsp[0];
2456 0 : YYERROR;
2457 : }
2458 :
2459 1 : swq_expr_node *count = new swq_expr_node( SWQ_COUNT );
2460 1 : count->PushSubExpression( yyvsp[-2] );
2461 :
2462 1 : if( !context->poCurSelect->PushField( count, yyvsp[0]->string_value, true, yyvsp[0]->bHidden ) )
2463 : {
2464 0 : delete yyvsp[-5];
2465 0 : delete count;
2466 0 : delete yyvsp[0];
2467 0 : YYERROR;
2468 : }
2469 :
2470 1 : delete yyvsp[-5];
2471 1 : delete yyvsp[0];
2472 : }
2473 1 : break;
2474 :
2475 67 : case 80: /* as_clause: "AS" identifier */
2476 : {
2477 67 : yyval = yyvsp[0];
2478 67 : yyvsp[0] = nullptr;
2479 : }
2480 67 : break;
2481 :
2482 8 : case 83: /* as_clause_with_hidden: as_clause "HIDDEN" */
2483 : {
2484 8 : yyval = yyvsp[-1];
2485 8 : yyvsp[-1] = nullptr;
2486 8 : delete yyvsp[0];
2487 8 : yyvsp[0] = nullptr;
2488 8 : yyval->bHidden = true;
2489 : }
2490 8 : break;
2491 :
2492 1170 : case 85: /* opt_where: "WHERE" value_expr */
2493 : {
2494 1170 : context->poCurSelect->where_expr = yyvsp[0];
2495 : }
2496 1170 : break;
2497 :
2498 45 : case 87: /* opt_joins: "JOIN" table_def "ON" value_expr opt_joins */
2499 : {
2500 45 : context->poCurSelect->PushJoin( static_cast<int>(yyvsp[-3]->int_value),
2501 45 : yyvsp[-1] );
2502 45 : delete yyvsp[-3];
2503 : }
2504 45 : break;
2505 :
2506 27 : case 88: /* opt_joins: "LEFT" "JOIN" table_def "ON" value_expr opt_joins */
2507 : {
2508 27 : context->poCurSelect->PushJoin( static_cast<int>(yyvsp[-3]->int_value),
2509 27 : yyvsp[-1] );
2510 27 : delete yyvsp[-3];
2511 : }
2512 27 : break;
2513 :
2514 66 : case 93: /* sort_spec: field_value */
2515 : {
2516 66 : context->poCurSelect->PushOrderBy( yyvsp[0]->table_name, yyvsp[0]->string_value, TRUE );
2517 66 : delete yyvsp[0];
2518 66 : yyvsp[0] = nullptr;
2519 : }
2520 66 : break;
2521 :
2522 27 : case 94: /* sort_spec: field_value "ASC" */
2523 : {
2524 27 : context->poCurSelect->PushOrderBy( yyvsp[-1]->table_name, yyvsp[-1]->string_value, TRUE );
2525 27 : delete yyvsp[-1];
2526 27 : yyvsp[-1] = nullptr;
2527 : }
2528 27 : break;
2529 :
2530 20 : case 95: /* sort_spec: field_value "DESC" */
2531 : {
2532 20 : context->poCurSelect->PushOrderBy( yyvsp[-1]->table_name, yyvsp[-1]->string_value, FALSE );
2533 20 : delete yyvsp[-1];
2534 20 : yyvsp[-1] = nullptr;
2535 : }
2536 20 : break;
2537 :
2538 35 : case 97: /* opt_limit: "LIMIT" "integer number" */
2539 : {
2540 35 : context->poCurSelect->SetLimit( yyvsp[0]->int_value );
2541 35 : delete yyvsp[0];
2542 35 : yyvsp[0] = nullptr;
2543 : }
2544 35 : break;
2545 :
2546 19 : case 99: /* opt_offset: "OFFSET" "integer number" */
2547 : {
2548 19 : context->poCurSelect->SetOffset( yyvsp[0]->int_value );
2549 19 : delete yyvsp[0];
2550 19 : yyvsp[0] = nullptr;
2551 : }
2552 19 : break;
2553 :
2554 2837 : case 100: /* table_def: identifier */
2555 : {
2556 : const int iTable =
2557 2837 : context->poCurSelect->PushTableDef( nullptr, yyvsp[0]->string_value,
2558 : nullptr );
2559 2837 : delete yyvsp[0];
2560 :
2561 2837 : yyval = new swq_expr_node( iTable );
2562 : }
2563 2837 : break;
2564 :
2565 24 : case 101: /* table_def: identifier as_clause */
2566 : {
2567 : const int iTable =
2568 48 : context->poCurSelect->PushTableDef( nullptr, yyvsp[-1]->string_value,
2569 24 : yyvsp[0]->string_value );
2570 24 : delete yyvsp[-1];
2571 24 : delete yyvsp[0];
2572 :
2573 24 : yyval = new swq_expr_node( iTable );
2574 : }
2575 24 : break;
2576 :
2577 1 : case 102: /* table_def: "string" '.' identifier */
2578 : {
2579 : const int iTable =
2580 2 : context->poCurSelect->PushTableDef( yyvsp[-2]->string_value,
2581 1 : yyvsp[0]->string_value, nullptr );
2582 1 : delete yyvsp[-2];
2583 1 : delete yyvsp[0];
2584 :
2585 1 : yyval = new swq_expr_node( iTable );
2586 : }
2587 1 : break;
2588 :
2589 2 : case 103: /* table_def: "string" '.' identifier as_clause */
2590 : {
2591 : const int iTable =
2592 4 : context->poCurSelect->PushTableDef( yyvsp[-3]->string_value,
2593 2 : yyvsp[-1]->string_value,
2594 2 : yyvsp[0]->string_value );
2595 2 : delete yyvsp[-3];
2596 2 : delete yyvsp[-1];
2597 2 : delete yyvsp[0];
2598 :
2599 2 : yyval = new swq_expr_node( iTable );
2600 : }
2601 2 : break;
2602 :
2603 0 : case 104: /* table_def: identifier '.' identifier */
2604 : {
2605 : const int iTable =
2606 0 : context->poCurSelect->PushTableDef( yyvsp[-2]->string_value,
2607 0 : yyvsp[0]->string_value, nullptr );
2608 0 : delete yyvsp[-2];
2609 0 : delete yyvsp[0];
2610 :
2611 0 : yyval = new swq_expr_node( iTable );
2612 : }
2613 0 : break;
2614 :
2615 6 : case 105: /* table_def: identifier '.' identifier as_clause */
2616 : {
2617 : const int iTable =
2618 12 : context->poCurSelect->PushTableDef( yyvsp[-3]->string_value,
2619 6 : yyvsp[-1]->string_value,
2620 6 : yyvsp[0]->string_value );
2621 6 : delete yyvsp[-3];
2622 6 : delete yyvsp[-1];
2623 6 : delete yyvsp[0];
2624 :
2625 6 : yyval = new swq_expr_node( iTable );
2626 : }
2627 6 : break;
2628 :
2629 :
2630 :
2631 36695 : default: break;
2632 : }
2633 : /* User semantic actions sometimes alter yychar, and that requires
2634 : that yytoken be updated with the new translation. We take the
2635 : approach of translating immediately before every use of yytoken.
2636 : One alternative is translating here after every semantic action,
2637 : but that translation would be missed if the semantic action invokes
2638 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2639 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2640 : incorrect destructor might then be invoked immediately. In the
2641 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
2642 : to an incorrect destructor call or verbose syntax error message
2643 : before the lookahead is translated. */
2644 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2645 :
2646 135080 : YYPOPSTACK (yylen);
2647 135080 : yylen = 0;
2648 :
2649 135080 : *++yyvsp = yyval;
2650 :
2651 : /* Now 'shift' the result of the reduction. Determine what state
2652 : that goes to, based on the state we popped back to and the rule
2653 : number reduced by. */
2654 : {
2655 135080 : const int yylhs = yyr1[yyn] - YYNTOKENS;
2656 135080 : const int yyi = yypgoto[yylhs] + *yyssp;
2657 101812 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2658 185247 : ? yytable[yyi]
2659 84913 : : yydefgoto[yylhs]);
2660 : }
2661 :
2662 135080 : goto yynewstate;
2663 :
2664 :
2665 : /*--------------------------------------.
2666 : | yyerrlab -- here on detecting error. |
2667 : `--------------------------------------*/
2668 110 : yyerrlab:
2669 : /* Make sure we have latest lookahead translation. See comments at
2670 : user semantic actions for why this is necessary. */
2671 110 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2672 : /* If not already recovering from an error, report this error. */
2673 110 : if (!yyerrstatus)
2674 : {
2675 110 : ++yynerrs; (void)yynerrs;
2676 : {
2677 : yypcontext_t yyctx
2678 110 : = {yyssp, yytoken};
2679 110 : char const *yymsgp = YY_("syntax error");
2680 : int yysyntax_error_status;
2681 110 : yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2682 110 : if (yysyntax_error_status == 0)
2683 110 : yymsgp = yymsg;
2684 0 : else if (yysyntax_error_status == -1)
2685 : {
2686 0 : if (yymsg != yymsgbuf)
2687 0 : YYSTACK_FREE (yymsg);
2688 0 : yymsg = YY_CAST (char *,
2689 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2690 0 : if (yymsg)
2691 : {
2692 : yysyntax_error_status
2693 0 : = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2694 0 : yymsgp = yymsg;
2695 : }
2696 : else
2697 : {
2698 0 : yymsg = yymsgbuf;
2699 0 : yymsg_alloc = sizeof yymsgbuf;
2700 0 : yysyntax_error_status = YYENOMEM;
2701 : }
2702 : }
2703 110 : yyerror (context, yymsgp);
2704 110 : if (yysyntax_error_status == YYENOMEM)
2705 0 : YYNOMEM;
2706 : }
2707 : }
2708 :
2709 110 : if (yyerrstatus == 3)
2710 : {
2711 : /* If just tried and failed to reuse lookahead token after an
2712 : error, discard it. */
2713 :
2714 0 : if (yychar <= END)
2715 : {
2716 : /* Return failure if at end of input. */
2717 0 : if (yychar == END)
2718 0 : YYABORT;
2719 : }
2720 : else
2721 : {
2722 0 : yydestruct ("Error: discarding",
2723 : yytoken, &yylval, context);
2724 0 : yychar = YYEMPTY;
2725 : }
2726 : }
2727 :
2728 : /* Else will try to reuse lookahead token after shifting the error
2729 : token. */
2730 110 : goto yyerrlab1;
2731 :
2732 :
2733 : /*---------------------------------------------------.
2734 : | yyerrorlab -- error raised explicitly by YYERROR. |
2735 : `---------------------------------------------------*/
2736 6 : yyerrorlab:
2737 : /* Pacify compilers when the user code never invokes YYERROR and the
2738 : label yyerrorlab therefore never appears in user code. */
2739 : if (0)
2740 : YYERROR;
2741 6 : ++yynerrs; (void)yynerrs;
2742 :
2743 : /* Do not reclaim the symbols of the rule whose action triggered
2744 : this YYERROR. */
2745 6 : YYPOPSTACK (yylen);
2746 6 : yylen = 0;
2747 : YY_STACK_PRINT (yyss, yyssp);
2748 6 : yystate = *yyssp;
2749 6 : goto yyerrlab1;
2750 :
2751 :
2752 : /*-------------------------------------------------------------.
2753 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2754 : `-------------------------------------------------------------*/
2755 117 : yyerrlab1:
2756 117 : yyerrstatus = 3; /* Each real token shifted decrements this. */
2757 :
2758 : /* Pop stack until we find a state that shifts the error token. */
2759 : for (;;)
2760 : {
2761 307 : yyn = yypact[yystate];
2762 307 : if (!yypact_value_is_default (yyn))
2763 : {
2764 307 : yyn += YYSYMBOL_YYerror;
2765 307 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2766 : {
2767 0 : yyn = yytable[yyn];
2768 0 : if (0 < yyn)
2769 0 : break;
2770 : }
2771 : }
2772 :
2773 : /* Pop the current state because it cannot handle the error token. */
2774 307 : if (yyssp == yyss)
2775 117 : YYABORT;
2776 :
2777 :
2778 190 : yydestruct ("Error: popping",
2779 190 : YY_ACCESSING_SYMBOL (yystate), yyvsp, context);
2780 190 : YYPOPSTACK (1);
2781 190 : yystate = *yyssp;
2782 : YY_STACK_PRINT (yyss, yyssp);
2783 : }
2784 :
2785 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2786 0 : *++yyvsp = yylval;
2787 : YY_IGNORE_MAYBE_UNINITIALIZED_END
2788 :
2789 :
2790 : /* Shift the error token. */
2791 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2792 :
2793 0 : yystate = yyn;
2794 0 : goto yynewstate;
2795 :
2796 :
2797 : /*-------------------------------------.
2798 : | yyacceptlab -- YYACCEPT comes here. |
2799 : `-------------------------------------*/
2800 7926 : yyacceptlab:
2801 7926 : yyresult = 0;
2802 7926 : goto yyreturnlab;
2803 :
2804 :
2805 : /*-----------------------------------.
2806 : | yyabortlab -- YYABORT comes here. |
2807 : `-----------------------------------*/
2808 117 : yyabortlab:
2809 117 : yyresult = 1;
2810 117 : goto yyreturnlab;
2811 :
2812 :
2813 : /*-----------------------------------------------------------.
2814 : | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2815 : `-----------------------------------------------------------*/
2816 0 : yyexhaustedlab:
2817 0 : yyerror (context, YY_("memory exhausted"));
2818 0 : yyresult = 2;
2819 0 : goto yyreturnlab;
2820 :
2821 :
2822 : /*----------------------------------------------------------.
2823 : | yyreturnlab -- parsing is finished, clean up and return. |
2824 : `----------------------------------------------------------*/
2825 8043 : yyreturnlab:
2826 8043 : if (yychar != YYEMPTY)
2827 : {
2828 : /* Make sure we have latest lookahead translation. See comments at
2829 : user semantic actions for why this is necessary. */
2830 114 : yytoken = YYTRANSLATE (yychar);
2831 114 : yydestruct ("Cleanup: discarding lookahead",
2832 : yytoken, &yylval, context);
2833 : }
2834 : /* Do not reclaim the symbols of the rule whose action triggered
2835 : this YYABORT or YYACCEPT. */
2836 8043 : YYPOPSTACK (yylen);
2837 : YY_STACK_PRINT (yyss, yyssp);
2838 23895 : while (yyssp != yyss)
2839 : {
2840 15852 : yydestruct ("Cleanup: popping",
2841 15852 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, context);
2842 15852 : YYPOPSTACK (1);
2843 : }
2844 : #ifndef yyoverflow
2845 8043 : if (yyss != yyssa)
2846 1 : YYSTACK_FREE (yyss);
2847 : #endif
2848 8043 : if (yymsg != yymsgbuf)
2849 0 : YYSTACK_FREE (yymsg);
2850 8043 : return yyresult;
2851 : }
2852 :
|