2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
66 /* Substitute the variable and function names. */
67 #define yyparse sql_parse
69 #define yyerror sql_error
70 #define yylval sql_lval
71 #define yychar sql_char
72 #define yydebug sql_debug
73 #define yynerrs sql_nerrs
75 /* Copy the first part of user declarations. */
77 /* Line 189 of yacc.c */
82 * Implementation of the Microsoft Installer (msi.dll)
84 * Copyright 2002-2004 Mike McCormack for CodeWeavers
86 * This library is free software; you can redistribute it and/or
87 * modify it under the terms of the GNU Lesser General Public
88 * License as published by the Free Software Foundation; either
89 * version 2.1 of the License, or (at your option) any later version.
91 * This library is distributed in the hope that it will be useful,
92 * but WITHOUT ANY WARRANTY; without even the implied warranty of
93 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94 * Lesser General Public License for more details.
96 * You should have received a copy of the GNU Lesser General Public
97 * License along with this library; if not, write to the Free Software
98 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
111 #include "wine/list.h"
112 #include "wine/debug.h"
113 #include "wine/unicode.h"
115 #define YYLEX_PARAM info
116 #define YYPARSE_PARAM info
118 static int sql_error(const char *str
);
120 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
122 typedef struct tag_SQL_input
128 MSIVIEW
**view
; /* View structure for the resulting query. This value
129 * tracks the view currently being created so we can free
130 * this view on syntax error.
135 static UINT
SQL_getstring( void *info
, const struct sql_str
*strdata
, LPWSTR
*str
);
136 static INT
SQL_getint( void *info
);
137 static int sql_lex( void *SQL_lval
, SQL_input
*info
);
139 static LPWSTR
parser_add_table( void *info
, LPCWSTR list
, LPCWSTR table
);
140 static void *parser_alloc( void *info
, unsigned int sz
);
141 static column_info
*parser_alloc_column( void *info
, LPCWSTR table
, LPCWSTR column
);
143 static BOOL
SQL_MarkPrimaryKeys( column_info
**cols
, column_info
*keys
);
145 static struct expr
* EXPR_complex( void *info
, struct expr
*l
, UINT op
, struct expr
*r
);
146 static struct expr
* EXPR_unary( void *info
, struct expr
*l
, UINT op
);
147 static struct expr
* EXPR_column( void *info
, const column_info
*column
);
148 static struct expr
* EXPR_ival( void *info
, int val
);
149 static struct expr
* EXPR_sval( void *info
, const struct sql_str
*str
);
150 static struct expr
* EXPR_wildcard( void *info
);
152 #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \
153 *sql->view = current_view; \
154 result = current_view
158 /* Line 189 of yacc.c */
159 #line 161 "sql.tab.c"
161 /* Enabling traces. */
166 /* Enabling verbose error messages. */
167 #ifdef YYERROR_VERBOSE
168 # undef YYERROR_VERBOSE
169 # define YYERROR_VERBOSE 1
171 # define YYERROR_VERBOSE 0
174 /* Enabling the token table. */
175 #ifndef YYTOKEN_TABLE
176 # define YYTOKEN_TABLE 0
183 /* Put the tokens into the symbol table, so that GDB and other debuggers
216 TK_LOCALIZABLE
= 288,
241 UNCLOSED_STRING
= 314,
252 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
253 typedef union YYSTYPE
256 /* Line 214 of yacc.c */
261 column_info
*column_list
;
269 /* Line 214 of yacc.c */
270 #line 272 "sql.tab.c"
272 # define YYSTYPE_IS_TRIVIAL 1
273 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
274 # define YYSTYPE_IS_DECLARED 1
278 /* Copy the second part of user declarations. */
281 /* Line 264 of yacc.c */
282 #line 276 "sql.tab.c"
289 typedef YYTYPE_UINT8 yytype_uint8
;
291 typedef unsigned char yytype_uint8
;
295 typedef YYTYPE_INT8 yytype_int8
;
296 #elif (defined __STDC__ || defined __C99__FUNC__ \
297 || defined __cplusplus || defined _MSC_VER)
298 typedef signed char yytype_int8
;
300 typedef short int yytype_int8
;
304 typedef YYTYPE_UINT16 yytype_uint16
;
306 typedef unsigned short int yytype_uint16
;
310 typedef YYTYPE_INT16 yytype_int16
;
312 typedef short int yytype_int16
;
316 # ifdef __SIZE_TYPE__
317 # define YYSIZE_T __SIZE_TYPE__
318 # elif defined size_t
319 # define YYSIZE_T size_t
320 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
321 || defined __cplusplus || defined _MSC_VER)
322 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
323 # define YYSIZE_T size_t
325 # define YYSIZE_T unsigned int
329 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
334 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
335 # define YY_(msgid) dgettext ("bison-runtime", msgid)
339 # define YY_(msgid) msgid
343 /* Suppress unused-variable warnings by "using" E. */
344 #if ! defined lint || defined __GNUC__
345 # define YYUSE(e) ((void) (e))
347 # define YYUSE(e) /* empty */
350 /* Identity function, used to suppress warnings about constant conditions. */
354 #if (defined __STDC__ || defined __C99__FUNC__ \
355 || defined __cplusplus || defined _MSC_VER)
368 #if ! defined yyoverflow || YYERROR_VERBOSE
370 /* The parser invokes alloca or malloc; define the necessary symbols. */
372 # ifdef YYSTACK_USE_ALLOCA
373 # if YYSTACK_USE_ALLOCA
375 # define YYSTACK_ALLOC __builtin_alloca
376 # elif defined __BUILTIN_VA_ARG_INCR
377 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
379 # define YYSTACK_ALLOC __alloca
380 # elif defined _MSC_VER
381 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
382 # define alloca _alloca
384 # define YYSTACK_ALLOC alloca
385 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
386 || defined __cplusplus || defined _MSC_VER)
387 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
396 # ifdef YYSTACK_ALLOC
397 /* Pacify GCC's `empty if-body' warning. */
398 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
399 # ifndef YYSTACK_ALLOC_MAXIMUM
400 /* The OS might guarantee only one guard page at the bottom of the stack,
401 and a page size can be as small as 4096 bytes. So we cannot safely
402 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
403 to allow for a few compiler-allocated temporary stack slots. */
404 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
407 # define YYSTACK_ALLOC YYMALLOC
408 # define YYSTACK_FREE YYFREE
409 # ifndef YYSTACK_ALLOC_MAXIMUM
410 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
412 # if (defined __cplusplus && ! defined _STDLIB_H \
413 && ! ((defined YYMALLOC || defined malloc) \
414 && (defined YYFREE || defined free)))
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
421 # define YYMALLOC malloc
422 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
423 || defined __cplusplus || defined _MSC_VER)
424 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
429 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
430 || defined __cplusplus || defined _MSC_VER)
431 void free (void *); /* INFRINGES ON USER NAME SPACE */
435 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
438 #if (! defined yyoverflow \
439 && (! defined __cplusplus \
440 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
442 /* A type that is properly aligned for any stack member. */
445 yytype_int16 yyss_alloc
;
449 /* The size of the maximum gap between one aligned stack and the next. */
450 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
452 /* The size of an array large to enough to hold all stacks, each with
454 # define YYSTACK_BYTES(N) \
455 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
456 + YYSTACK_GAP_MAXIMUM)
458 /* Copy COUNT objects from FROM to TO. The source and destination do
461 # if defined __GNUC__ && 1 < __GNUC__
462 # define YYCOPY(To, From, Count) \
463 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
465 # define YYCOPY(To, From, Count) \
469 for (yyi = 0; yyi < (Count); yyi++) \
470 (To)[yyi] = (From)[yyi]; \
476 /* Relocate STACK from its old location to the new one. The
477 local variables YYSIZE and YYSTACKSIZE give the old and new number of
478 elements in the stack, and YYPTR gives the new location of the
479 stack. Advance YYPTR to a properly aligned location for the next
481 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
484 YYSIZE_T yynewbytes; \
485 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
486 Stack = &yyptr->Stack_alloc; \
487 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
488 yyptr += yynewbytes / sizeof (*yyptr); \
494 /* YYFINAL -- State number of the termination state. */
496 /* YYLAST -- Last index in YYTABLE. */
499 /* YYNTOKENS -- Number of terminals. */
501 /* YYNNTS -- Number of nonterminals. */
503 /* YYNRULES -- Number of rules. */
505 /* YYNRULES -- Number of states. */
506 #define YYNSTATES 154
508 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
510 #define YYMAXUTOK 319
512 #define YYTRANSLATE(YYX) \
513 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
515 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
516 static const yytype_uint8 yytranslate
[] =
518 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
544 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
545 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
546 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
547 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
548 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
549 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
553 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
555 static const yytype_uint16 yyprhs
[] =
557 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
558 19, 30, 42, 49, 57, 64, 69, 72, 77, 83,
559 90, 92, 94, 98, 103, 107, 109, 112, 114, 117,
560 120, 122, 126, 128, 133, 135, 137, 139, 141, 143,
561 145, 148, 152, 155, 157, 161, 163, 165, 169, 171,
562 174, 179, 181, 184, 189, 191, 195, 199, 203, 207,
563 211, 215, 219, 223, 227, 231, 235, 240, 242, 244,
564 246, 250, 252, 256, 260, 262, 265, 267, 269, 271,
565 275, 277, 281, 283, 285, 287, 289, 291
568 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
569 static const yytype_int8 yyrhs
[] =
571 66, 0, -1, 67, -1, 82, -1, 69, -1, 68,
572 -1, 70, -1, 71, -1, 72, -1, 74, -1, 22,
573 25, 98, 31, 85, 42, 52, 31, 91, 42, -1,
574 22, 25, 98, 31, 85, 42, 52, 31, 91, 42,
575 50, -1, 8, 49, 98, 31, 75, 42, -1, 8,
576 49, 98, 31, 75, 42, 18, -1, 51, 98, 44,
577 92, 53, 89, -1, 51, 98, 44, 92, -1, 9,
578 86, -1, 3, 49, 98, 73, -1, 3, 49, 98,
579 19, 77, -1, 3, 49, 98, 19, 77, 18, -1,
580 18, -1, 14, -1, 10, 49, 98, -1, 76, 41,
581 27, 85, -1, 76, 7, 77, -1, 77, -1, 96,
582 78, -1, 79, -1, 79, 33, -1, 79, 50, -1,
583 80, -1, 80, 36, 37, -1, 6, -1, 6, 31,
584 81, 42, -1, 30, -1, 45, -1, 23, -1, 29,
585 -1, 38, -1, 101, -1, 43, 83, -1, 43, 11,
586 83, -1, 84, 86, -1, 97, -1, 97, 7, 84,
587 -1, 47, -1, 96, -1, 96, 7, 85, -1, 47,
588 -1, 15, 98, -1, 87, 40, 5, 85, -1, 87,
589 -1, 15, 88, -1, 15, 88, 53, 89, -1, 98,
590 -1, 98, 7, 88, -1, 31, 89, 42, -1, 89,
591 4, 89, -1, 89, 39, 89, -1, 95, 13, 90,
592 -1, 95, 17, 90, -1, 95, 32, 90, -1, 95,
593 28, 90, -1, 95, 16, 90, -1, 95, 35, 90,
594 -1, 95, 26, 37, -1, 95, 26, 36, 37, -1,
595 95, -1, 94, -1, 94, -1, 94, 7, 91, -1,
596 93, -1, 93, 7, 92, -1, 96, 13, 94, -1,
597 101, -1, 34, 101, -1, 48, -1, 54, -1, 96,
598 -1, 98, 12, 99, -1, 99, -1, 98, 12, 99,
599 -1, 99, -1, 100, -1, 99, -1, 20, -1, 48,
603 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
604 static const yytype_uint16 yyrline
[] =
606 0, 132, 132, 140, 141, 142, 143, 144, 145, 146,
607 150, 161, 175, 192, 208, 219, 233, 247, 258, 269,
608 283, 287, 294, 309, 319, 329, 336, 345, 349, 353,
609 360, 364, 371, 375, 379, 383, 387, 391, 395, 402,
610 411, 415, 430, 450, 451, 455, 462, 463, 467, 474,
611 486, 499, 503, 515, 530, 534, 543, 549, 555, 561,
612 567, 573, 579, 585, 591, 597, 603, 612, 613, 617,
613 624, 635, 636, 644, 652, 658, 664, 670, 679, 688,
614 694, 703, 709, 715, 724, 731, 739, 747
618 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
619 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
620 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
621 static const char *const yytname
[] =
623 "$end", "error", "$undefined", "TK_ALTER", "TK_AND", "TK_BY", "TK_CHAR",
624 "TK_COMMA", "TK_CREATE", "TK_DELETE", "TK_DROP", "TK_DISTINCT", "TK_DOT",
625 "TK_EQ", "TK_FREE", "TK_FROM", "TK_GE", "TK_GT", "TK_HOLD", "TK_ADD",
626 "TK_ID", "TK_ILLEGAL", "TK_INSERT", "TK_INT", "TK_INTEGER", "TK_INTO",
627 "TK_IS", "TK_KEY", "TK_LE", "TK_LONG", "TK_LONGCHAR", "TK_LP", "TK_LT",
628 "TK_LOCALIZABLE", "TK_MINUS", "TK_NE", "TK_NOT", "TK_NULL", "TK_OBJECT",
629 "TK_OR", "TK_ORDER", "TK_PRIMARY", "TK_RP", "TK_SELECT", "TK_SET",
630 "TK_SHORT", "TK_SPACE", "TK_STAR", "TK_STRING", "TK_TABLE",
631 "TK_TEMPORARY", "TK_UPDATE", "TK_VALUES", "TK_WHERE", "TK_WILDCARD",
632 "AGG_FUNCTION.", "COLUMN", "FUNCTION", "COMMENT", "UNCLOSED_STRING",
633 "SPACE", "ILLEGAL", "END_OF_FILE", "TK_LIKE", "TK_NEGATION", "$accept",
634 "query", "onequery", "oneinsert", "onecreate", "oneupdate", "onedelete",
635 "onealter", "alterop", "onedrop", "table_def", "column_def",
636 "column_and_type", "column_type", "data_type_l", "data_type",
637 "data_count", "oneselect", "selectfrom", "selcollist", "collist", "from",
638 "unorderdfrom", "tablelist", "expr", "val", "constlist",
639 "update_assign_list", "column_assignment", "const_val", "column_val",
640 "column", "selcolumn", "table", "id", "string", "number", 0
645 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
647 static const yytype_uint16 yytoknum
[] =
649 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
650 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
651 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
652 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
653 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
654 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
655 315, 316, 317, 318, 319
659 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
660 static const yytype_uint8 yyr1
[] =
662 0, 65, 66, 67, 67, 67, 67, 67, 67, 67,
663 68, 68, 69, 69, 70, 70, 71, 72, 72, 72,
664 73, 73, 74, 75, 76, 76, 77, 78, 78, 78,
665 79, 79, 80, 80, 80, 80, 80, 80, 80, 81,
666 82, 82, 83, 84, 84, 84, 85, 85, 85, 86,
667 86, 86, 87, 87, 88, 88, 89, 89, 89, 89,
668 89, 89, 89, 89, 89, 89, 89, 90, 90, 91,
669 91, 92, 92, 93, 94, 94, 94, 94, 95, 96,
670 96, 97, 97, 97, 98, 99, 100, 101
673 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
674 static const yytype_uint8 yyr2
[] =
676 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
677 10, 11, 6, 7, 6, 4, 2, 4, 5, 6,
678 1, 1, 3, 4, 3, 1, 2, 1, 2, 2,
679 1, 3, 1, 4, 1, 1, 1, 1, 1, 1,
680 2, 3, 2, 1, 3, 1, 1, 3, 1, 2,
681 4, 1, 2, 4, 1, 3, 3, 3, 3, 3,
682 3, 3, 3, 3, 3, 3, 4, 1, 1, 1,
683 3, 1, 3, 3, 1, 2, 1, 1, 1, 3,
684 1, 3, 1, 1, 1, 1, 1, 1
687 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
688 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
689 means the default is an error. */
690 static const yytype_uint8 yydefact
[] =
692 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
693 5, 4, 6, 7, 8, 9, 3, 0, 0, 0,
694 16, 51, 0, 0, 0, 85, 45, 86, 40, 0,
695 43, 0, 82, 83, 0, 84, 1, 0, 0, 52,
696 54, 0, 22, 0, 41, 42, 0, 0, 0, 21,
697 20, 0, 17, 0, 0, 0, 0, 0, 44, 81,
698 15, 71, 0, 0, 80, 18, 0, 0, 0, 25,
699 0, 53, 0, 78, 55, 54, 48, 50, 46, 0,
700 0, 0, 0, 0, 19, 32, 36, 37, 34, 38,
701 35, 26, 27, 30, 12, 0, 0, 0, 0, 0,
702 0, 0, 0, 0, 0, 0, 0, 0, 0, 14,
703 72, 87, 0, 76, 77, 73, 74, 79, 0, 28,
704 29, 0, 13, 24, 0, 56, 57, 58, 59, 68,
705 67, 63, 60, 0, 65, 62, 61, 64, 47, 0,
706 75, 0, 39, 31, 23, 66, 0, 33, 0, 69,
710 /* YYDEFGOTO[NTERM-NUM]. */
711 static const yytype_int16 yydefgoto
[] =
713 -1, 8, 9, 10, 11, 12, 13, 14, 52, 15,
714 67, 68, 65, 91, 92, 93, 141, 16, 28, 29,
715 77, 20, 21, 39, 71, 128, 148, 60, 61, 129,
716 130, 73, 30, 63, 64, 33, 116
719 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
721 #define YYPACT_NINF -80
722 static const yytype_int16 yypact
[] =
724 36, -44, -39, -1, -26, 9, 50, 37, 56, -80,
725 -80, -80, -80, -80, -80, -80, -80, 37, 37, 37,
726 -80, 25, 37, 37, -18, -80, -80, -80, -80, -1,
727 78, 47, 76, -80, 57, -80, -80, 105, 72, 51,
728 55, 100, -80, 81, -80, -80, -18, 37, 37, -80,
729 -80, 37, -80, 37, 62, 37, -12, -12, -80, -80,
730 63, 102, 108, 101, 76, 97, 45, 83, 2, -80,
731 62, 3, 94, -80, -80, 126, -80, -80, 127, 93,
732 62, 37, 52, 37, -80, 106, -80, -80, -80, -80,
733 -80, -80, 31, 103, 118, 37, 111, 11, 62, 62,
734 60, 60, 60, -11, 60, 60, 60, -12, 88, 3,
735 -80, -80, 117, -80, -80, -80, -80, -80, 117, -80,
736 -80, 107, -80, -80, -12, -80, -80, 138, -80, -80,
737 -80, -80, -80, 109, -80, -80, -80, -80, -80, 112,
738 -80, 110, -80, -80, -80, -80, 52, -80, 113, 140,
742 /* YYPGOTO[NTERM-NUM]. */
743 static const yytype_int8 yypgoto
[] =
745 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
746 -80, -80, -47, -80, -80, -80, -80, -80, 124, 104,
747 -53, 120, -80, 96, 19, 26, 5, 73, -80, -79,
748 -7, -29, -80, 14, -6, -80, -16
751 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
752 positive, shift that token. If negative, reduce the rule which
753 number is the opposite. If zero, do what YYDEFACT says.
754 If YYTABLE_NINF, syntax error. */
755 #define YYTABLE_NINF -85
756 static const yytype_int16 yytable
[] =
758 32, 35, 25, 115, 79, 17, 69, 98, 25, 95,
759 18, 35, 35, 35, 19, 98, 35, 35, 32, 62,
760 31, 34, 66, 22, 66, 133, 134, 78, 78, 26,
761 27, 37, 38, 40, 23, 76, 42, 43, 31, 1,
762 32, 59, 99, 96, 2, 3, 4, 72, 123, 35,
763 99, 85, 62, 125, 138, -49, 36, 25, 5, 47,
764 31, 24, 55, 72, 119, 41, 66, 149, 86, 75,
765 25, 144, 149, 72, 87, 88, 111, 117, 78, 6,
766 25, 120, 25, 89, 111, 46, 112, 7, -84, 97,
767 90, 72, 72, 70, 112, 78, 140, 26, 27, 109,
768 113, 48, 142, 53, 54, 56, 114, 100, 113, 81,
769 101, 102, 57, 83, 114, 84, 80, 126, 127, 49,
770 103, 82, 104, 50, 51, 94, 105, 131, 132, 106,
771 135, 136, 137, 55, 107, 108, 122, 118, 124, 121,
772 139, 111, 98, 146, 143, 152, 145, 151, 44, 45,
773 58, 74, 147, 0, 110, 150, 153
776 static const yytype_int16 yycheck
[] =
778 6, 7, 20, 82, 57, 49, 53, 4, 20, 7,
779 49, 17, 18, 19, 15, 4, 22, 23, 24, 48,
780 6, 7, 51, 49, 53, 36, 37, 56, 57, 47,
781 48, 17, 18, 19, 25, 47, 22, 23, 24, 3,
782 46, 47, 39, 41, 8, 9, 10, 54, 95, 55,
783 39, 6, 81, 42, 107, 0, 0, 20, 22, 12,
784 46, 11, 7, 70, 33, 40, 95, 146, 23, 55,
785 20, 124, 151, 80, 29, 30, 24, 83, 107, 43,
786 20, 50, 20, 38, 24, 7, 34, 51, 12, 70,
787 45, 98, 99, 31, 34, 124, 112, 47, 48, 80,
788 48, 44, 118, 31, 53, 5, 54, 13, 48, 7,
789 16, 17, 31, 12, 54, 18, 53, 98, 99, 14,
790 26, 13, 28, 18, 19, 42, 32, 101, 102, 35,
791 104, 105, 106, 7, 7, 42, 18, 31, 27, 36,
792 52, 24, 4, 31, 37, 50, 37, 7, 24, 29,
793 46, 55, 42, -1, 81, 42, 151
796 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
797 symbol of state STATE-NUM. */
798 static const yytype_uint8 yystos
[] =
800 0, 3, 8, 9, 10, 22, 43, 51, 66, 67,
801 68, 69, 70, 71, 72, 74, 82, 49, 49, 15,
802 86, 87, 49, 25, 11, 20, 47, 48, 83, 84,
803 97, 98, 99, 100, 98, 99, 0, 98, 98, 88,
804 98, 40, 98, 98, 83, 86, 7, 12, 44, 14,
805 18, 19, 73, 31, 53, 7, 5, 31, 84, 99,
806 92, 93, 96, 98, 99, 77, 96, 75, 76, 77,
807 31, 89, 95, 96, 88, 98, 47, 85, 96, 85,
808 53, 7, 13, 12, 18, 6, 23, 29, 30, 38,
809 45, 78, 79, 80, 42, 7, 41, 89, 4, 39,
810 13, 16, 17, 26, 28, 32, 35, 7, 42, 89,
811 92, 24, 34, 48, 54, 94, 101, 99, 31, 33,
812 50, 36, 18, 77, 27, 42, 89, 89, 90, 94,
813 95, 90, 90, 36, 37, 90, 90, 90, 85, 52,
814 101, 81, 101, 37, 85, 37, 31, 42, 91, 94,
818 #define yyerrok (yyerrstatus = 0)
819 #define yyclearin (yychar = YYEMPTY)
823 #define YYACCEPT goto yyacceptlab
824 #define YYABORT goto yyabortlab
825 #define YYERROR goto yyerrorlab
828 /* Like YYERROR except do call yyerror. This remains here temporarily
829 to ease the transition to the new meaning of YYERROR, for GCC.
830 Once GCC version 2 has supplanted version 1, this can go. */
832 #define YYFAIL goto yyerrlab
834 #define YYRECOVERING() (!!yyerrstatus)
836 #define YYBACKUP(Token, Value) \
838 if (yychar == YYEMPTY && yylen == 1) \
842 yytoken = YYTRANSLATE (yychar); \
848 yyerror (YY_("syntax error: cannot back up")); \
855 #define YYERRCODE 256
858 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
859 If N is 0, then set CURRENT to the empty location which ends
860 the previous symbol: RHS[0] (always defined). */
862 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
863 #ifndef YYLLOC_DEFAULT
864 # define YYLLOC_DEFAULT(Current, Rhs, N) \
868 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
869 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
870 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
871 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
875 (Current).first_line = (Current).last_line = \
876 YYRHSLOC (Rhs, 0).last_line; \
877 (Current).first_column = (Current).last_column = \
878 YYRHSLOC (Rhs, 0).last_column; \
884 /* YY_LOCATION_PRINT -- Print the location on the stream.
885 This macro was not mandated originally: define only if we know
886 we won't break user code: when these are the locations we know. */
888 #ifndef YY_LOCATION_PRINT
889 # if YYLTYPE_IS_TRIVIAL
890 # define YY_LOCATION_PRINT(File, Loc) \
891 fprintf (File, "%d.%d-%d.%d", \
892 (Loc).first_line, (Loc).first_column, \
893 (Loc).last_line, (Loc).last_column)
895 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
900 /* YYLEX -- calling `yylex' with the right arguments. */
903 # define YYLEX yylex (&yylval, YYLEX_PARAM)
905 # define YYLEX yylex (&yylval)
908 /* Enable debugging if requested. */
912 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
913 # define YYFPRINTF fprintf
916 # define YYDPRINTF(Args) \
922 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
926 YYFPRINTF (stderr, "%s ", Title); \
927 yy_symbol_print (stderr, \
929 YYFPRINTF (stderr, "\n"); \
934 /*--------------------------------.
935 | Print this symbol on YYOUTPUT. |
936 `--------------------------------*/
939 #if (defined __STDC__ || defined __C99__FUNC__ \
940 || defined __cplusplus || defined _MSC_VER)
942 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
945 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
948 YYSTYPE
const * const yyvaluep
;
954 if (yytype
< YYNTOKENS
)
955 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
967 /*--------------------------------.
968 | Print this symbol on YYOUTPUT. |
969 `--------------------------------*/
971 #if (defined __STDC__ || defined __C99__FUNC__ \
972 || defined __cplusplus || defined _MSC_VER)
974 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
977 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
980 YYSTYPE
const * const yyvaluep
;
983 if (yytype
< YYNTOKENS
)
984 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
986 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
988 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
989 YYFPRINTF (yyoutput
, ")");
992 /*------------------------------------------------------------------.
993 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
995 `------------------------------------------------------------------*/
997 #if (defined __STDC__ || defined __C99__FUNC__ \
998 || defined __cplusplus || defined _MSC_VER)
1000 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1003 yy_stack_print (yybottom
, yytop
)
1004 yytype_int16
*yybottom
;
1005 yytype_int16
*yytop
;
1008 YYFPRINTF (stderr
, "Stack now");
1009 for (; yybottom
<= yytop
; yybottom
++)
1011 int yybot
= *yybottom
;
1012 YYFPRINTF (stderr
, " %d", yybot
);
1014 YYFPRINTF (stderr
, "\n");
1017 # define YY_STACK_PRINT(Bottom, Top) \
1020 yy_stack_print ((Bottom), (Top)); \
1024 /*------------------------------------------------.
1025 | Report that the YYRULE is going to be reduced. |
1026 `------------------------------------------------*/
1028 #if (defined __STDC__ || defined __C99__FUNC__ \
1029 || defined __cplusplus || defined _MSC_VER)
1031 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
1034 yy_reduce_print (yyvsp
, yyrule
)
1039 int yynrhs
= yyr2
[yyrule
];
1041 unsigned long int yylno
= yyrline
[yyrule
];
1042 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1044 /* The symbols being reduced. */
1045 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1047 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1048 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1049 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1051 YYFPRINTF (stderr
, "\n");
1055 # define YY_REDUCE_PRINT(Rule) \
1058 yy_reduce_print (yyvsp, Rule); \
1061 /* Nonzero means print parse trace. It is left uninitialized so that
1062 multiple parsers can coexist. */
1064 #else /* !YYDEBUG */
1065 # define YYDPRINTF(Args)
1066 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1067 # define YY_STACK_PRINT(Bottom, Top)
1068 # define YY_REDUCE_PRINT(Rule)
1069 #endif /* !YYDEBUG */
1072 /* YYINITDEPTH -- initial size of the parser's stacks. */
1074 # define YYINITDEPTH 200
1077 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1078 if the built-in stack extension method is used).
1080 Do not make this value too large; the results are undefined if
1081 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1082 evaluated with infinite-precision integer arithmetic. */
1085 # define YYMAXDEPTH 10000
1093 # if defined __GLIBC__ && defined _STRING_H
1094 # define yystrlen strlen
1096 /* Return the length of YYSTR. */
1097 #if (defined __STDC__ || defined __C99__FUNC__ \
1098 || defined __cplusplus || defined _MSC_VER)
1100 yystrlen (const char *yystr
)
1108 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1116 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1117 # define yystpcpy stpcpy
1119 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1121 #if (defined __STDC__ || defined __C99__FUNC__ \
1122 || defined __cplusplus || defined _MSC_VER)
1124 yystpcpy (char *yydest
, const char *yysrc
)
1127 yystpcpy (yydest
, yysrc
)
1133 const char *yys
= yysrc
;
1135 while ((*yyd
++ = *yys
++) != '\0')
1144 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1145 quotes and backslashes, so that it's suitable for yyerror. The
1146 heuristic is that double-quoting is unnecessary unless the string
1147 contains an apostrophe, a comma, or backslash (other than
1148 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1149 null, do not copy; instead, return the length of what the result
1152 yytnamerr (char *yyres
, const char *yystr
)
1157 char const *yyp
= yystr
;
1164 goto do_not_strip_quotes
;
1168 goto do_not_strip_quotes
;
1181 do_not_strip_quotes
: ;
1185 return yystrlen (yystr
);
1187 return yystpcpy (yyres
, yystr
) - yyres
;
1191 /* Copy into YYRESULT an error message about the unexpected token
1192 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1193 including the terminating null byte. If YYRESULT is null, do not
1194 copy anything; just return the number of bytes that would be
1195 copied. As a special case, return 0 if an ordinary "syntax error"
1196 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1197 size calculation. */
1199 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1201 int yyn
= yypact
[yystate
];
1203 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1207 int yytype
= YYTRANSLATE (yychar
);
1208 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1209 YYSIZE_T yysize
= yysize0
;
1211 int yysize_overflow
= 0;
1212 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1213 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1217 /* This is so xgettext sees the translatable formats that are
1218 constructed on the fly. */
1219 YY_("syntax error, unexpected %s");
1220 YY_("syntax error, unexpected %s, expecting %s");
1221 YY_("syntax error, unexpected %s, expecting %s or %s");
1222 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1223 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1227 static char const yyunexpected
[] = "syntax error, unexpected %s";
1228 static char const yyexpecting
[] = ", expecting %s";
1229 static char const yyor
[] = " or %s";
1230 char yyformat
[sizeof yyunexpected
1231 + sizeof yyexpecting
- 1
1232 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1233 * (sizeof yyor
- 1))];
1234 char const *yyprefix
= yyexpecting
;
1236 /* Start YYX at -YYN if negative to avoid negative indexes in
1238 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1240 /* Stay within bounds of both yycheck and yytname. */
1241 int yychecklim
= YYLAST
- yyn
+ 1;
1242 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1245 yyarg
[0] = yytname
[yytype
];
1246 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1248 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1249 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1251 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1255 yyformat
[sizeof yyunexpected
- 1] = '\0';
1258 yyarg
[yycount
++] = yytname
[yyx
];
1259 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1260 yysize_overflow
|= (yysize1
< yysize
);
1262 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1266 yyf
= YY_(yyformat
);
1267 yysize1
= yysize
+ yystrlen (yyf
);
1268 yysize_overflow
|= (yysize1
< yysize
);
1271 if (yysize_overflow
)
1272 return YYSIZE_MAXIMUM
;
1276 /* Avoid sprintf, as that infringes on the user's name space.
1277 Don't have undefined behavior even if the translation
1278 produced a string with the wrong number of "%s"s. */
1279 char *yyp
= yyresult
;
1281 while ((*yyp
= *yyf
) != '\0')
1283 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1285 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1298 #endif /* YYERROR_VERBOSE */
1301 /*-----------------------------------------------.
1302 | Release the memory associated to this symbol. |
1303 `-----------------------------------------------*/
1306 #if (defined __STDC__ || defined __C99__FUNC__ \
1307 || defined __cplusplus || defined _MSC_VER)
1309 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1312 yydestruct (yymsg
, yytype
, yyvaluep
)
1322 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1332 /* Prevent warnings from -Wmissing-prototypes. */
1333 #ifdef YYPARSE_PARAM
1334 #if defined __STDC__ || defined __cplusplus
1335 int yyparse (void *YYPARSE_PARAM
);
1339 #else /* ! YYPARSE_PARAM */
1340 #if defined __STDC__ || defined __cplusplus
1345 #endif /* ! YYPARSE_PARAM */
1351 /*-------------------------.
1352 | yyparse or yypush_parse. |
1353 `-------------------------*/
1355 #ifdef YYPARSE_PARAM
1356 #if (defined __STDC__ || defined __C99__FUNC__ \
1357 || defined __cplusplus || defined _MSC_VER)
1359 yyparse (void *YYPARSE_PARAM
)
1362 yyparse (YYPARSE_PARAM
)
1363 void *YYPARSE_PARAM
;
1365 #else /* ! YYPARSE_PARAM */
1366 #if (defined __STDC__ || defined __C99__FUNC__ \
1367 || defined __cplusplus || defined _MSC_VER)
1377 /* The lookahead symbol. */
1380 /* The semantic value of the lookahead symbol. */
1383 /* Number of syntax errors so far. */
1387 /* Number of tokens to shift before error messages enabled. */
1390 /* The stacks and their tools:
1391 `yyss': related to states.
1392 `yyvs': related to semantic values.
1394 Refer to the stacks thru separate pointers, to allow yyoverflow
1395 to reallocate them elsewhere. */
1397 /* The state stack. */
1398 yytype_int16 yyssa
[YYINITDEPTH
];
1400 yytype_int16
*yyssp
;
1402 /* The semantic value stack. */
1403 YYSTYPE yyvsa
[YYINITDEPTH
];
1407 YYSIZE_T yystacksize
;
1411 /* Lookahead token as an internal (translated) token number. */
1413 /* The variables used to return semantic value and location from the
1418 /* Buffer for error messages, and its allocated size. */
1420 char *yymsg
= yymsgbuf
;
1421 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1424 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1426 /* The number of symbols on the RHS of the reduced rule.
1427 Keep to zero when no symbol should be popped. */
1433 yystacksize
= YYINITDEPTH
;
1435 YYDPRINTF ((stderr
, "Starting parse\n"));
1440 yychar
= YYEMPTY
; /* Cause a token to be read. */
1442 /* Initialize stack pointers.
1443 Waste one element of value and location stack
1444 so that they stay on the same level as the state stack.
1445 The wasted elements are never initialized. */
1451 /*------------------------------------------------------------.
1452 | yynewstate -- Push a new state, which is found in yystate. |
1453 `------------------------------------------------------------*/
1455 /* In all cases, when you get here, the value and location stacks
1456 have just been pushed. So pushing a state here evens the stacks. */
1462 if (yyss
+ yystacksize
- 1 <= yyssp
)
1464 /* Get the current used size of the three stacks, in elements. */
1465 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1469 /* Give user a chance to reallocate the stack. Use copies of
1470 these so that the &'s don't force the real ones into
1472 YYSTYPE
*yyvs1
= yyvs
;
1473 yytype_int16
*yyss1
= yyss
;
1475 /* Each stack pointer address is followed by the size of the
1476 data in use in that stack, in bytes. This used to be a
1477 conditional around just the two extra args, but that might
1478 be undefined if yyoverflow is a macro. */
1479 yyoverflow (YY_("memory exhausted"),
1480 &yyss1
, yysize
* sizeof (*yyssp
),
1481 &yyvs1
, yysize
* sizeof (*yyvsp
),
1487 #else /* no yyoverflow */
1488 # ifndef YYSTACK_RELOCATE
1489 goto yyexhaustedlab
;
1491 /* Extend the stack our own way. */
1492 if (YYMAXDEPTH
<= yystacksize
)
1493 goto yyexhaustedlab
;
1495 if (YYMAXDEPTH
< yystacksize
)
1496 yystacksize
= YYMAXDEPTH
;
1499 yytype_int16
*yyss1
= yyss
;
1500 union yyalloc
*yyptr
=
1501 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1503 goto yyexhaustedlab
;
1504 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1505 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1506 # undef YYSTACK_RELOCATE
1508 YYSTACK_FREE (yyss1
);
1511 #endif /* no yyoverflow */
1513 yyssp
= yyss
+ yysize
- 1;
1514 yyvsp
= yyvs
+ yysize
- 1;
1516 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1517 (unsigned long int) yystacksize
));
1519 if (yyss
+ yystacksize
- 1 <= yyssp
)
1523 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1525 if (yystate
== YYFINAL
)
1535 /* Do appropriate processing given the current state. Read a
1536 lookahead token if we need one and don't already have one. */
1538 /* First try to decide what to do without reference to lookahead token. */
1539 yyn
= yypact
[yystate
];
1540 if (yyn
== YYPACT_NINF
)
1543 /* Not known => get a lookahead token if don't already have one. */
1545 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1546 if (yychar
== YYEMPTY
)
1548 YYDPRINTF ((stderr
, "Reading a token: "));
1552 if (yychar
<= YYEOF
)
1554 yychar
= yytoken
= YYEOF
;
1555 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1559 yytoken
= YYTRANSLATE (yychar
);
1560 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1563 /* If the proper action on seeing token YYTOKEN is to reduce or to
1564 detect an error, take that action. */
1566 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1571 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1577 /* Count tokens shifted since error; after three, turn off error
1582 /* Shift the lookahead token. */
1583 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1585 /* Discard the shifted token. */
1594 /*-----------------------------------------------------------.
1595 | yydefault -- do the default action for the current state. |
1596 `-----------------------------------------------------------*/
1598 yyn
= yydefact
[yystate
];
1604 /*-----------------------------.
1605 | yyreduce -- Do a reduction. |
1606 `-----------------------------*/
1608 /* yyn is the number of a rule to reduce with. */
1611 /* If YYLEN is nonzero, implement the default value of the action:
1614 Otherwise, the following line sets YYVAL to garbage.
1615 This behavior is undocumented and Bison
1616 users should not rely upon it. Assigning to YYVAL
1617 unconditionally makes the parser a bit smaller, and it avoids a
1618 GCC warning that YYVAL may be used uninitialized. */
1619 yyval
= yyvsp
[1-yylen
];
1622 YY_REDUCE_PRINT (yyn
);
1627 /* Line 1455 of yacc.c */
1630 SQL_input
* sql
= (SQL_input
*) info
;
1631 *sql
->view
= (yyvsp
[(1) - (1)].query
);
1637 /* Line 1455 of yacc.c */
1640 SQL_input
*sql
= (SQL_input
*) info
;
1641 MSIVIEW
*insert
= NULL
;
1643 INSERT_CreateView( sql
->db
, &insert
, (yyvsp
[(3) - (10)].string
), (yyvsp
[(5) - (10)].column_list
), (yyvsp
[(9) - (10)].column_list
), FALSE
);
1647 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), insert
);
1653 /* Line 1455 of yacc.c */
1656 SQL_input
*sql
= (SQL_input
*) info
;
1657 MSIVIEW
*insert
= NULL
;
1659 INSERT_CreateView( sql
->db
, &insert
, (yyvsp
[(3) - (11)].string
), (yyvsp
[(5) - (11)].column_list
), (yyvsp
[(9) - (11)].column_list
), TRUE
);
1663 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), insert
);
1669 /* Line 1455 of yacc.c */
1672 SQL_input
* sql
= (SQL_input
*) info
;
1673 MSIVIEW
*create
= NULL
;
1676 if( !(yyvsp
[(5) - (6)].column_list
) )
1678 r
= CREATE_CreateView( sql
->db
, &create
, (yyvsp
[(3) - (6)].string
), (yyvsp
[(5) - (6)].column_list
), FALSE
);
1685 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), create
);
1691 /* Line 1455 of yacc.c */
1694 SQL_input
* sql
= (SQL_input
*) info
;
1695 MSIVIEW
*create
= NULL
;
1697 if( !(yyvsp
[(5) - (7)].column_list
) )
1699 CREATE_CreateView( sql
->db
, &create
, (yyvsp
[(3) - (7)].string
), (yyvsp
[(5) - (7)].column_list
), TRUE
);
1703 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), create
);
1709 /* Line 1455 of yacc.c */
1712 SQL_input
* sql
= (SQL_input
*) info
;
1713 MSIVIEW
*update
= NULL
;
1715 UPDATE_CreateView( sql
->db
, &update
, (yyvsp
[(2) - (6)].string
), (yyvsp
[(4) - (6)].column_list
), (yyvsp
[(6) - (6)].expr
) );
1719 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), update
);
1725 /* Line 1455 of yacc.c */
1728 SQL_input
* sql
= (SQL_input
*) info
;
1729 MSIVIEW
*update
= NULL
;
1731 UPDATE_CreateView( sql
->db
, &update
, (yyvsp
[(2) - (4)].string
), (yyvsp
[(4) - (4)].column_list
), NULL
);
1735 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), update
);
1741 /* Line 1455 of yacc.c */
1744 SQL_input
* sql
= (SQL_input
*) info
;
1745 MSIVIEW
*delete = NULL
;
1747 DELETE_CreateView( sql
->db
, &delete, (yyvsp
[(2) - (2)].query
) );
1751 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), delete );
1757 /* Line 1455 of yacc.c */
1760 SQL_input
* sql
= (SQL_input
*) info
;
1761 MSIVIEW
*alter
= NULL
;
1763 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[(3) - (4)].string
), NULL
, (yyvsp
[(4) - (4)].integer
) );
1767 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1773 /* Line 1455 of yacc.c */
1776 SQL_input
*sql
= (SQL_input
*)info
;
1777 MSIVIEW
*alter
= NULL
;
1779 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[(3) - (5)].string
), (yyvsp
[(5) - (5)].column_list
), 0 );
1783 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1789 /* Line 1455 of yacc.c */
1792 SQL_input
*sql
= (SQL_input
*)info
;
1793 MSIVIEW
*alter
= NULL
;
1795 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[(3) - (6)].string
), (yyvsp
[(5) - (6)].column_list
), 1 );
1799 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1805 /* Line 1455 of yacc.c */
1808 (yyval
.integer
) = 1;
1814 /* Line 1455 of yacc.c */
1817 (yyval
.integer
) = -1;
1823 /* Line 1455 of yacc.c */
1826 SQL_input
* sql
= (SQL_input
*) info
;
1827 MSIVIEW
* drop
= NULL
;
1830 r
= DROP_CreateView( sql
->db
, &drop
, (yyvsp
[(3) - (3)].string
) );
1831 if( r
!= ERROR_SUCCESS
|| !(yyval
.query
) )
1834 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), drop
);
1840 /* Line 1455 of yacc.c */
1843 if( SQL_MarkPrimaryKeys( &(yyvsp
[(1) - (4)].column_list
), (yyvsp
[(4) - (4)].column_list
) ) )
1844 (yyval
.column_list
) = (yyvsp
[(1) - (4)].column_list
);
1846 (yyval
.column_list
) = NULL
;
1852 /* Line 1455 of yacc.c */
1857 for( ci
= (yyvsp
[(1) - (3)].column_list
); ci
->next
; ci
= ci
->next
)
1860 ci
->next
= (yyvsp
[(3) - (3)].column_list
);
1861 (yyval
.column_list
) = (yyvsp
[(1) - (3)].column_list
);
1867 /* Line 1455 of yacc.c */
1870 (yyval
.column_list
) = (yyvsp
[(1) - (1)].column_list
);
1876 /* Line 1455 of yacc.c */
1879 (yyval
.column_list
) = (yyvsp
[(1) - (2)].column_list
);
1880 (yyval
.column_list
)->type
= ((yyvsp
[(2) - (2)].column_type
) | MSITYPE_VALID
);
1881 (yyval
.column_list
)->temporary
= (yyvsp
[(2) - (2)].column_type
) & MSITYPE_TEMPORARY
? TRUE
: FALSE
;
1887 /* Line 1455 of yacc.c */
1890 (yyval
.column_type
) = (yyvsp
[(1) - (1)].column_type
);
1896 /* Line 1455 of yacc.c */
1899 (yyval
.column_type
) = (yyvsp
[(1) - (2)].column_type
) | MSITYPE_LOCALIZABLE
;
1905 /* Line 1455 of yacc.c */
1908 (yyval
.column_type
) = (yyvsp
[(1) - (2)].column_type
) | MSITYPE_TEMPORARY
;
1914 /* Line 1455 of yacc.c */
1917 (yyval
.column_type
) |= MSITYPE_NULLABLE
;
1923 /* Line 1455 of yacc.c */
1926 (yyval
.column_type
) = (yyvsp
[(1) - (3)].column_type
);
1932 /* Line 1455 of yacc.c */
1935 (yyval
.column_type
) = MSITYPE_STRING
| 1;
1941 /* Line 1455 of yacc.c */
1944 (yyval
.column_type
) = MSITYPE_STRING
| 0x400 | (yyvsp
[(3) - (4)].column_type
);
1950 /* Line 1455 of yacc.c */
1953 (yyval
.column_type
) = MSITYPE_STRING
| 0x400;
1959 /* Line 1455 of yacc.c */
1962 (yyval
.column_type
) = 2 | 0x400;
1968 /* Line 1455 of yacc.c */
1971 (yyval
.column_type
) = 2 | 0x400;
1977 /* Line 1455 of yacc.c */
1980 (yyval
.column_type
) = 4;
1986 /* Line 1455 of yacc.c */
1989 (yyval
.column_type
) = MSITYPE_STRING
| MSITYPE_VALID
;
1995 /* Line 1455 of yacc.c */
1998 if( ( (yyvsp
[(1) - (1)].integer
) > 255 ) || ( (yyvsp
[(1) - (1)].integer
) < 0 ) )
2000 (yyval
.column_type
) = (yyvsp
[(1) - (1)].integer
);
2006 /* Line 1455 of yacc.c */
2009 (yyval
.query
) = (yyvsp
[(2) - (2)].query
);
2015 /* Line 1455 of yacc.c */
2018 SQL_input
* sql
= (SQL_input
*) info
;
2019 MSIVIEW
* distinct
= NULL
;
2022 r
= DISTINCT_CreateView( sql
->db
, &distinct
, (yyvsp
[(3) - (3)].query
) );
2023 if (r
!= ERROR_SUCCESS
)
2026 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), distinct
);
2032 /* Line 1455 of yacc.c */
2035 SQL_input
* sql
= (SQL_input
*) info
;
2036 MSIVIEW
* select
= NULL
;
2039 if( (yyvsp
[(1) - (2)].column_list
) )
2041 r
= SELECT_CreateView( sql
->db
, &select
, (yyvsp
[(2) - (2)].query
), (yyvsp
[(1) - (2)].column_list
) );
2042 if (r
!= ERROR_SUCCESS
)
2045 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), select
);
2048 (yyval
.query
) = (yyvsp
[(2) - (2)].query
);
2054 /* Line 1455 of yacc.c */
2057 (yyvsp
[(1) - (3)].column_list
)->next
= (yyvsp
[(3) - (3)].column_list
);
2063 /* Line 1455 of yacc.c */
2066 (yyval
.column_list
) = NULL
;
2072 /* Line 1455 of yacc.c */
2075 (yyvsp
[(1) - (3)].column_list
)->next
= (yyvsp
[(3) - (3)].column_list
);
2081 /* Line 1455 of yacc.c */
2084 (yyval
.column_list
) = NULL
;
2090 /* Line 1455 of yacc.c */
2093 SQL_input
* sql
= (SQL_input
*) info
;
2094 MSIVIEW
* table
= NULL
;
2097 r
= TABLE_CreateView( sql
->db
, (yyvsp
[(2) - (2)].string
), &table
);
2098 if( r
!= ERROR_SUCCESS
|| !(yyval
.query
) )
2101 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), table
);
2107 /* Line 1455 of yacc.c */
2112 if( (yyvsp
[(4) - (4)].column_list
) )
2114 r
= (yyvsp
[(1) - (4)].query
)->ops
->sort( (yyvsp
[(1) - (4)].query
), (yyvsp
[(4) - (4)].column_list
) );
2115 if ( r
!= ERROR_SUCCESS
)
2119 (yyval
.query
) = (yyvsp
[(1) - (4)].query
);
2125 /* Line 1455 of yacc.c */
2128 SQL_input
* sql
= (SQL_input
*) info
;
2129 MSIVIEW
* where
= NULL
;
2132 r
= WHERE_CreateView( sql
->db
, &where
, (yyvsp
[(2) - (2)].string
), NULL
);
2133 if( r
!= ERROR_SUCCESS
)
2136 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), where
);
2142 /* Line 1455 of yacc.c */
2145 SQL_input
* sql
= (SQL_input
*) info
;
2146 MSIVIEW
* where
= NULL
;
2149 r
= WHERE_CreateView( sql
->db
, &where
, (yyvsp
[(2) - (4)].string
), (yyvsp
[(4) - (4)].expr
) );
2150 if( r
!= ERROR_SUCCESS
)
2153 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), where
);
2159 /* Line 1455 of yacc.c */
2162 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
2168 /* Line 1455 of yacc.c */
2171 (yyval
.string
) = parser_add_table( info
, (yyvsp
[(3) - (3)].string
), (yyvsp
[(1) - (3)].string
) );
2172 if (!(yyval
.string
))
2179 /* Line 1455 of yacc.c */
2182 (yyval
.expr
) = (yyvsp
[(2) - (3)].expr
);
2190 /* Line 1455 of yacc.c */
2193 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_AND
, (yyvsp
[(3) - (3)].expr
) );
2201 /* Line 1455 of yacc.c */
2204 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_OR
, (yyvsp
[(3) - (3)].expr
) );
2212 /* Line 1455 of yacc.c */
2215 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_EQ
, (yyvsp
[(3) - (3)].expr
) );
2223 /* Line 1455 of yacc.c */
2226 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_GT
, (yyvsp
[(3) - (3)].expr
) );
2234 /* Line 1455 of yacc.c */
2237 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_LT
, (yyvsp
[(3) - (3)].expr
) );
2245 /* Line 1455 of yacc.c */
2248 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_LE
, (yyvsp
[(3) - (3)].expr
) );
2256 /* Line 1455 of yacc.c */
2259 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_GE
, (yyvsp
[(3) - (3)].expr
) );
2267 /* Line 1455 of yacc.c */
2270 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[(1) - (3)].expr
), OP_NE
, (yyvsp
[(3) - (3)].expr
) );
2278 /* Line 1455 of yacc.c */
2281 (yyval
.expr
) = EXPR_unary( info
, (yyvsp
[(1) - (3)].expr
), OP_ISNULL
);
2289 /* Line 1455 of yacc.c */
2292 (yyval
.expr
) = EXPR_unary( info
, (yyvsp
[(1) - (4)].expr
), OP_NOTNULL
);
2300 /* Line 1455 of yacc.c */
2303 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, NULL
);
2304 if( !(yyval
.column_list
) )
2306 (yyval
.column_list
)->val
= (yyvsp
[(1) - (1)].expr
);
2312 /* Line 1455 of yacc.c */
2315 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, NULL
);
2316 if( !(yyval
.column_list
) )
2318 (yyval
.column_list
)->val
= (yyvsp
[(1) - (3)].expr
);
2319 (yyval
.column_list
)->next
= (yyvsp
[(3) - (3)].column_list
);
2325 /* Line 1455 of yacc.c */
2328 (yyval
.column_list
) = (yyvsp
[(1) - (3)].column_list
);
2329 (yyval
.column_list
)->next
= (yyvsp
[(3) - (3)].column_list
);
2335 /* Line 1455 of yacc.c */
2338 (yyval
.column_list
) = (yyvsp
[(1) - (3)].column_list
);
2339 (yyval
.column_list
)->val
= (yyvsp
[(3) - (3)].expr
);
2345 /* Line 1455 of yacc.c */
2348 (yyval
.expr
) = EXPR_ival( info
, (yyvsp
[(1) - (1)].integer
) );
2356 /* Line 1455 of yacc.c */
2359 (yyval
.expr
) = EXPR_ival( info
, -(yyvsp
[(2) - (2)].integer
) );
2367 /* Line 1455 of yacc.c */
2370 (yyval
.expr
) = EXPR_sval( info
, &(yyvsp
[(1) - (1)].str
) );
2378 /* Line 1455 of yacc.c */
2381 (yyval
.expr
) = EXPR_wildcard( info
);
2389 /* Line 1455 of yacc.c */
2392 (yyval
.expr
) = EXPR_column( info
, (yyvsp
[(1) - (1)].column_list
) );
2400 /* Line 1455 of yacc.c */
2403 (yyval
.column_list
) = parser_alloc_column( info
, (yyvsp
[(1) - (3)].string
), (yyvsp
[(3) - (3)].string
) );
2404 if( !(yyval
.column_list
) )
2411 /* Line 1455 of yacc.c */
2414 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[(1) - (1)].string
) );
2415 if( !(yyval
.column_list
) )
2422 /* Line 1455 of yacc.c */
2425 (yyval
.column_list
) = parser_alloc_column( info
, (yyvsp
[(1) - (3)].string
), (yyvsp
[(3) - (3)].string
) );
2426 if( !(yyval
.column_list
) )
2433 /* Line 1455 of yacc.c */
2436 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[(1) - (1)].string
) );
2437 if( !(yyval
.column_list
) )
2444 /* Line 1455 of yacc.c */
2447 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[(1) - (1)].string
) );
2448 if( !(yyval
.column_list
) )
2455 /* Line 1455 of yacc.c */
2458 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
2464 /* Line 1455 of yacc.c */
2467 if ( SQL_getstring( info
, &(yyvsp
[(1) - (1)].str
), &(yyval
.string
) ) != ERROR_SUCCESS
|| !(yyval
.string
) )
2474 /* Line 1455 of yacc.c */
2477 if ( SQL_getstring( info
, &(yyvsp
[(1) - (1)].str
), &(yyval
.string
) ) != ERROR_SUCCESS
|| !(yyval
.string
) )
2484 /* Line 1455 of yacc.c */
2487 (yyval
.integer
) = SQL_getint( info
);
2493 /* Line 1455 of yacc.c */
2494 #line 2488 "sql.tab.c"
2497 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2501 YY_STACK_PRINT (yyss
, yyssp
);
2505 /* Now `shift' the result of the reduction. Determine what state
2506 that goes to, based on the state we popped back to and the rule
2507 number reduced by. */
2511 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2512 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2513 yystate
= yytable
[yystate
];
2515 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2520 /*------------------------------------.
2521 | yyerrlab -- here on detecting error |
2522 `------------------------------------*/
2524 /* If not already recovering from an error, report this error. */
2528 #if ! YYERROR_VERBOSE
2529 yyerror (YY_("syntax error"));
2532 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2533 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2535 YYSIZE_T yyalloc
= 2 * yysize
;
2536 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2537 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2538 if (yymsg
!= yymsgbuf
)
2539 YYSTACK_FREE (yymsg
);
2540 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2542 yymsg_alloc
= yyalloc
;
2546 yymsg_alloc
= sizeof yymsgbuf
;
2550 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2552 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2557 yyerror (YY_("syntax error"));
2559 goto yyexhaustedlab
;
2567 if (yyerrstatus
== 3)
2569 /* If just tried and failed to reuse lookahead token after an
2570 error, discard it. */
2572 if (yychar
<= YYEOF
)
2574 /* Return failure if at end of input. */
2575 if (yychar
== YYEOF
)
2580 yydestruct ("Error: discarding",
2586 /* Else will try to reuse lookahead token after shifting the error
2591 /*---------------------------------------------------.
2592 | yyerrorlab -- error raised explicitly by YYERROR. |
2593 `---------------------------------------------------*/
2596 /* Pacify compilers like GCC when the user code never invokes
2597 YYERROR and the label yyerrorlab therefore never appears in user
2599 if (/*CONSTCOND*/ 0)
2602 /* Do not reclaim the symbols of the rule which action triggered
2606 YY_STACK_PRINT (yyss
, yyssp
);
2611 /*-------------------------------------------------------------.
2612 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2613 `-------------------------------------------------------------*/
2615 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2619 yyn
= yypact
[yystate
];
2620 if (yyn
!= YYPACT_NINF
)
2623 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2631 /* Pop the current state because it cannot handle the error token. */
2636 yydestruct ("Error: popping",
2637 yystos
[yystate
], yyvsp
);
2640 YY_STACK_PRINT (yyss
, yyssp
);
2646 /* Shift the error token. */
2647 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2653 /*-------------------------------------.
2654 | yyacceptlab -- YYACCEPT comes here. |
2655 `-------------------------------------*/
2660 /*-----------------------------------.
2661 | yyabortlab -- YYABORT comes here. |
2662 `-----------------------------------*/
2667 #if !defined(yyoverflow) || YYERROR_VERBOSE
2668 /*-------------------------------------------------.
2669 | yyexhaustedlab -- memory exhaustion comes here. |
2670 `-------------------------------------------------*/
2672 yyerror (YY_("memory exhausted"));
2678 if (yychar
!= YYEMPTY
)
2679 yydestruct ("Cleanup: discarding lookahead",
2681 /* Do not reclaim the symbols of the rule which action triggered
2682 this YYABORT or YYACCEPT. */
2684 YY_STACK_PRINT (yyss
, yyssp
);
2685 while (yyssp
!= yyss
)
2687 yydestruct ("Cleanup: popping",
2688 yystos
[*yyssp
], yyvsp
);
2693 YYSTACK_FREE (yyss
);
2696 if (yymsg
!= yymsgbuf
)
2697 YYSTACK_FREE (yymsg
);
2699 /* Make sure YYID is used. */
2700 return YYID (yyresult
);
2705 /* Line 1675 of yacc.c */
2709 static LPWSTR
parser_add_table( void *info
, LPCWSTR list
, LPCWSTR table
)
2711 static const WCHAR space
[] = {' ',0};
2712 DWORD len
= strlenW( list
) + strlenW( table
) + 2;
2715 ret
= parser_alloc( info
, len
* sizeof(WCHAR
) );
2718 strcpyW( ret
, list
);
2719 strcatW( ret
, space
);
2720 strcatW( ret
, table
);
2725 static void *parser_alloc( void *info
, unsigned int sz
)
2727 SQL_input
* sql
= (SQL_input
*) info
;
2730 mem
= msi_alloc( sizeof (struct list
) + sz
);
2731 list_add_tail( sql
->mem
, mem
);
2735 static column_info
*parser_alloc_column( void *info
, LPCWSTR table
, LPCWSTR column
)
2739 col
= parser_alloc( info
, sizeof (*col
) );
2743 col
->column
= column
;
2752 static int sql_lex( void *SQL_lval
, SQL_input
*sql
)
2755 struct sql_str
* str
= SQL_lval
;
2760 if( ! sql
->command
[sql
->n
] )
2761 return 0; /* end of input */
2763 /* TRACE("string : %s\n", debugstr_w(&sql->command[sql->n])); */
2764 sql
->len
= sqliteGetToken( &sql
->command
[sql
->n
], &token
, &skip
);
2767 str
->data
= &sql
->command
[sql
->n
];
2768 str
->len
= sql
->len
;
2771 while( token
== TK_SPACE
);
2773 /* TRACE("token : %d (%s)\n", token, debugstr_wn(&sql->command[sql->n], sql->len)); */
2778 UINT
SQL_getstring( void *info
, const struct sql_str
*strdata
, LPWSTR
*str
)
2780 LPCWSTR p
= strdata
->data
;
2781 UINT len
= strdata
->len
;
2784 if( ( (p
[0]=='`') && (p
[len
-1]!='`') ) ||
2785 ( (p
[0]=='\'') && (p
[len
-1]!='\'') ) )
2786 return ERROR_FUNCTION_FAILED
;
2788 /* if there's quotes, remove them */
2789 if( ( (p
[0]=='`') && (p
[len
-1]=='`') ) ||
2790 ( (p
[0]=='\'') && (p
[len
-1]=='\'') ) )
2795 *str
= parser_alloc( info
, (len
+ 1)*sizeof(WCHAR
) );
2797 return ERROR_OUTOFMEMORY
;
2798 memcpy( *str
, p
, len
*sizeof(WCHAR
) );
2801 return ERROR_SUCCESS
;
2804 INT
SQL_getint( void *info
)
2806 SQL_input
* sql
= (SQL_input
*) info
;
2807 LPCWSTR p
= &sql
->command
[sql
->n
];
2810 for( i
=0; i
<sql
->len
; i
++ )
2812 if( '0' > p
[i
] || '9' < p
[i
] )
2814 ERR("should only be numbers here!\n");
2817 r
= (p
[i
]-'0') + r
*10;
2823 static int sql_error( const char *str
)
2828 static struct expr
* EXPR_wildcard( void *info
)
2830 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2833 e
->type
= EXPR_WILDCARD
;
2838 static struct expr
* EXPR_complex( void *info
, struct expr
*l
, UINT op
, struct expr
*r
)
2840 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2843 e
->type
= EXPR_COMPLEX
;
2846 e
->u
.expr
.right
= r
;
2851 static struct expr
* EXPR_unary( void *info
, struct expr
*l
, UINT op
)
2853 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2856 e
->type
= EXPR_UNARY
;
2859 e
->u
.expr
.right
= NULL
;
2864 static struct expr
* EXPR_column( void *info
, const column_info
*column
)
2866 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2869 e
->type
= EXPR_COLUMN
;
2870 e
->u
.column
.unparsed
.column
= column
->column
;
2871 e
->u
.column
.unparsed
.table
= column
->table
;
2876 static struct expr
* EXPR_ival( void *info
, int val
)
2878 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2881 e
->type
= EXPR_IVAL
;
2887 static struct expr
* EXPR_sval( void *info
, const struct sql_str
*str
)
2889 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2892 e
->type
= EXPR_SVAL
;
2893 if( SQL_getstring( info
, str
, (LPWSTR
*)&e
->u
.sval
) != ERROR_SUCCESS
)
2894 return NULL
; /* e will be freed by query destructor */
2899 static void swap_columns( column_info
**cols
, column_info
*A
, int idx
)
2901 column_info
*preA
= NULL
, *preB
= NULL
, *B
, *ptr
;
2913 if( ptr
->next
== A
)
2919 if( preB
) preB
->next
= A
;
2920 if( preA
) preA
->next
= B
;
2928 static BOOL
SQL_MarkPrimaryKeys( column_info
**cols
,
2935 for( k
= keys
, count
= 0; k
&& found
; k
= k
->next
, count
++ )
2941 for( c
= *cols
, idx
= 0; c
&& !found
; c
= c
->next
, idx
++ )
2943 if( strcmpW( k
->column
, c
->column
) )
2945 c
->type
|= MSITYPE_KEY
;
2948 swap_columns( cols
, c
, count
);
2955 UINT
MSI_ParseSQL( MSIDATABASE
*db
, LPCWSTR command
, MSIVIEW
**phview
,
2964 sql
.command
= command
;
2967 sql
.r
= ERROR_BAD_QUERY_SYNTAX
;
2971 r
= sql_parse(&sql
);
2973 TRACE("Parse returned %d\n", r
);
2978 (*sql
.view
)->ops
->delete(*sql
.view
);
2984 return ERROR_SUCCESS
;