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