1 /*
2 * This parser was generated in a sqlite-3.5.9 source distribution,
3 * using the lemon parser generator and sqlite's parse.y. The only
4 * change to the output was the removal of #line directives, which
5 * confused the debugger; and the addition of this comment. A
6 * principle of the db_sql project was to use sqlite's parser
7 * unchanged; so we haven't incorporated the build from the grammar
8 * spec. Perhaps at a later time we will want to do that. For
9 * now, we consider this an immutable source file.
10 */
11
12
13 /* Driver template for the LEMON parser generator.
14 ** The author disclaims copyright to this source code.
15 */
16 /* First off, code is include which follows the "include" declaration
17 ** in the input file. */
18 #include <stdio.h>
19
20 #include "sqliteInt.h"
21
22 /*
23 ** An instance of this structure holds information about the
24 ** LIMIT clause of a SELECT statement.
25 */
26 struct LimitVal {
27 Expr *pLimit; /* The LIMIT expression. NULL if there is no limit */
28 Expr *pOffset; /* The OFFSET expression. NULL if there is none */
29 };
30
31 /*
32 ** An instance of this structure is used to store the LIKE,
33 ** GLOB, NOT LIKE, and NOT GLOB operators.
34 */
35 struct LikeOp {
36 Token eOperator; /* "like" or "glob" or "regexp" */
37 int not; /* True if the NOT keyword is present */
38 };
39
40 /*
41 ** An instance of the following structure describes the event of a
42 ** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT,
43 ** TK_DELETE, or TK_INSTEAD. If the event is of the form
44 **
45 ** UPDATE ON (a,b,c)
46 **
47 ** Then the "b" IdList records the list "a,b,c".
48 */
49 struct TrigEvent { int a; IdList * b; };
50
51 /*
52 ** An instance of this structure holds the ATTACH key and the key type.
53 */
54 struct AttachKey { int type; Token key; };
55
56 /* Next is all token values, in a form suitable for use by makeheaders.
57 ** This section will be null unless lemon is run with the -m switch.
58 */
59 /*
60 ** These constants (all generated automatically by the parser generator)
61 ** specify the various kinds of tokens (terminals) that the parser
62 ** understands.
63 **
64 ** Each symbol here is a terminal symbol in the grammar.
65 */
66 /* Make sure the INTERFACE macro is defined.
67 */
68 #ifndef INTERFACE
69 # define INTERFACE 1
70 #endif
71 /* The next thing included is series of defines which control
72 ** various aspects of the generated parser.
73 ** YYCODETYPE is the data type used for storing terminal
74 ** and nonterminal numbers. "unsigned char" is
75 ** used if there are fewer than 250 terminals
76 ** and nonterminals. "int" is used otherwise.
77 ** YYNOCODE is a number of type YYCODETYPE which corresponds
78 ** to no legal terminal or nonterminal number. This
79 ** number is used to fill in empty slots of the hash
80 ** table.
81 ** YYFALLBACK If defined, this indicates that one or more tokens
82 ** have fall-back values which should be used if the
83 ** original value of the token will not parse.
84 ** YYACTIONTYPE is the data type used for storing terminal
85 ** and nonterminal numbers. "unsigned char" is
86 ** used if there are fewer than 250 rules and
87 ** states combined. "int" is used otherwise.
88 ** sqlite3ParserTOKENTYPE is the data type used for minor tokens given
89 ** directly to the parser from the tokenizer.
90 ** YYMINORTYPE is the data type used for all minor tokens.
91 ** This is typically a union of many types, one of
92 ** which is sqlite3ParserTOKENTYPE. The entry in the union
93 ** for base tokens is called "yy0".
94 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
95 ** zero the stack is dynamically sized using realloc()
96 ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument
97 ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument
98 ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser
99 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
100 ** YYNSTATE the combined number of states.
101 ** YYNRULE the number of rules in the grammar
102 ** YYERRORSYMBOL is the code number of the error symbol. If not
103 ** defined, then do no error processing.
104 */
105 #define YYCODETYPE unsigned char
106 #define YYNOCODE 248
107 #define YYACTIONTYPE unsigned short int
108 #define YYWILDCARD 59
109 #define sqlite3ParserTOKENTYPE Token
110 typedef union {
111 sqlite3ParserTOKENTYPE yy0;
112 int yy46;
113 struct LikeOp yy72;
114 Expr* yy172;
115 ExprList* yy174;
116 Select* yy219;
117 struct LimitVal yy234;
118 TriggerStep* yy243;
119 struct TrigEvent yy370;
120 SrcList* yy373;
121 struct {int value; int mask;} yy405;
122 Token yy410;
123 IdList* yy432;
124 } YYMINORTYPE;
125 #ifndef YYSTACKDEPTH
126 #define YYSTACKDEPTH 100
127 #endif
128 #define sqlite3ParserARG_SDECL Parse *pParse;
129 #define sqlite3ParserARG_PDECL ,Parse *pParse
130 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
131 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
132 #define YYNSTATE 589
133 #define YYNRULE 313
134 #define YYFALLBACK 1
135 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
136 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
137 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
138
139 /* The yyzerominor constant is used to initialize instances of
140 ** YYMINORTYPE objects to zero. */
141 static const YYMINORTYPE yyzerominor;
142
143 /* Next are that tables used to determine what action to take based on the
144 ** current state and lookahead token. These tables are used to implement
145 ** functions that take a state number and lookahead value and return an
146 ** action integer.
147 **
148 ** Suppose the action integer is N. Then the action is determined as
149 ** follows
150 **
151 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
152 ** token onto the stack and goto state N.
153 **
154 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
155 **
156 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
157 **
158 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
159 **
160 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
161 ** slots in the yy_action[] table.
162 **
163 ** The action table is constructed as a single large table named yy_action[].
164 ** Given state S and lookahead X, the action is computed as
165 **
166 ** yy_action[ yy_shift_ofst[S] + X ]
167 **
168 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
169 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
170 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
171 ** and that yy_default[S] should be used instead.
172 **
173 ** The formula above is for computing the action when the lookahead is
174 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
175 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
176 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
177 ** YY_SHIFT_USE_DFLT.
178 **
179 ** The following are the tables generated in this section:
180 **
181 ** yy_action[] A single table containing all actions.
182 ** yy_lookahead[] A table containing the lookahead for each entry in
183 ** yy_action. Used to detect hash collisions.
184 ** yy_shift_ofst[] For each state, the offset into yy_action for
185 ** shifting terminals.
186 ** yy_reduce_ofst[] For each state, the offset into yy_action for
187 ** shifting non-terminals after a reduce.
188 ** yy_default[] Default action for each state.
189 */
190 static const YYACTIONTYPE yy_action[] = {
191 /* 0 */ 292, 903, 124, 588, 409, 172, 2, 418, 61, 61,
192 /* 10 */ 61, 61, 519, 63, 63, 63, 63, 64, 64, 65,
193 /* 20 */ 65, 65, 66, 210, 447, 212, 425, 431, 68, 63,
194 /* 30 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 210,
195 /* 40 */ 391, 388, 396, 451, 60, 59, 297, 435, 436, 432,
196 /* 50 */ 432, 62, 62, 61, 61, 61, 61, 263, 63, 63,
197 /* 60 */ 63, 63, 64, 64, 65, 65, 65, 66, 210, 292,
198 /* 70 */ 493, 494, 418, 489, 208, 82, 67, 420, 69, 154,
199 /* 80 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66,
200 /* 90 */ 210, 67, 462, 69, 154, 425, 431, 574, 264, 58,
201 /* 100 */ 64, 64, 65, 65, 65, 66, 210, 397, 398, 422,
202 /* 110 */ 422, 422, 292, 60, 59, 297, 435, 436, 432, 432,
203 /* 120 */ 62, 62, 61, 61, 61, 61, 317, 63, 63, 63,
204 /* 130 */ 63, 64, 64, 65, 65, 65, 66, 210, 425, 431,
205 /* 140 */ 94, 65, 65, 65, 66, 210, 396, 210, 414, 34,
206 /* 150 */ 56, 298, 442, 443, 410, 418, 60, 59, 297, 435,
207 /* 160 */ 436, 432, 432, 62, 62, 61, 61, 61, 61, 208,
208 /* 170 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66,
209 /* 180 */ 210, 292, 372, 524, 295, 572, 113, 408, 522, 451,
210 /* 190 */ 331, 317, 407, 20, 244, 340, 519, 396, 478, 531,
211 /* 200 */ 505, 447, 212, 571, 570, 245, 530, 425, 431, 149,
212 /* 210 */ 150, 397, 398, 414, 41, 211, 151, 533, 488, 489,
213 /* 220 */ 418, 568, 569, 420, 292, 60, 59, 297, 435, 436,
214 /* 230 */ 432, 432, 62, 62, 61, 61, 61, 61, 317, 63,
215 /* 240 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 210,
216 /* 250 */ 425, 431, 447, 333, 215, 422, 422, 422, 363, 299,
217 /* 260 */ 414, 41, 397, 398, 366, 567, 211, 292, 60, 59,
218 /* 270 */ 297, 435, 436, 432, 432, 62, 62, 61, 61, 61,
219 /* 280 */ 61, 396, 63, 63, 63, 63, 64, 64, 65, 65,
220 /* 290 */ 65, 66, 210, 425, 431, 491, 300, 524, 474, 66,
221 /* 300 */ 210, 214, 474, 229, 411, 286, 534, 20, 449, 523,
222 /* 310 */ 168, 60, 59, 297, 435, 436, 432, 432, 62, 62,
223 /* 320 */ 61, 61, 61, 61, 474, 63, 63, 63, 63, 64,
224 /* 330 */ 64, 65, 65, 65, 66, 210, 209, 480, 317, 77,
225 /* 340 */ 292, 239, 300, 55, 484, 490, 397, 398, 181, 547,
226 /* 350 */ 494, 345, 348, 349, 67, 152, 69, 154, 339, 524,
227 /* 360 */ 414, 35, 350, 241, 221, 370, 425, 431, 579, 20,
228 /* 370 */ 164, 118, 243, 343, 248, 344, 176, 322, 442, 443,
229 /* 380 */ 414, 3, 80, 252, 60, 59, 297, 435, 436, 432,
230 /* 390 */ 432, 62, 62, 61, 61, 61, 61, 174, 63, 63,
231 /* 400 */ 63, 63, 64, 64, 65, 65, 65, 66, 210, 292,
232 /* 410 */ 221, 550, 236, 487, 510, 353, 317, 118, 243, 343,
233 /* 420 */ 248, 344, 176, 181, 317, 532, 345, 348, 349, 252,
234 /* 430 */ 223, 415, 155, 464, 511, 425, 431, 350, 414, 34,
235 /* 440 */ 465, 211, 177, 175, 160, 525, 414, 34, 338, 549,
236 /* 450 */ 449, 323, 168, 60, 59, 297, 435, 436, 432, 432,
237 /* 460 */ 62, 62, 61, 61, 61, 61, 415, 63, 63, 63,
238 /* 470 */ 63, 64, 64, 65, 65, 65, 66, 210, 292, 542,
239 /* 480 */ 335, 517, 504, 541, 456, 572, 302, 19, 331, 144,
240 /* 490 */ 317, 390, 317, 330, 2, 362, 457, 294, 483, 373,
241 /* 500 */ 269, 268, 252, 571, 425, 431, 589, 391, 388, 458,
242 /* 510 */ 208, 495, 414, 49, 414, 49, 303, 586, 894, 230,
243 /* 520 */ 894, 496, 60, 59, 297, 435, 436, 432, 432, 62,
244 /* 530 */ 62, 61, 61, 61, 61, 201, 63, 63, 63, 63,
245 /* 540 */ 64, 64, 65, 65, 65, 66, 210, 292, 317, 181,
246 /* 550 */ 439, 255, 345, 348, 349, 370, 153, 583, 308, 251,
247 /* 560 */ 309, 452, 76, 350, 78, 382, 211, 426, 427, 415,
248 /* 570 */ 414, 27, 319, 425, 431, 440, 1, 22, 586, 893,
249 /* 580 */ 396, 893, 544, 478, 320, 263, 438, 438, 429, 430,
250 /* 590 */ 415, 60, 59, 297, 435, 436, 432, 432, 62, 62,
251 /* 600 */ 61, 61, 61, 61, 237, 63, 63, 63, 63, 64,
252 /* 610 */ 64, 65, 65, 65, 66, 210, 292, 428, 583, 374,
253 /* 620 */ 224, 93, 517, 9, 159, 396, 557, 396, 456, 67,
254 /* 630 */ 396, 69, 154, 399, 400, 401, 320, 328, 438, 438,
255 /* 640 */ 457, 336, 425, 431, 361, 397, 398, 320, 433, 438,
256 /* 650 */ 438, 582, 291, 458, 238, 327, 318, 222, 546, 292,
257 /* 660 */ 60, 59, 297, 435, 436, 432, 432, 62, 62, 61,
258 /* 670 */ 61, 61, 61, 225, 63, 63, 63, 63, 64, 64,
259 /* 680 */ 65, 65, 65, 66, 210, 425, 431, 482, 313, 392,
260 /* 690 */ 397, 398, 397, 398, 207, 397, 398, 825, 273, 517,
261 /* 700 */ 251, 200, 292, 60, 59, 297, 435, 436, 432, 432,
262 /* 710 */ 62, 62, 61, 61, 61, 61, 470, 63, 63, 63,
263 /* 720 */ 63, 64, 64, 65, 65, 65, 66, 210, 425, 431,
264 /* 730 */ 171, 160, 263, 263, 304, 415, 276, 395, 274, 263,
265 /* 740 */ 517, 517, 263, 517, 192, 292, 60, 70, 297, 435,
266 /* 750 */ 436, 432, 432, 62, 62, 61, 61, 61, 61, 379,
267 /* 760 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66,
268 /* 770 */ 210, 425, 431, 384, 559, 305, 306, 251, 415, 320,
269 /* 780 */ 560, 438, 438, 561, 540, 360, 540, 387, 292, 196,
270 /* 790 */ 59, 297, 435, 436, 432, 432, 62, 62, 61, 61,
271 /* 800 */ 61, 61, 371, 63, 63, 63, 63, 64, 64, 65,
272 /* 810 */ 65, 65, 66, 210, 425, 431, 396, 275, 251, 251,
273 /* 820 */ 172, 250, 418, 415, 386, 367, 178, 179, 180, 469,
274 /* 830 */ 311, 123, 156, 5, 297, 435, 436, 432, 432, 62,
275 /* 840 */ 62, 61, 61, 61, 61, 317, 63, 63, 63, 63,
276 /* 850 */ 64, 64, 65, 65, 65, 66, 210, 72, 324, 194,
277 /* 860 */ 4, 317, 263, 317, 296, 263, 415, 414, 28, 317,
278 /* 870 */ 257, 317, 321, 72, 324, 317, 4, 119, 165, 177,
279 /* 880 */ 296, 397, 398, 414, 23, 414, 32, 418, 321, 326,
280 /* 890 */ 421, 414, 53, 414, 52, 317, 158, 414, 98, 451,
281 /* 900 */ 317, 263, 317, 277, 317, 326, 378, 471, 261, 317,
282 /* 910 */ 259, 18, 478, 445, 445, 451, 317, 414, 96, 75,
283 /* 920 */ 74, 469, 414, 101, 414, 102, 414, 112, 73, 315,
284 /* 930 */ 316, 414, 114, 420, 294, 75, 74, 481, 414, 16,
285 /* 940 */ 381, 317, 279, 467, 73, 315, 316, 72, 324, 420,
286 /* 950 */ 4, 208, 317, 183, 296, 317, 186, 128, 84, 208,
287 /* 960 */ 8, 341, 321, 414, 99, 422, 422, 422, 423, 424,
288 /* 970 */ 11, 623, 380, 307, 414, 33, 413, 414, 97, 326,
289 /* 980 */ 412, 422, 422, 422, 423, 424, 11, 415, 413, 451,
290 /* 990 */ 415, 162, 412, 317, 499, 500, 226, 227, 228, 104,
291 /* 1000 */ 448, 476, 317, 173, 507, 317, 509, 508, 317, 75,
292 /* 1010 */ 74, 329, 205, 21, 281, 414, 24, 418, 73, 315,
293 /* 1020 */ 316, 282, 317, 420, 414, 54, 460, 414, 115, 317,
294 /* 1030 */ 414, 116, 502, 203, 147, 549, 514, 468, 128, 202,
295 /* 1040 */ 317, 473, 204, 317, 414, 117, 317, 477, 317, 584,
296 /* 1050 */ 317, 414, 25, 317, 249, 422, 422, 422, 423, 424,
297 /* 1060 */ 11, 506, 414, 36, 512, 414, 37, 317, 414, 26,
298 /* 1070 */ 414, 38, 414, 39, 526, 414, 40, 317, 254, 317,
299 /* 1080 */ 128, 317, 418, 317, 256, 377, 278, 268, 585, 414,
300 /* 1090 */ 42, 293, 317, 352, 317, 128, 208, 513, 258, 414,
301 /* 1100 */ 43, 414, 44, 414, 29, 414, 30, 545, 260, 128,
302 /* 1110 */ 317, 553, 317, 173, 414, 45, 414, 46, 317, 262,
303 /* 1120 */ 383, 554, 317, 91, 564, 317, 91, 317, 581, 189,
304 /* 1130 */ 290, 357, 414, 47, 414, 48, 267, 365, 368, 369,
305 /* 1140 */ 414, 31, 270, 271, 414, 10, 272, 414, 50, 414,
306 /* 1150 */ 51, 556, 566, 280, 283, 284, 578, 146, 419, 405,
307 /* 1160 */ 231, 505, 444, 325, 516, 463, 163, 446, 552, 394,
308 /* 1170 */ 466, 563, 246, 515, 518, 520, 402, 403, 404, 7,
309 /* 1180 */ 314, 84, 232, 334, 347, 83, 332, 57, 170, 79,
310 /* 1190 */ 213, 461, 125, 85, 337, 342, 492, 502, 497, 301,
311 /* 1200 */ 498, 416, 105, 219, 247, 218, 503, 501, 233, 220,
312 /* 1210 */ 287, 234, 527, 528, 235, 529, 417, 521, 354, 288,
313 /* 1220 */ 184, 121, 185, 240, 535, 475, 242, 356, 187, 479,
314 /* 1230 */ 188, 358, 537, 88, 190, 548, 364, 193, 132, 376,
315 /* 1240 */ 555, 375, 133, 134, 135, 310, 562, 138, 136, 575,
316 /* 1250 */ 576, 577, 580, 100, 393, 406, 217, 142, 624, 625,
317 /* 1260 */ 103, 141, 265, 166, 167, 434, 71, 453, 441, 437,
318 /* 1270 */ 450, 143, 538, 157, 120, 454, 161, 472, 455, 169,
319 /* 1280 */ 459, 81, 6, 12, 13, 92, 95, 126, 216, 127,
320 /* 1290 */ 111, 485, 486, 17, 86, 346, 106, 122, 253, 107,
321 /* 1300 */ 87, 108, 182, 245, 355, 145, 351, 536, 129, 359,
322 /* 1310 */ 312, 130, 543, 173, 539, 266, 191, 109, 289, 551,
323 /* 1320 */ 195, 14, 131, 198, 197, 558, 137, 199, 139, 140,
324 /* 1330 */ 15, 565, 89, 90, 573, 110, 385, 206, 148, 389,
325 /* 1340 */ 285, 587,
326 };
327 static const YYCODETYPE yy_lookahead[] = {
328 /* 0 */ 16, 139, 140, 141, 168, 21, 144, 23, 69, 70,
329 /* 10 */ 71, 72, 176, 74, 75, 76, 77, 78, 79, 80,
330 /* 20 */ 81, 82, 83, 84, 78, 79, 42, 43, 73, 74,
331 /* 30 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
332 /* 40 */ 1, 2, 23, 58, 60, 61, 62, 63, 64, 65,
333 /* 50 */ 66, 67, 68, 69, 70, 71, 72, 147, 74, 75,
334 /* 60 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16,
335 /* 70 */ 185, 186, 88, 88, 110, 22, 217, 92, 219, 220,
336 /* 80 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
337 /* 90 */ 84, 217, 218, 219, 220, 42, 43, 238, 188, 46,
338 /* 100 */ 78, 79, 80, 81, 82, 83, 84, 88, 89, 124,
339 /* 110 */ 125, 126, 16, 60, 61, 62, 63, 64, 65, 66,
340 /* 120 */ 67, 68, 69, 70, 71, 72, 147, 74, 75, 76,
341 /* 130 */ 77, 78, 79, 80, 81, 82, 83, 84, 42, 43,
342 /* 140 */ 44, 80, 81, 82, 83, 84, 23, 84, 169, 170,
343 /* 150 */ 19, 164, 165, 166, 23, 23, 60, 61, 62, 63,
344 /* 160 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 110,
345 /* 170 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
346 /* 180 */ 84, 16, 123, 147, 150, 147, 21, 167, 168, 58,
347 /* 190 */ 211, 147, 156, 157, 92, 216, 176, 23, 147, 176,
348 /* 200 */ 177, 78, 79, 165, 166, 103, 183, 42, 43, 78,
349 /* 210 */ 79, 88, 89, 169, 170, 228, 180, 181, 169, 88,
350 /* 220 */ 88, 98, 99, 92, 16, 60, 61, 62, 63, 64,
351 /* 230 */ 65, 66, 67, 68, 69, 70, 71, 72, 147, 74,
352 /* 240 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
353 /* 250 */ 42, 43, 78, 209, 210, 124, 125, 126, 224, 208,
354 /* 260 */ 169, 170, 88, 89, 230, 227, 228, 16, 60, 61,
355 /* 270 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
356 /* 280 */ 72, 23, 74, 75, 76, 77, 78, 79, 80, 81,
357 /* 290 */ 82, 83, 84, 42, 43, 160, 16, 147, 161, 83,
358 /* 300 */ 84, 210, 161, 153, 169, 158, 156, 157, 161, 162,
359 /* 310 */ 163, 60, 61, 62, 63, 64, 65, 66, 67, 68,
360 /* 320 */ 69, 70, 71, 72, 161, 74, 75, 76, 77, 78,
361 /* 330 */ 79, 80, 81, 82, 83, 84, 192, 200, 147, 131,
362 /* 340 */ 16, 200, 16, 199, 20, 169, 88, 89, 90, 185,
363 /* 350 */ 186, 93, 94, 95, 217, 22, 219, 220, 147, 147,
364 /* 360 */ 169, 170, 104, 200, 84, 147, 42, 43, 156, 157,
365 /* 370 */ 90, 91, 92, 93, 94, 95, 96, 164, 165, 166,
366 /* 380 */ 169, 170, 131, 103, 60, 61, 62, 63, 64, 65,
367 /* 390 */ 66, 67, 68, 69, 70, 71, 72, 155, 74, 75,
368 /* 400 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16,
369 /* 410 */ 84, 11, 221, 20, 30, 16, 147, 91, 92, 93,
370 /* 420 */ 94, 95, 96, 90, 147, 181, 93, 94, 95, 103,
371 /* 430 */ 212, 189, 155, 27, 50, 42, 43, 104, 169, 170,
372 /* 440 */ 34, 228, 43, 201, 202, 181, 169, 170, 206, 49,
373 /* 450 */ 161, 162, 163, 60, 61, 62, 63, 64, 65, 66,
374 /* 460 */ 67, 68, 69, 70, 71, 72, 189, 74, 75, 76,
375 /* 470 */ 77, 78, 79, 80, 81, 82, 83, 84, 16, 25,
376 /* 480 */ 211, 147, 20, 29, 12, 147, 102, 19, 211, 21,
377 /* 490 */ 147, 141, 147, 216, 144, 41, 24, 98, 20, 99,
378 /* 500 */ 100, 101, 103, 165, 42, 43, 0, 1, 2, 37,
379 /* 510 */ 110, 39, 169, 170, 169, 170, 182, 19, 20, 190,
380 /* 520 */ 22, 49, 60, 61, 62, 63, 64, 65, 66, 67,
381 /* 530 */ 68, 69, 70, 71, 72, 155, 74, 75, 76, 77,
382 /* 540 */ 78, 79, 80, 81, 82, 83, 84, 16, 147, 90,
383 /* 550 */ 20, 20, 93, 94, 95, 147, 155, 59, 215, 225,
384 /* 560 */ 215, 20, 130, 104, 132, 227, 228, 42, 43, 189,
385 /* 570 */ 169, 170, 16, 42, 43, 20, 19, 22, 19, 20,
386 /* 580 */ 23, 22, 18, 147, 106, 147, 108, 109, 63, 64,
387 /* 590 */ 189, 60, 61, 62, 63, 64, 65, 66, 67, 68,
388 /* 600 */ 69, 70, 71, 72, 147, 74, 75, 76, 77, 78,
389 /* 610 */ 79, 80, 81, 82, 83, 84, 16, 92, 59, 55,
390 /* 620 */ 212, 21, 147, 19, 147, 23, 188, 23, 12, 217,
391 /* 630 */ 23, 219, 220, 7, 8, 9, 106, 186, 108, 109,
392 /* 640 */ 24, 147, 42, 43, 208, 88, 89, 106, 92, 108,
393 /* 650 */ 109, 244, 245, 37, 147, 39, 147, 182, 94, 16,
394 /* 660 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
395 /* 670 */ 70, 71, 72, 145, 74, 75, 76, 77, 78, 79,
396 /* 680 */ 80, 81, 82, 83, 84, 42, 43, 80, 142, 143,
397 /* 690 */ 88, 89, 88, 89, 148, 88, 89, 133, 14, 147,
398 /* 700 */ 225, 155, 16, 60, 61, 62, 63, 64, 65, 66,
399 /* 710 */ 67, 68, 69, 70, 71, 72, 114, 74, 75, 76,
400 /* 720 */ 77, 78, 79, 80, 81, 82, 83, 84, 42, 43,
401 /* 730 */ 201, 202, 147, 147, 182, 189, 52, 147, 54, 147,
402 /* 740 */ 147, 147, 147, 147, 155, 16, 60, 61, 62, 63,
403 /* 750 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 213,
404 /* 760 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
405 /* 770 */ 84, 42, 43, 188, 188, 182, 182, 225, 189, 106,
406 /* 780 */ 188, 108, 109, 188, 99, 100, 101, 241, 16, 155,
407 /* 790 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
408 /* 800 */ 71, 72, 213, 74, 75, 76, 77, 78, 79, 80,
409 /* 810 */ 81, 82, 83, 84, 42, 43, 23, 133, 225, 225,
410 /* 820 */ 21, 225, 23, 189, 239, 236, 99, 100, 101, 22,
411 /* 830 */ 242, 243, 155, 191, 62, 63, 64, 65, 66, 67,
412 /* 840 */ 68, 69, 70, 71, 72, 147, 74, 75, 76, 77,
413 /* 850 */ 78, 79, 80, 81, 82, 83, 84, 16, 17, 22,
414 /* 860 */ 19, 147, 147, 147, 23, 147, 189, 169, 170, 147,
415 /* 870 */ 14, 147, 31, 16, 17, 147, 19, 147, 19, 43,
416 /* 880 */ 23, 88, 89, 169, 170, 169, 170, 88, 31, 48,
417 /* 890 */ 147, 169, 170, 169, 170, 147, 89, 169, 170, 58,
418 /* 900 */ 147, 147, 147, 188, 147, 48, 188, 114, 52, 147,
419 /* 910 */ 54, 19, 147, 124, 125, 58, 147, 169, 170, 78,
420 /* 920 */ 79, 114, 169, 170, 169, 170, 169, 170, 87, 88,
421 /* 930 */ 89, 169, 170, 92, 98, 78, 79, 80, 169, 170,
422 /* 940 */ 91, 147, 188, 22, 87, 88, 89, 16, 17, 92,
423 /* 950 */ 19, 110, 147, 155, 23, 147, 155, 22, 121, 110,
424 /* 960 */ 68, 80, 31, 169, 170, 124, 125, 126, 127, 128,
425 /* 970 */ 129, 112, 123, 208, 169, 170, 107, 169, 170, 48,
426 /* 980 */ 111, 124, 125, 126, 127, 128, 129, 189, 107, 58,
427 /* 990 */ 189, 5, 111, 147, 7, 8, 10, 11, 12, 13,
428 /* 1000 */ 161, 20, 147, 22, 178, 147, 91, 92, 147, 78,
429 /* 1010 */ 79, 147, 26, 19, 28, 169, 170, 23, 87, 88,
430 /* 1020 */ 89, 35, 147, 92, 169, 170, 147, 169, 170, 147,
431 /* 1030 */ 169, 170, 97, 47, 113, 49, 20, 203, 22, 53,
432 /* 1040 */ 147, 147, 56, 147, 169, 170, 147, 147, 147, 20,
433 /* 1050 */ 147, 169, 170, 147, 147, 124, 125, 126, 127, 128,
434 /* 1060 */ 129, 147, 169, 170, 178, 169, 170, 147, 169, 170,
435 /* 1070 */ 169, 170, 169, 170, 147, 169, 170, 147, 20, 147,
436 /* 1080 */ 22, 147, 88, 147, 147, 99, 100, 101, 59, 169,
437 /* 1090 */ 170, 105, 147, 20, 147, 22, 110, 178, 147, 169,
438 /* 1100 */ 170, 169, 170, 169, 170, 169, 170, 20, 147, 22,
439 /* 1110 */ 147, 20, 147, 22, 169, 170, 169, 170, 147, 147,
440 /* 1120 */ 134, 20, 147, 22, 20, 147, 22, 147, 20, 232,
441 /* 1130 */ 22, 233, 169, 170, 169, 170, 147, 147, 147, 147,
442 /* 1140 */ 169, 170, 147, 147, 169, 170, 147, 169, 170, 169,
443 /* 1150 */ 170, 147, 147, 147, 147, 147, 147, 191, 161, 149,
444 /* 1160 */ 193, 177, 229, 223, 161, 172, 6, 229, 194, 146,
445 /* 1170 */ 172, 194, 172, 172, 172, 161, 146, 146, 146, 22,
446 /* 1180 */ 154, 121, 194, 118, 173, 119, 116, 120, 112, 130,
447 /* 1190 */ 222, 152, 152, 98, 115, 98, 171, 97, 171, 40,
448 /* 1200 */ 179, 189, 19, 84, 171, 226, 171, 173, 195, 226,
449 /* 1210 */ 174, 196, 171, 171, 197, 171, 198, 179, 15, 174,
450 /* 1220 */ 151, 60, 151, 204, 152, 205, 204, 152, 151, 205,
451 /* 1230 */ 152, 38, 152, 130, 151, 184, 152, 184, 19, 15,
452 /* 1240 */ 194, 152, 187, 187, 187, 152, 194, 184, 187, 33,
453 /* 1250 */ 152, 152, 137, 159, 1, 20, 175, 214, 112, 112,
454 /* 1260 */ 175, 214, 234, 112, 112, 92, 19, 11, 20, 107,
455 /* 1270 */ 20, 19, 235, 19, 32, 20, 112, 114, 20, 22,
456 /* 1280 */ 20, 22, 117, 22, 117, 237, 237, 19, 44, 20,
457 /* 1290 */ 240, 20, 20, 231, 19, 44, 19, 243, 20, 19,
458 /* 1300 */ 19, 19, 96, 103, 16, 21, 44, 17, 98, 36,
459 /* 1310 */ 246, 45, 45, 22, 51, 133, 98, 19, 5, 1,
460 /* 1320 */ 122, 19, 102, 14, 113, 17, 113, 115, 102, 122,
461 /* 1330 */ 19, 123, 68, 68, 20, 14, 57, 135, 19, 3,
462 /* 1340 */ 136, 4,
463 };
464 #define YY_SHIFT_USE_DFLT (-62)
465 #define YY_SHIFT_MAX 389
466 static const short yy_shift_ofst[] = {
467 /* 0 */ 39, 841, 986, -16, 841, 931, 931, 258, 123, -36,
468 /* 10 */ 96, 931, 931, 931, 931, 931, -45, 400, 174, 19,
469 /* 20 */ 132, -54, -54, 53, 165, 208, 251, 324, 393, 462,
470 /* 30 */ 531, 600, 643, 686, 643, 643, 643, 643, 643, 643,
471 /* 40 */ 643, 643, 643, 643, 643, 643, 643, 643, 643, 643,
472 /* 50 */ 643, 643, 729, 772, 772, 857, 931, 931, 931, 931,
473 /* 60 */ 931, 931, 931, 931, 931, 931, 931, 931, 931, 931,
474 /* 70 */ 931, 931, 931, 931, 931, 931, 931, 931, 931, 931,
475 /* 80 */ 931, 931, 931, 931, 931, 931, 931, 931, 931, 931,
476 /* 90 */ 931, 931, 931, 931, 931, 931, -61, -61, 6, 6,
477 /* 100 */ 280, 22, 61, 399, 564, 19, 19, 19, 19, 19,
478 /* 110 */ 19, 19, 216, 132, 63, -62, -62, -62, 131, 326,
479 /* 120 */ 472, 472, 498, 559, 506, 799, 19, 799, 19, 19,
480 /* 130 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
481 /* 140 */ 19, 849, 59, -36, -36, -36, -62, -62, -62, -15,
482 /* 150 */ -15, 333, 459, 478, 557, 530, 541, 616, 602, 793,
483 /* 160 */ 604, 607, 626, 19, 19, 881, 19, 19, 994, 19,
484 /* 170 */ 19, 807, 19, 19, 673, 807, 19, 19, 384, 384,
485 /* 180 */ 384, 19, 19, 673, 19, 19, 673, 19, 454, 685,
486 /* 190 */ 19, 19, 673, 19, 19, 19, 673, 19, 19, 19,
487 /* 200 */ 673, 673, 19, 19, 19, 19, 19, 468, 869, 921,
488 /* 210 */ 132, 789, 789, 432, 406, 406, 406, 836, 406, 132,
489 /* 220 */ 406, 132, 935, 837, 837, 1160, 1160, 1160, 1160, 1157,
490 /* 230 */ -36, 1060, 1065, 1066, 1070, 1067, 1059, 1076, 1076, 1095,
491 /* 240 */ 1079, 1095, 1079, 1097, 1097, 1159, 1097, 1100, 1097, 1183,
492 /* 250 */ 1119, 1119, 1159, 1097, 1097, 1097, 1183, 1203, 1076, 1203,
493 /* 260 */ 1076, 1203, 1076, 1076, 1193, 1103, 1203, 1076, 1161, 1161,
494 /* 270 */ 1219, 1060, 1076, 1224, 1224, 1224, 1224, 1060, 1161, 1219,
495 /* 280 */ 1076, 1216, 1216, 1076, 1076, 1115, -62, -62, -62, -62,
496 /* 290 */ -62, -62, 525, 684, 727, 856, 859, 556, 555, 981,
497 /* 300 */ 102, 987, 915, 1016, 1058, 1073, 1087, 1091, 1101, 1104,
498 /* 310 */ 892, 1108, 1029, 1253, 1235, 1146, 1147, 1151, 1152, 1173,
499 /* 320 */ 1162, 1247, 1248, 1250, 1252, 1256, 1254, 1255, 1257, 1258,
500 /* 330 */ 1260, 1259, 1165, 1261, 1167, 1259, 1163, 1268, 1269, 1164,
501 /* 340 */ 1271, 1272, 1242, 1244, 1275, 1251, 1277, 1278, 1280, 1281,
502 /* 350 */ 1262, 1282, 1206, 1200, 1288, 1290, 1284, 1210, 1273, 1263,
503 /* 360 */ 1266, 1291, 1267, 1182, 1218, 1298, 1313, 1318, 1220, 1264,
504 /* 370 */ 1265, 1198, 1302, 1211, 1309, 1212, 1308, 1213, 1226, 1207,
505 /* 380 */ 1311, 1208, 1314, 1321, 1279, 1202, 1204, 1319, 1336, 1337,
506 };
507 #define YY_REDUCE_USE_DFLT (-165)
508 #define YY_REDUCE_MAX 291
509 static const short yy_reduce_ofst[] = {
510 /* 0 */ -138, 277, 546, 137, 401, -21, 44, 36, 38, 242,
511 /* 10 */ -141, 191, 91, 269, 343, 345, -126, 589, 338, 150,
512 /* 20 */ 147, -13, 213, 412, 412, 412, 412, 412, 412, 412,
513 /* 30 */ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
514 /* 40 */ 412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
515 /* 50 */ 412, 412, 412, 412, 412, 211, 698, 714, 716, 722,
516 /* 60 */ 724, 728, 748, 753, 755, 757, 762, 769, 794, 805,
517 /* 70 */ 808, 846, 855, 858, 861, 875, 882, 893, 896, 899,
518 /* 80 */ 901, 903, 906, 920, 930, 932, 934, 936, 945, 947,
519 /* 90 */ 963, 965, 971, 975, 978, 980, 412, 412, 412, 412,
520 /* 100 */ 20, 412, 412, 23, 34, 334, 475, 552, 593, 594,
521 /* 110 */ 585, 212, 412, 289, 412, 412, 412, 412, 135, -164,
522 /* 120 */ -115, 164, 407, 407, 350, 141, 51, 163, 596, -90,
523 /* 130 */ 436, 218, 765, 438, 586, 592, 595, 715, 718, 408,
524 /* 140 */ 754, 380, 634, 677, 798, 801, 144, 529, 588, 49,
525 /* 150 */ 176, 244, 264, 329, 457, 329, 329, 451, 477, 494,
526 /* 160 */ 507, 509, 528, 590, 730, 642, 509, 743, 839, 864,
527 /* 170 */ 879, 834, 894, 900, 329, 834, 907, 914, 826, 886,
528 /* 180 */ 919, 927, 937, 329, 951, 961, 329, 972, 897, 898,
529 /* 190 */ 989, 990, 329, 991, 992, 995, 329, 996, 999, 1004,
530 /* 200 */ 329, 329, 1005, 1006, 1007, 1008, 1009, 1010, 966, 967,
531 /* 210 */ 997, 933, 938, 940, 993, 998, 1000, 984, 1001, 1003,
532 /* 220 */ 1002, 1014, 1011, 974, 977, 1023, 1030, 1031, 1032, 1026,
533 /* 230 */ 1012, 988, 1013, 1015, 1017, 1018, 968, 1039, 1040, 1019,
534 /* 240 */ 1020, 1022, 1024, 1025, 1027, 1021, 1033, 1034, 1035, 1036,
535 /* 250 */ 979, 983, 1038, 1041, 1042, 1044, 1045, 1069, 1072, 1071,
536 /* 260 */ 1075, 1077, 1078, 1080, 1028, 1037, 1083, 1084, 1051, 1053,
537 /* 270 */ 1043, 1046, 1089, 1055, 1056, 1057, 1061, 1052, 1063, 1047,
538 /* 280 */ 1093, 1048, 1049, 1098, 1099, 1050, 1094, 1081, 1085, 1062,
539 /* 290 */ 1054, 1064,
540 };
541 static const YYACTIONTYPE yy_default[] = {
542 /* 0 */ 595, 820, 902, 710, 902, 820, 902, 902, 848, 714,
543 /* 10 */ 877, 818, 902, 902, 902, 902, 792, 902, 848, 902,
544 /* 20 */ 626, 848, 848, 743, 902, 902, 902, 902, 902, 902,
545 /* 30 */ 902, 902, 744, 902, 822, 817, 813, 815, 814, 821,
546 /* 40 */ 745, 734, 741, 748, 726, 861, 750, 751, 757, 758,
547 /* 50 */ 878, 876, 780, 779, 798, 902, 902, 902, 902, 902,
548 /* 60 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
549 /* 70 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
550 /* 80 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
551 /* 90 */ 902, 902, 902, 902, 902, 902, 782, 804, 781, 791,
552 /* 100 */ 619, 783, 784, 679, 614, 902, 902, 902, 902, 902,
553 /* 110 */ 902, 902, 785, 902, 786, 799, 800, 801, 902, 902,
554 /* 120 */ 902, 902, 902, 902, 595, 710, 902, 710, 902, 902,
555 /* 130 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
556 /* 140 */ 902, 902, 902, 902, 902, 902, 704, 714, 895, 902,
557 /* 150 */ 902, 670, 902, 902, 902, 902, 902, 902, 902, 902,
558 /* 160 */ 902, 902, 602, 600, 902, 702, 902, 902, 628, 902,
559 /* 170 */ 902, 712, 902, 902, 717, 718, 902, 902, 902, 902,
560 /* 180 */ 902, 902, 902, 616, 902, 902, 691, 902, 854, 902,
561 /* 190 */ 902, 902, 868, 902, 902, 902, 866, 902, 902, 902,
562 /* 200 */ 693, 753, 834, 902, 881, 883, 902, 902, 702, 711,
563 /* 210 */ 902, 902, 902, 816, 737, 737, 737, 649, 737, 902,
564 /* 220 */ 737, 902, 652, 747, 747, 599, 599, 599, 599, 669,
565 /* 230 */ 902, 747, 738, 740, 730, 742, 902, 719, 719, 727,
566 /* 240 */ 729, 727, 729, 681, 681, 666, 681, 652, 681, 826,
567 /* 250 */ 831, 831, 666, 681, 681, 681, 826, 611, 719, 611,
568 /* 260 */ 719, 611, 719, 719, 858, 860, 611, 719, 683, 683,
569 /* 270 */ 759, 747, 719, 690, 690, 690, 690, 747, 683, 759,
570 /* 280 */ 719, 880, 880, 719, 719, 888, 636, 654, 654, 863,
571 /* 290 */ 895, 900, 902, 902, 902, 902, 766, 902, 902, 902,
572 /* 300 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
573 /* 310 */ 841, 902, 902, 902, 902, 771, 767, 902, 768, 902,
574 /* 320 */ 696, 902, 902, 902, 902, 902, 902, 902, 902, 902,
575 /* 330 */ 902, 819, 902, 731, 902, 739, 902, 902, 902, 902,
576 /* 340 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
577 /* 350 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
578 /* 360 */ 856, 857, 902, 902, 902, 902, 902, 902, 902, 902,
579 /* 370 */ 902, 902, 902, 902, 902, 902, 902, 902, 902, 902,
580 /* 380 */ 902, 902, 902, 902, 887, 902, 902, 890, 596, 902,
581 /* 390 */ 590, 593, 592, 594, 598, 601, 623, 624, 625, 603,
582 /* 400 */ 604, 605, 606, 607, 608, 609, 615, 617, 635, 637,
583 /* 410 */ 621, 639, 700, 701, 763, 694, 695, 699, 622, 774,
584 /* 420 */ 765, 769, 770, 772, 773, 787, 788, 790, 796, 803,
585 /* 430 */ 806, 789, 794, 795, 797, 802, 805, 697, 698, 809,
586 /* 440 */ 629, 630, 633, 634, 844, 846, 845, 847, 632, 631,
587 /* 450 */ 775, 778, 811, 812, 869, 870, 871, 872, 873, 807,
588 /* 460 */ 720, 810, 793, 732, 735, 736, 733, 703, 713, 722,
589 /* 470 */ 723, 724, 725, 708, 709, 715, 728, 761, 762, 716,
590 /* 480 */ 705, 706, 707, 808, 764, 776, 777, 640, 641, 771,
591 /* 490 */ 642, 643, 644, 682, 685, 686, 687, 645, 664, 667,
592 /* 500 */ 668, 646, 653, 647, 648, 655, 656, 657, 660, 661,
593 /* 510 */ 662, 663, 658, 659, 827, 828, 832, 830, 829, 650,
594 /* 520 */ 651, 665, 638, 627, 620, 671, 674, 675, 676, 677,
595 /* 530 */ 678, 680, 672, 673, 618, 610, 612, 721, 850, 859,
596 /* 540 */ 855, 851, 852, 853, 613, 823, 824, 684, 755, 756,
597 /* 550 */ 849, 862, 864, 760, 865, 867, 892, 688, 689, 692,
598 /* 560 */ 833, 874, 746, 749, 752, 754, 835, 836, 837, 838,
599 /* 570 */ 839, 842, 843, 840, 875, 879, 882, 884, 885, 886,
600 /* 580 */ 889, 891, 896, 897, 898, 901, 899, 597, 591,
601 };
602 #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
603
604 /* The next table maps tokens into fallback tokens. If a construct
605 ** like the following:
606 **
607 ** %fallback ID X Y Z.
608 **
609 ** appears in the grammer, then ID becomes a fallback token for X, Y,
610 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
611 ** but it does not parse, the type of the token is changed to ID and
612 ** the parse is retried before an error is thrown.
613 */
614 #ifdef YYFALLBACK
615 static const YYCODETYPE yyFallback[] = {
616 0, /* $ => nothing */
617 0, /* SEMI => nothing */
618 23, /* EXPLAIN => ID */
619 23, /* QUERY => ID */
620 23, /* PLAN => ID */
621 23, /* BEGIN => ID */
622 0, /* TRANSACTION => nothing */
623 23, /* DEFERRED => ID */
624 23, /* IMMEDIATE => ID */
625 23, /* EXCLUSIVE => ID */
626 0, /* COMMIT => nothing */
627 23, /* END => ID */
628 0, /* ROLLBACK => nothing */
629 0, /* CREATE => nothing */
630 0, /* TABLE => nothing */
631 23, /* IF => ID */
632 0, /* NOT => nothing */
633 0, /* EXISTS => nothing */
634 23, /* TEMP => ID */
635 0, /* LP => nothing */
636 0, /* RP => nothing */
637 0, /* AS => nothing */
638 0, /* COMMA => nothing */
639 0, /* ID => nothing */
640 23, /* ABORT => ID */
641 23, /* AFTER => ID */
642 23, /* ANALYZE => ID */
643 23, /* ASC => ID */
644 23, /* ATTACH => ID */
645 23, /* BEFORE => ID */
646 23, /* CASCADE => ID */
647 23, /* CAST => ID */
648 23, /* CONFLICT => ID */
649 23, /* DATABASE => ID */
650 23, /* DESC => ID */
651 23, /* DETACH => ID */
652 23, /* EACH => ID */
653 23, /* FAIL => ID */
654 23, /* FOR => ID */
655 23, /* IGNORE => ID */
656 23, /* INITIALLY => ID */
657 23, /* INSTEAD => ID */
658 23, /* LIKE_KW => ID */
659 23, /* MATCH => ID */
660 23, /* KEY => ID */
661 23, /* OF => ID */
662 23, /* OFFSET => ID */
663 23, /* PRAGMA => ID */
664 23, /* RAISE => ID */
665 23, /* REPLACE => ID */
666 23, /* RESTRICT => ID */
667 23, /* ROW => ID */
668 23, /* TRIGGER => ID */
669 23, /* VACUUM => ID */
670 23, /* VIEW => ID */
671 23, /* VIRTUAL => ID */
672 23, /* REINDEX => ID */
673 23, /* RENAME => ID */
674 23, /* CTIME_KW => ID */
675 0, /* ANY => nothing */
676 0, /* OR => nothing */
677 0, /* AND => nothing */
678 0, /* IS => nothing */
679 0, /* BETWEEN => nothing */
680 0, /* IN => nothing */
681 0, /* ISNULL => nothing */
682 0, /* NOTNULL => nothing */
683 0, /* NE => nothing */
684 0, /* EQ => nothing */
685 0, /* GT => nothing */
686 0, /* LE => nothing */
687 0, /* LT => nothing */
688 0, /* GE => nothing */
689 0, /* ESCAPE => nothing */
690 0, /* BITAND => nothing */
691 0, /* BITOR => nothing */
692 0, /* LSHIFT => nothing */
693 0, /* RSHIFT => nothing */
694 0, /* PLUS => nothing */
695 0, /* MINUS => nothing */
696 0, /* STAR => nothing */
697 0, /* SLASH => nothing */
698 0, /* REM => nothing */
699 0, /* CONCAT => nothing */
700 0, /* COLLATE => nothing */
701 0, /* UMINUS => nothing */
702 0, /* UPLUS => nothing */
703 0, /* BITNOT => nothing */
704 0, /* STRING => nothing */
705 0, /* JOIN_KW => nothing */
706 0, /* CONSTRAINT => nothing */
707 0, /* DEFAULT => nothing */
708 0, /* NULL => nothing */
709 0, /* PRIMARY => nothing */
710 0, /* UNIQUE => nothing */
711 0, /* CHECK => nothing */
712 0, /* REFERENCES => nothing */
713 0, /* AUTOINCR => nothing */
714 0, /* ON => nothing */
715 0, /* DELETE => nothing */
716 0, /* UPDATE => nothing */
717 0, /* INSERT => nothing */
718 0, /* SET => nothing */
719 0, /* DEFERRABLE => nothing */
720 0, /* FOREIGN => nothing */
721 0, /* DROP => nothing */
722 0, /* UNION => nothing */
723 0, /* ALL => nothing */
724 0, /* EXCEPT => nothing */
725 0, /* INTERSECT => nothing */
726 0, /* SELECT => nothing */
727 0, /* DISTINCT => nothing */
728 0, /* DOT => nothing */
729 0, /* FROM => nothing */
730 0, /* JOIN => nothing */
731 0, /* USING => nothing */
732 0, /* ORDER => nothing */
733 0, /* BY => nothing */
734 0, /* GROUP => nothing */
735 0, /* HAVING => nothing */
736 0, /* LIMIT => nothing */
737 0, /* WHERE => nothing */
738 0, /* INTO => nothing */
739 0, /* VALUES => nothing */
740 0, /* INTEGER => nothing */
741 0, /* FLOAT => nothing */
742 0, /* BLOB => nothing */
743 0, /* REGISTER => nothing */
744 0, /* VARIABLE => nothing */
745 0, /* CASE => nothing */
746 0, /* WHEN => nothing */
747 0, /* THEN => nothing */
748 0, /* ELSE => nothing */
749 0, /* INDEX => nothing */
750 0, /* ALTER => nothing */
751 0, /* TO => nothing */
752 0, /* ADD => nothing */
753 0, /* COLUMNKW => nothing */
754 };
755 #endif /* YYFALLBACK */
756
757 /* The following structure represents a single element of the
758 ** parser's stack. Information stored includes:
759 **
760 ** + The state number for the parser at this level of the stack.
761 **
762 ** + The value of the token stored at this level of the stack.
763 ** (In other words, the "major" token.)
764 **
765 ** + The semantic value stored at this level of the stack. This is
766 ** the information used by the action routines in the grammar.
767 ** It is sometimes called the "minor" token.
768 */
769 struct yyStackEntry {
770 int stateno; /* The state-number */
771 int major; /* The major token value. This is the code
772 ** number for the token at this stack level */
773 YYMINORTYPE minor; /* The user-supplied minor token value. This
774 ** is the value of the token */
775 };
776 typedef struct yyStackEntry yyStackEntry;
777
778 /* The state of the parser is completely contained in an instance of
779 ** the following structure */
780 struct yyParser {
781 int yyidx; /* Index of top element in stack */
782 int yyerrcnt; /* Shifts left before out of the error */
783 sqlite3ParserARG_SDECL /* A place to hold %extra_argument */
784 #if YYSTACKDEPTH<=0
785 int yystksz; /* Current side of the stack */
786 yyStackEntry *yystack; /* The parser's stack */
787 #else
788 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
789 #endif
790 };
791 typedef struct yyParser yyParser;
792
793 #ifndef NDEBUG
794 #include <stdio.h>
795 static FILE *yyTraceFILE = 0;
796 static char *yyTracePrompt = 0;
797 #endif /* NDEBUG */
798
799 #ifndef NDEBUG
800 /*
801 ** Turn parser tracing on by giving a stream to which to write the trace
802 ** and a prompt to preface each trace message. Tracing is turned off
803 ** by making either argument NULL
804 **
805 ** Inputs:
806 ** <ul>
807 ** <li> A FILE* to which trace output should be written.
808 ** If NULL, then tracing is turned off.
809 ** <li> A prefix string written at the beginning of every
810 ** line of trace output. If NULL, then tracing is
811 ** turned off.
812 ** </ul>
813 **
814 ** Outputs:
815 ** None.
816 */
sqlite3ParserTrace(FILE * TraceFILE,char * zTracePrompt)817 void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){
818 yyTraceFILE = TraceFILE;
819 yyTracePrompt = zTracePrompt;
820 if( yyTraceFILE==0 ) yyTracePrompt = 0;
821 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
822 }
823 #endif /* NDEBUG */
824
825 #ifndef NDEBUG
826 /* For tracing shifts, the names of all terminals and nonterminals
827 ** are required. The following table supplies these names */
828 static const char *const yyTokenName[] = {
829 "$", "SEMI", "EXPLAIN", "QUERY",
830 "PLAN", "BEGIN", "TRANSACTION", "DEFERRED",
831 "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END",
832 "ROLLBACK", "CREATE", "TABLE", "IF",
833 "NOT", "EXISTS", "TEMP", "LP",
834 "RP", "AS", "COMMA", "ID",
835 "ABORT", "AFTER", "ANALYZE", "ASC",
836 "ATTACH", "BEFORE", "CASCADE", "CAST",
837 "CONFLICT", "DATABASE", "DESC", "DETACH",
838 "EACH", "FAIL", "FOR", "IGNORE",
839 "INITIALLY", "INSTEAD", "LIKE_KW", "MATCH",
840 "KEY", "OF", "OFFSET", "PRAGMA",
841 "RAISE", "REPLACE", "RESTRICT", "ROW",
842 "TRIGGER", "VACUUM", "VIEW", "VIRTUAL",
843 "REINDEX", "RENAME", "CTIME_KW", "ANY",
844 "OR", "AND", "IS", "BETWEEN",
845 "IN", "ISNULL", "NOTNULL", "NE",
846 "EQ", "GT", "LE", "LT",
847 "GE", "ESCAPE", "BITAND", "BITOR",
848 "LSHIFT", "RSHIFT", "PLUS", "MINUS",
849 "STAR", "SLASH", "REM", "CONCAT",
850 "COLLATE", "UMINUS", "UPLUS", "BITNOT",
851 "STRING", "JOIN_KW", "CONSTRAINT", "DEFAULT",
852 "NULL", "PRIMARY", "UNIQUE", "CHECK",
853 "REFERENCES", "AUTOINCR", "ON", "DELETE",
854 "UPDATE", "INSERT", "SET", "DEFERRABLE",
855 "FOREIGN", "DROP", "UNION", "ALL",
856 "EXCEPT", "INTERSECT", "SELECT", "DISTINCT",
857 "DOT", "FROM", "JOIN", "USING",
858 "ORDER", "BY", "GROUP", "HAVING",
859 "LIMIT", "WHERE", "INTO", "VALUES",
860 "INTEGER", "FLOAT", "BLOB", "REGISTER",
861 "VARIABLE", "CASE", "WHEN", "THEN",
862 "ELSE", "INDEX", "ALTER", "TO",
863 "ADD", "COLUMNKW", "error", "input",
864 "cmdlist", "ecmd", "cmdx", "cmd",
865 "explain", "transtype", "trans_opt", "nm",
866 "create_table", "create_table_args", "temp", "ifnotexists",
867 "dbnm", "columnlist", "conslist_opt", "select",
868 "column", "columnid", "type", "carglist",
869 "id", "ids", "typetoken", "typename",
870 "signed", "plus_num", "minus_num", "carg",
871 "ccons", "term", "expr", "onconf",
872 "sortorder", "autoinc", "idxlist_opt", "refargs",
873 "defer_subclause", "refarg", "refact", "init_deferred_pred_opt",
874 "conslist", "tcons", "idxlist", "defer_subclause_opt",
875 "orconf", "resolvetype", "raisetype", "ifexists",
876 "fullname", "oneselect", "multiselect_op", "distinct",
877 "selcollist", "from", "where_opt", "groupby_opt",
878 "having_opt", "orderby_opt", "limit_opt", "sclp",
879 "as", "seltablist", "stl_prefix", "joinop",
880 "on_opt", "using_opt", "seltablist_paren", "joinop2",
881 "inscollist", "sortlist", "sortitem", "nexprlist",
882 "setlist", "insert_cmd", "inscollist_opt", "itemlist",
883 "exprlist", "likeop", "escape", "between_op",
884 "in_op", "case_operand", "case_exprlist", "case_else",
885 "uniqueflag", "idxitem", "collate", "nmnum",
886 "plus_opt", "number", "trigger_decl", "trigger_cmd_list",
887 "trigger_time", "trigger_event", "foreach_clause", "when_clause",
888 "trigger_cmd", "database_kw_opt", "key_opt", "add_column_fullname",
889 "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg",
890 "vtabargtoken", "lp", "anylist",
891 };
892 #endif /* NDEBUG */
893
894 #ifndef NDEBUG
895 /* For tracing reduce actions, the names of all rules are required.
896 */
897 static const char *const yyRuleName[] = {
898 /* 0 */ "input ::= cmdlist",
899 /* 1 */ "cmdlist ::= cmdlist ecmd",
900 /* 2 */ "cmdlist ::= ecmd",
901 /* 3 */ "cmdx ::= cmd",
902 /* 4 */ "ecmd ::= SEMI",
903 /* 5 */ "ecmd ::= explain cmdx SEMI",
904 /* 6 */ "explain ::=",
905 /* 7 */ "explain ::= EXPLAIN",
906 /* 8 */ "explain ::= EXPLAIN QUERY PLAN",
907 /* 9 */ "cmd ::= BEGIN transtype trans_opt",
908 /* 10 */ "trans_opt ::=",
909 /* 11 */ "trans_opt ::= TRANSACTION",
910 /* 12 */ "trans_opt ::= TRANSACTION nm",
911 /* 13 */ "transtype ::=",
912 /* 14 */ "transtype ::= DEFERRED",
913 /* 15 */ "transtype ::= IMMEDIATE",
914 /* 16 */ "transtype ::= EXCLUSIVE",
915 /* 17 */ "cmd ::= COMMIT trans_opt",
916 /* 18 */ "cmd ::= END trans_opt",
917 /* 19 */ "cmd ::= ROLLBACK trans_opt",
918 /* 20 */ "cmd ::= create_table create_table_args",
919 /* 21 */ "create_table ::= CREATE temp TABLE ifnotexists nm dbnm",
920 /* 22 */ "ifnotexists ::=",
921 /* 23 */ "ifnotexists ::= IF NOT EXISTS",
922 /* 24 */ "temp ::= TEMP",
923 /* 25 */ "temp ::=",
924 /* 26 */ "create_table_args ::= LP columnlist conslist_opt RP",
925 /* 27 */ "create_table_args ::= AS select",
926 /* 28 */ "columnlist ::= columnlist COMMA column",
927 /* 29 */ "columnlist ::= column",
928 /* 30 */ "column ::= columnid type carglist",
929 /* 31 */ "columnid ::= nm",
930 /* 32 */ "id ::= ID",
931 /* 33 */ "ids ::= ID|STRING",
932 /* 34 */ "nm ::= ID",
933 /* 35 */ "nm ::= STRING",
934 /* 36 */ "nm ::= JOIN_KW",
935 /* 37 */ "type ::=",
936 /* 38 */ "type ::= typetoken",
937 /* 39 */ "typetoken ::= typename",
938 /* 40 */ "typetoken ::= typename LP signed RP",
939 /* 41 */ "typetoken ::= typename LP signed COMMA signed RP",
940 /* 42 */ "typename ::= ids",
941 /* 43 */ "typename ::= typename ids",
942 /* 44 */ "signed ::= plus_num",
943 /* 45 */ "signed ::= minus_num",
944 /* 46 */ "carglist ::= carglist carg",
945 /* 47 */ "carglist ::=",
946 /* 48 */ "carg ::= CONSTRAINT nm ccons",
947 /* 49 */ "carg ::= ccons",
948 /* 50 */ "ccons ::= DEFAULT term",
949 /* 51 */ "ccons ::= DEFAULT LP expr RP",
950 /* 52 */ "ccons ::= DEFAULT PLUS term",
951 /* 53 */ "ccons ::= DEFAULT MINUS term",
952 /* 54 */ "ccons ::= DEFAULT id",
953 /* 55 */ "ccons ::= NULL onconf",
954 /* 56 */ "ccons ::= NOT NULL onconf",
955 /* 57 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
956 /* 58 */ "ccons ::= UNIQUE onconf",
957 /* 59 */ "ccons ::= CHECK LP expr RP",
958 /* 60 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
959 /* 61 */ "ccons ::= defer_subclause",
960 /* 62 */ "ccons ::= COLLATE ids",
961 /* 63 */ "autoinc ::=",
962 /* 64 */ "autoinc ::= AUTOINCR",
963 /* 65 */ "refargs ::=",
964 /* 66 */ "refargs ::= refargs refarg",
965 /* 67 */ "refarg ::= MATCH nm",
966 /* 68 */ "refarg ::= ON DELETE refact",
967 /* 69 */ "refarg ::= ON UPDATE refact",
968 /* 70 */ "refarg ::= ON INSERT refact",
969 /* 71 */ "refact ::= SET NULL",
970 /* 72 */ "refact ::= SET DEFAULT",
971 /* 73 */ "refact ::= CASCADE",
972 /* 74 */ "refact ::= RESTRICT",
973 /* 75 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
974 /* 76 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
975 /* 77 */ "init_deferred_pred_opt ::=",
976 /* 78 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
977 /* 79 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
978 /* 80 */ "conslist_opt ::=",
979 /* 81 */ "conslist_opt ::= COMMA conslist",
980 /* 82 */ "conslist ::= conslist COMMA tcons",
981 /* 83 */ "conslist ::= conslist tcons",
982 /* 84 */ "conslist ::= tcons",
983 /* 85 */ "tcons ::= CONSTRAINT nm",
984 /* 86 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
985 /* 87 */ "tcons ::= UNIQUE LP idxlist RP onconf",
986 /* 88 */ "tcons ::= CHECK LP expr RP onconf",
987 /* 89 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
988 /* 90 */ "defer_subclause_opt ::=",
989 /* 91 */ "defer_subclause_opt ::= defer_subclause",
990 /* 92 */ "onconf ::=",
991 /* 93 */ "onconf ::= ON CONFLICT resolvetype",
992 /* 94 */ "orconf ::=",
993 /* 95 */ "orconf ::= OR resolvetype",
994 /* 96 */ "resolvetype ::= raisetype",
995 /* 97 */ "resolvetype ::= IGNORE",
996 /* 98 */ "resolvetype ::= REPLACE",
997 /* 99 */ "cmd ::= DROP TABLE ifexists fullname",
998 /* 100 */ "ifexists ::= IF EXISTS",
999 /* 101 */ "ifexists ::=",
1000 /* 102 */ "cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select",
1001 /* 103 */ "cmd ::= DROP VIEW ifexists fullname",
1002 /* 104 */ "cmd ::= select",
1003 /* 105 */ "select ::= oneselect",
1004 /* 106 */ "select ::= select multiselect_op oneselect",
1005 /* 107 */ "multiselect_op ::= UNION",
1006 /* 108 */ "multiselect_op ::= UNION ALL",
1007 /* 109 */ "multiselect_op ::= EXCEPT|INTERSECT",
1008 /* 110 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
1009 /* 111 */ "distinct ::= DISTINCT",
1010 /* 112 */ "distinct ::= ALL",
1011 /* 113 */ "distinct ::=",
1012 /* 114 */ "sclp ::= selcollist COMMA",
1013 /* 115 */ "sclp ::=",
1014 /* 116 */ "selcollist ::= sclp expr as",
1015 /* 117 */ "selcollist ::= sclp STAR",
1016 /* 118 */ "selcollist ::= sclp nm DOT STAR",
1017 /* 119 */ "as ::= AS nm",
1018 /* 120 */ "as ::= ids",
1019 /* 121 */ "as ::=",
1020 /* 122 */ "from ::=",
1021 /* 123 */ "from ::= FROM seltablist",
1022 /* 124 */ "stl_prefix ::= seltablist joinop",
1023 /* 125 */ "stl_prefix ::=",
1024 /* 126 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
1025 /* 127 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
1026 /* 128 */ "seltablist_paren ::= select",
1027 /* 129 */ "seltablist_paren ::= seltablist",
1028 /* 130 */ "dbnm ::=",
1029 /* 131 */ "dbnm ::= DOT nm",
1030 /* 132 */ "fullname ::= nm dbnm",
1031 /* 133 */ "joinop ::= COMMA|JOIN",
1032 /* 134 */ "joinop ::= JOIN_KW JOIN",
1033 /* 135 */ "joinop ::= JOIN_KW nm JOIN",
1034 /* 136 */ "joinop ::= JOIN_KW nm nm JOIN",
1035 /* 137 */ "on_opt ::= ON expr",
1036 /* 138 */ "on_opt ::=",
1037 /* 139 */ "using_opt ::= USING LP inscollist RP",
1038 /* 140 */ "using_opt ::=",
1039 /* 141 */ "orderby_opt ::=",
1040 /* 142 */ "orderby_opt ::= ORDER BY sortlist",
1041 /* 143 */ "sortlist ::= sortlist COMMA sortitem sortorder",
1042 /* 144 */ "sortlist ::= sortitem sortorder",
1043 /* 145 */ "sortitem ::= expr",
1044 /* 146 */ "sortorder ::= ASC",
1045 /* 147 */ "sortorder ::= DESC",
1046 /* 148 */ "sortorder ::=",
1047 /* 149 */ "groupby_opt ::=",
1048 /* 150 */ "groupby_opt ::= GROUP BY nexprlist",
1049 /* 151 */ "having_opt ::=",
1050 /* 152 */ "having_opt ::= HAVING expr",
1051 /* 153 */ "limit_opt ::=",
1052 /* 154 */ "limit_opt ::= LIMIT expr",
1053 /* 155 */ "limit_opt ::= LIMIT expr OFFSET expr",
1054 /* 156 */ "limit_opt ::= LIMIT expr COMMA expr",
1055 /* 157 */ "cmd ::= DELETE FROM fullname where_opt",
1056 /* 158 */ "where_opt ::=",
1057 /* 159 */ "where_opt ::= WHERE expr",
1058 /* 160 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
1059 /* 161 */ "setlist ::= setlist COMMA nm EQ expr",
1060 /* 162 */ "setlist ::= nm EQ expr",
1061 /* 163 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
1062 /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
1063 /* 165 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
1064 /* 166 */ "insert_cmd ::= INSERT orconf",
1065 /* 167 */ "insert_cmd ::= REPLACE",
1066 /* 168 */ "itemlist ::= itemlist COMMA expr",
1067 /* 169 */ "itemlist ::= expr",
1068 /* 170 */ "inscollist_opt ::=",
1069 /* 171 */ "inscollist_opt ::= LP inscollist RP",
1070 /* 172 */ "inscollist ::= inscollist COMMA nm",
1071 /* 173 */ "inscollist ::= nm",
1072 /* 174 */ "expr ::= term",
1073 /* 175 */ "expr ::= LP expr RP",
1074 /* 176 */ "term ::= NULL",
1075 /* 177 */ "expr ::= ID",
1076 /* 178 */ "expr ::= JOIN_KW",
1077 /* 179 */ "expr ::= nm DOT nm",
1078 /* 180 */ "expr ::= nm DOT nm DOT nm",
1079 /* 181 */ "term ::= INTEGER|FLOAT|BLOB",
1080 /* 182 */ "term ::= STRING",
1081 /* 183 */ "expr ::= REGISTER",
1082 /* 184 */ "expr ::= VARIABLE",
1083 /* 185 */ "expr ::= expr COLLATE ids",
1084 /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
1085 /* 187 */ "expr ::= ID LP distinct exprlist RP",
1086 /* 188 */ "expr ::= ID LP STAR RP",
1087 /* 189 */ "term ::= CTIME_KW",
1088 /* 190 */ "expr ::= expr AND expr",
1089 /* 191 */ "expr ::= expr OR expr",
1090 /* 192 */ "expr ::= expr LT|GT|GE|LE expr",
1091 /* 193 */ "expr ::= expr EQ|NE expr",
1092 /* 194 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
1093 /* 195 */ "expr ::= expr PLUS|MINUS expr",
1094 /* 196 */ "expr ::= expr STAR|SLASH|REM expr",
1095 /* 197 */ "expr ::= expr CONCAT expr",
1096 /* 198 */ "likeop ::= LIKE_KW",
1097 /* 199 */ "likeop ::= NOT LIKE_KW",
1098 /* 200 */ "likeop ::= MATCH",
1099 /* 201 */ "likeop ::= NOT MATCH",
1100 /* 202 */ "escape ::= ESCAPE expr",
1101 /* 203 */ "escape ::=",
1102 /* 204 */ "expr ::= expr likeop expr escape",
1103 /* 205 */ "expr ::= expr ISNULL|NOTNULL",
1104 /* 206 */ "expr ::= expr IS NULL",
1105 /* 207 */ "expr ::= expr NOT NULL",
1106 /* 208 */ "expr ::= expr IS NOT NULL",
1107 /* 209 */ "expr ::= NOT expr",
1108 /* 210 */ "expr ::= BITNOT expr",
1109 /* 211 */ "expr ::= MINUS expr",
1110 /* 212 */ "expr ::= PLUS expr",
1111 /* 213 */ "between_op ::= BETWEEN",
1112 /* 214 */ "between_op ::= NOT BETWEEN",
1113 /* 215 */ "expr ::= expr between_op expr AND expr",
1114 /* 216 */ "in_op ::= IN",
1115 /* 217 */ "in_op ::= NOT IN",
1116 /* 218 */ "expr ::= expr in_op LP exprlist RP",
1117 /* 219 */ "expr ::= LP select RP",
1118 /* 220 */ "expr ::= expr in_op LP select RP",
1119 /* 221 */ "expr ::= expr in_op nm dbnm",
1120 /* 222 */ "expr ::= EXISTS LP select RP",
1121 /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END",
1122 /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
1123 /* 225 */ "case_exprlist ::= WHEN expr THEN expr",
1124 /* 226 */ "case_else ::= ELSE expr",
1125 /* 227 */ "case_else ::=",
1126 /* 228 */ "case_operand ::= expr",
1127 /* 229 */ "case_operand ::=",
1128 /* 230 */ "exprlist ::= nexprlist",
1129 /* 231 */ "exprlist ::=",
1130 /* 232 */ "nexprlist ::= nexprlist COMMA expr",
1131 /* 233 */ "nexprlist ::= expr",
1132 /* 234 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
1133 /* 235 */ "uniqueflag ::= UNIQUE",
1134 /* 236 */ "uniqueflag ::=",
1135 /* 237 */ "idxlist_opt ::=",
1136 /* 238 */ "idxlist_opt ::= LP idxlist RP",
1137 /* 239 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
1138 /* 240 */ "idxlist ::= idxitem collate sortorder",
1139 /* 241 */ "idxitem ::= nm",
1140 /* 242 */ "collate ::=",
1141 /* 243 */ "collate ::= COLLATE ids",
1142 /* 244 */ "cmd ::= DROP INDEX ifexists fullname",
1143 /* 245 */ "cmd ::= VACUUM",
1144 /* 246 */ "cmd ::= VACUUM nm",
1145 /* 247 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
1146 /* 248 */ "cmd ::= PRAGMA nm dbnm EQ ON",
1147 /* 249 */ "cmd ::= PRAGMA nm dbnm EQ DELETE",
1148 /* 250 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
1149 /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
1150 /* 252 */ "cmd ::= PRAGMA nm dbnm",
1151 /* 253 */ "nmnum ::= plus_num",
1152 /* 254 */ "nmnum ::= nm",
1153 /* 255 */ "plus_num ::= plus_opt number",
1154 /* 256 */ "minus_num ::= MINUS number",
1155 /* 257 */ "number ::= INTEGER|FLOAT",
1156 /* 258 */ "plus_opt ::= PLUS",
1157 /* 259 */ "plus_opt ::=",
1158 /* 260 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
1159 /* 261 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
1160 /* 262 */ "trigger_time ::= BEFORE",
1161 /* 263 */ "trigger_time ::= AFTER",
1162 /* 264 */ "trigger_time ::= INSTEAD OF",
1163 /* 265 */ "trigger_time ::=",
1164 /* 266 */ "trigger_event ::= DELETE|INSERT",
1165 /* 267 */ "trigger_event ::= UPDATE",
1166 /* 268 */ "trigger_event ::= UPDATE OF inscollist",
1167 /* 269 */ "foreach_clause ::=",
1168 /* 270 */ "foreach_clause ::= FOR EACH ROW",
1169 /* 271 */ "when_clause ::=",
1170 /* 272 */ "when_clause ::= WHEN expr",
1171 /* 273 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
1172 /* 274 */ "trigger_cmd_list ::=",
1173 /* 275 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
1174 /* 276 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
1175 /* 277 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
1176 /* 278 */ "trigger_cmd ::= DELETE FROM nm where_opt",
1177 /* 279 */ "trigger_cmd ::= select",
1178 /* 280 */ "expr ::= RAISE LP IGNORE RP",
1179 /* 281 */ "expr ::= RAISE LP raisetype COMMA nm RP",
1180 /* 282 */ "raisetype ::= ROLLBACK",
1181 /* 283 */ "raisetype ::= ABORT",
1182 /* 284 */ "raisetype ::= FAIL",
1183 /* 285 */ "cmd ::= DROP TRIGGER ifexists fullname",
1184 /* 286 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
1185 /* 287 */ "cmd ::= DETACH database_kw_opt expr",
1186 /* 288 */ "key_opt ::=",
1187 /* 289 */ "key_opt ::= KEY expr",
1188 /* 290 */ "database_kw_opt ::= DATABASE",
1189 /* 291 */ "database_kw_opt ::=",
1190 /* 292 */ "cmd ::= REINDEX",
1191 /* 293 */ "cmd ::= REINDEX nm dbnm",
1192 /* 294 */ "cmd ::= ANALYZE",
1193 /* 295 */ "cmd ::= ANALYZE nm dbnm",
1194 /* 296 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
1195 /* 297 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
1196 /* 298 */ "add_column_fullname ::= fullname",
1197 /* 299 */ "kwcolumn_opt ::=",
1198 /* 300 */ "kwcolumn_opt ::= COLUMNKW",
1199 /* 301 */ "cmd ::= create_vtab",
1200 /* 302 */ "cmd ::= create_vtab LP vtabarglist RP",
1201 /* 303 */ "create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm",
1202 /* 304 */ "vtabarglist ::= vtabarg",
1203 /* 305 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
1204 /* 306 */ "vtabarg ::=",
1205 /* 307 */ "vtabarg ::= vtabarg vtabargtoken",
1206 /* 308 */ "vtabargtoken ::= ANY",
1207 /* 309 */ "vtabargtoken ::= lp anylist RP",
1208 /* 310 */ "lp ::= LP",
1209 /* 311 */ "anylist ::=",
1210 /* 312 */ "anylist ::= anylist ANY",
1211 };
1212 #endif /* NDEBUG */
1213
1214
1215 #if YYSTACKDEPTH<=0
1216 /*
1217 ** Try to increase the size of the parser stack.
1218 */
yyGrowStack(yyParser * p)1219 static void yyGrowStack(yyParser *p){
1220 int newSize;
1221 yyStackEntry *pNew;
1222
1223 newSize = p->yystksz*2 + 100;
1224 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
1225 if( pNew ){
1226 p->yystack = pNew;
1227 p->yystksz = newSize;
1228 #ifndef NDEBUG
1229 if( yyTraceFILE ){
1230 fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
1231 yyTracePrompt, p->yystksz);
1232 }
1233 #endif
1234 }
1235 }
1236 #endif
1237
1238 /*
1239 ** This function allocates a new parser.
1240 ** The only argument is a pointer to a function which works like
1241 ** malloc.
1242 **
1243 ** Inputs:
1244 ** A pointer to the function used to allocate memory.
1245 **
1246 ** Outputs:
1247 ** A pointer to a parser. This pointer is used in subsequent calls
1248 ** to sqlite3Parser and sqlite3ParserFree.
1249 */
sqlite3ParserAlloc(void * (* mallocProc)(size_t))1250 void *sqlite3ParserAlloc(void *(*mallocProc)(size_t)){
1251 yyParser *pParser;
1252 pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
1253 if( pParser ){
1254 pParser->yyidx = -1;
1255 #if YYSTACKDEPTH<=0
1256 yyGrowStack(pParser);
1257 #endif
1258 }
1259 return pParser;
1260 }
1261
1262 /* The following function deletes the value associated with a
1263 ** symbol. The symbol can be either a terminal or nonterminal.
1264 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
1265 ** the value.
1266 */
yy_destructor(YYCODETYPE yymajor,YYMINORTYPE * yypminor)1267 static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
1268 switch( yymajor ){
1269 /* Here is inserted the actions which take place when a
1270 ** terminal or non-terminal is destroyed. This can happen
1271 ** when the symbol is popped from the stack during a
1272 ** reduce or during error processing or when a parser is
1273 ** being destroyed before it is finished parsing.
1274 **
1275 ** Note: during a reduce, the only symbols destroyed are those
1276 ** which appear on the RHS of the rule, but which are not used
1277 ** inside the C code.
1278 */
1279 case 155: /* select */
1280 {
1281 sqlite3SelectDelete((yypminor->yy219));
1282 }
1283 break;
1284 case 169: /* term */
1285 {
1286 sqlite3ExprDelete((yypminor->yy172));
1287 }
1288 break;
1289 case 170: /* expr */
1290 {
1291 sqlite3ExprDelete((yypminor->yy172));
1292 }
1293 break;
1294 case 174: /* idxlist_opt */
1295 {
1296 sqlite3ExprListDelete((yypminor->yy174));
1297 }
1298 break;
1299 case 182: /* idxlist */
1300 {
1301 sqlite3ExprListDelete((yypminor->yy174));
1302 }
1303 break;
1304 case 188: /* fullname */
1305 {
1306 sqlite3SrcListDelete((yypminor->yy373));
1307 }
1308 break;
1309 case 189: /* oneselect */
1310 {
1311 sqlite3SelectDelete((yypminor->yy219));
1312 }
1313 break;
1314 case 192: /* selcollist */
1315 {
1316 sqlite3ExprListDelete((yypminor->yy174));
1317 }
1318 break;
1319 case 193: /* from */
1320 {
1321 sqlite3SrcListDelete((yypminor->yy373));
1322 }
1323 break;
1324 case 194: /* where_opt */
1325 {
1326 sqlite3ExprDelete((yypminor->yy172));
1327 }
1328 break;
1329 case 195: /* groupby_opt */
1330 {
1331 sqlite3ExprListDelete((yypminor->yy174));
1332 }
1333 break;
1334 case 196: /* having_opt */
1335 {
1336 sqlite3ExprDelete((yypminor->yy172));
1337 }
1338 break;
1339 case 197: /* orderby_opt */
1340 {
1341 sqlite3ExprListDelete((yypminor->yy174));
1342 }
1343 break;
1344 case 199: /* sclp */
1345 {
1346 sqlite3ExprListDelete((yypminor->yy174));
1347 }
1348 break;
1349 case 201: /* seltablist */
1350 {
1351 sqlite3SrcListDelete((yypminor->yy373));
1352 }
1353 break;
1354 case 202: /* stl_prefix */
1355 {
1356 sqlite3SrcListDelete((yypminor->yy373));
1357 }
1358 break;
1359 case 204: /* on_opt */
1360 {
1361 sqlite3ExprDelete((yypminor->yy172));
1362 }
1363 break;
1364 case 205: /* using_opt */
1365 {
1366 sqlite3IdListDelete((yypminor->yy432));
1367 }
1368 break;
1369 case 206: /* seltablist_paren */
1370 {
1371 sqlite3SelectDelete((yypminor->yy219));
1372 }
1373 break;
1374 case 208: /* inscollist */
1375 {
1376 sqlite3IdListDelete((yypminor->yy432));
1377 }
1378 break;
1379 case 209: /* sortlist */
1380 {
1381 sqlite3ExprListDelete((yypminor->yy174));
1382 }
1383 break;
1384 case 210: /* sortitem */
1385 {
1386 sqlite3ExprDelete((yypminor->yy172));
1387 }
1388 break;
1389 case 211: /* nexprlist */
1390 {
1391 sqlite3ExprListDelete((yypminor->yy174));
1392 }
1393 break;
1394 case 212: /* setlist */
1395 {
1396 sqlite3ExprListDelete((yypminor->yy174));
1397 }
1398 break;
1399 case 214: /* inscollist_opt */
1400 {
1401 sqlite3IdListDelete((yypminor->yy432));
1402 }
1403 break;
1404 case 215: /* itemlist */
1405 {
1406 sqlite3ExprListDelete((yypminor->yy174));
1407 }
1408 break;
1409 case 216: /* exprlist */
1410 {
1411 sqlite3ExprListDelete((yypminor->yy174));
1412 }
1413 break;
1414 case 218: /* escape */
1415 {
1416 sqlite3ExprDelete((yypminor->yy172));
1417 }
1418 break;
1419 case 221: /* case_operand */
1420 {
1421 sqlite3ExprDelete((yypminor->yy172));
1422 }
1423 break;
1424 case 222: /* case_exprlist */
1425 {
1426 sqlite3ExprListDelete((yypminor->yy174));
1427 }
1428 break;
1429 case 223: /* case_else */
1430 {
1431 sqlite3ExprDelete((yypminor->yy172));
1432 }
1433 break;
1434 case 231: /* trigger_cmd_list */
1435 {
1436 sqlite3DeleteTriggerStep((yypminor->yy243));
1437 }
1438 break;
1439 case 233: /* trigger_event */
1440 {
1441 sqlite3IdListDelete((yypminor->yy370).b);
1442 }
1443 break;
1444 case 235: /* when_clause */
1445 {
1446 sqlite3ExprDelete((yypminor->yy172));
1447 }
1448 break;
1449 case 236: /* trigger_cmd */
1450 {
1451 sqlite3DeleteTriggerStep((yypminor->yy243));
1452 }
1453 break;
1454 case 238: /* key_opt */
1455 {
1456 sqlite3ExprDelete((yypminor->yy172));
1457 }
1458 break;
1459 default: break; /* If no destructor action specified: do nothing */
1460 }
1461 }
1462
1463 /*
1464 ** Pop the parser's stack once.
1465 **
1466 ** If there is a destructor routine associated with the token which
1467 ** is popped from the stack, then call it.
1468 **
1469 ** Return the major token number for the symbol popped.
1470 */
yy_pop_parser_stack(yyParser * pParser)1471 static int yy_pop_parser_stack(yyParser *pParser){
1472 YYCODETYPE yymajor;
1473 yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
1474
1475 if( pParser->yyidx<0 ) return 0;
1476 #ifndef NDEBUG
1477 if( yyTraceFILE && pParser->yyidx>=0 ){
1478 fprintf(yyTraceFILE,"%sPopping %s\n",
1479 yyTracePrompt,
1480 yyTokenName[yytos->major]);
1481 }
1482 #endif
1483 yymajor = yytos->major;
1484 yy_destructor( yymajor, &yytos->minor);
1485 pParser->yyidx--;
1486 return yymajor;
1487 }
1488
1489 /*
1490 ** Deallocate and destroy a parser. Destructors are all called for
1491 ** all stack elements before shutting the parser down.
1492 **
1493 ** Inputs:
1494 ** <ul>
1495 ** <li> A pointer to the parser. This should be a pointer
1496 ** obtained from sqlite3ParserAlloc.
1497 ** <li> A pointer to a function used to reclaim memory obtained
1498 ** from malloc.
1499 ** </ul>
1500 */
sqlite3ParserFree(void * p,void (* freeProc)(void *))1501 void sqlite3ParserFree(
1502 void *p, /* The parser to be deleted */
1503 void (*freeProc)(void*) /* Function used to reclaim memory */
1504 ){
1505 yyParser *pParser = (yyParser*)p;
1506 if( pParser==0 ) return;
1507 while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
1508 #if YYSTACKDEPTH<=0
1509 free(pParser->yystack);
1510 #endif
1511 (*freeProc)((void*)pParser);
1512 }
1513
1514 /*
1515 ** Find the appropriate action for a parser given the terminal
1516 ** look-ahead token iLookAhead.
1517 **
1518 ** If the look-ahead token is YYNOCODE, then check to see if the action is
1519 ** independent of the look-ahead. If it is, return the action, otherwise
1520 ** return YY_NO_ACTION.
1521 */
yy_find_shift_action(yyParser * pParser,YYCODETYPE iLookAhead)1522 static int yy_find_shift_action(
1523 yyParser *pParser, /* The parser */
1524 YYCODETYPE iLookAhead /* The look-ahead token */
1525 ){
1526 int i;
1527 int stateno = pParser->yystack[pParser->yyidx].stateno;
1528
1529 if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
1530 return yy_default[stateno];
1531 }
1532 assert( iLookAhead!=YYNOCODE );
1533 i += iLookAhead;
1534 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
1535 if( iLookAhead>0 ){
1536 #ifdef YYFALLBACK
1537 int iFallback; /* Fallback token */
1538 if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
1539 && (iFallback = yyFallback[iLookAhead])!=0 ){
1540 #ifndef NDEBUG
1541 if( yyTraceFILE ){
1542 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
1543 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
1544 }
1545 #endif
1546 return yy_find_shift_action(pParser, iFallback);
1547 }
1548 #endif
1549 #ifdef YYWILDCARD
1550 {
1551 int j = i - iLookAhead + YYWILDCARD;
1552 if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
1553 #ifndef NDEBUG
1554 if( yyTraceFILE ){
1555 fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
1556 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
1557 }
1558 #endif /* NDEBUG */
1559 return yy_action[j];
1560 }
1561 }
1562 #endif /* YYWILDCARD */
1563 }
1564 return yy_default[stateno];
1565 }else{
1566 return yy_action[i];
1567 }
1568 }
1569
1570 /*
1571 ** Find the appropriate action for a parser given the non-terminal
1572 ** look-ahead token iLookAhead.
1573 **
1574 ** If the look-ahead token is YYNOCODE, then check to see if the action is
1575 ** independent of the look-ahead. If it is, return the action, otherwise
1576 ** return YY_NO_ACTION.
1577 */
yy_find_reduce_action(int stateno,YYCODETYPE iLookAhead)1578 static int yy_find_reduce_action(
1579 int stateno, /* Current state number */
1580 YYCODETYPE iLookAhead /* The look-ahead token */
1581 ){
1582 int i;
1583 #ifdef YYERRORSYMBOL
1584 if( stateno>YY_REDUCE_MAX ){
1585 return yy_default[stateno];
1586 }
1587 #else
1588 assert( stateno<=YY_REDUCE_MAX );
1589 #endif
1590 i = yy_reduce_ofst[stateno];
1591 assert( i!=YY_REDUCE_USE_DFLT );
1592 assert( iLookAhead!=YYNOCODE );
1593 i += iLookAhead;
1594 #ifdef YYERRORSYMBOL
1595 if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
1596 return yy_default[stateno];
1597 }
1598 #else
1599 assert( i>=0 && i<YY_SZ_ACTTAB );
1600 assert( yy_lookahead[i]==iLookAhead );
1601 #endif
1602 return yy_action[i];
1603 }
1604
1605 /*
1606 ** The following routine is called if the stack overflows.
1607 */
yyStackOverflow(yyParser * yypParser,YYMINORTYPE * yypMinor)1608 static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
1609 sqlite3ParserARG_FETCH;
1610 yypParser->yyidx--;
1611 yypMinor = yypMinor; /* quiet the compiler */
1612 #ifndef NDEBUG
1613 if( yyTraceFILE ){
1614 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
1615 }
1616 #endif
1617 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1618 /* Here code is inserted which will execute if the parser
1619 ** stack every overflows */
1620
1621 sqlite3ErrorMsg(pParse, "parser stack overflow");
1622 pParse->parseError = 1;
1623 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
1624 }
1625
1626 /*
1627 ** Perform a shift action.
1628 */
yy_shift(yyParser * yypParser,int yyNewState,int yyMajor,YYMINORTYPE * yypMinor)1629 static void yy_shift(
1630 yyParser *yypParser, /* The parser to be shifted */
1631 int yyNewState, /* The new state to shift in */
1632 int yyMajor, /* The major token to shift in */
1633 YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */
1634 ){
1635 yyStackEntry *yytos;
1636 yypParser->yyidx++;
1637 #if YYSTACKDEPTH>0
1638 if( yypParser->yyidx>=YYSTACKDEPTH ){
1639 yyStackOverflow(yypParser, yypMinor);
1640 return;
1641 }
1642 #else
1643 if( yypParser->yyidx>=yypParser->yystksz ){
1644 yyGrowStack(yypParser);
1645 if( yypParser->yyidx>=yypParser->yystksz ){
1646 yyStackOverflow(yypParser, yypMinor);
1647 return;
1648 }
1649 }
1650 #endif
1651 yytos = &yypParser->yystack[yypParser->yyidx];
1652 yytos->stateno = yyNewState;
1653 yytos->major = yyMajor;
1654 yytos->minor = *yypMinor;
1655 #ifndef NDEBUG
1656 if( yyTraceFILE && yypParser->yyidx>0 ){
1657 int i;
1658 fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
1659 fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
1660 for(i=1; i<=yypParser->yyidx; i++)
1661 fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
1662 fprintf(yyTraceFILE,"\n");
1663 }
1664 #endif
1665 }
1666
1667 /* The following table contains information about every rule that
1668 ** is used during the reduce.
1669 */
1670 static const struct {
1671 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
1672 unsigned char nrhs; /* Number of right-hand side symbols in the rule */
1673 } yyRuleInfo[] = {
1674 { 139, 1 },
1675 { 140, 2 },
1676 { 140, 1 },
1677 { 142, 1 },
1678 { 141, 1 },
1679 { 141, 3 },
1680 { 144, 0 },
1681 { 144, 1 },
1682 { 144, 3 },
1683 { 143, 3 },
1684 { 146, 0 },
1685 { 146, 1 },
1686 { 146, 2 },
1687 { 145, 0 },
1688 { 145, 1 },
1689 { 145, 1 },
1690 { 145, 1 },
1691 { 143, 2 },
1692 { 143, 2 },
1693 { 143, 2 },
1694 { 143, 2 },
1695 { 148, 6 },
1696 { 151, 0 },
1697 { 151, 3 },
1698 { 150, 1 },
1699 { 150, 0 },
1700 { 149, 4 },
1701 { 149, 2 },
1702 { 153, 3 },
1703 { 153, 1 },
1704 { 156, 3 },
1705 { 157, 1 },
1706 { 160, 1 },
1707 { 161, 1 },
1708 { 147, 1 },
1709 { 147, 1 },
1710 { 147, 1 },
1711 { 158, 0 },
1712 { 158, 1 },
1713 { 162, 1 },
1714 { 162, 4 },
1715 { 162, 6 },
1716 { 163, 1 },
1717 { 163, 2 },
1718 { 164, 1 },
1719 { 164, 1 },
1720 { 159, 2 },
1721 { 159, 0 },
1722 { 167, 3 },
1723 { 167, 1 },
1724 { 168, 2 },
1725 { 168, 4 },
1726 { 168, 3 },
1727 { 168, 3 },
1728 { 168, 2 },
1729 { 168, 2 },
1730 { 168, 3 },
1731 { 168, 5 },
1732 { 168, 2 },
1733 { 168, 4 },
1734 { 168, 4 },
1735 { 168, 1 },
1736 { 168, 2 },
1737 { 173, 0 },
1738 { 173, 1 },
1739 { 175, 0 },
1740 { 175, 2 },
1741 { 177, 2 },
1742 { 177, 3 },
1743 { 177, 3 },
1744 { 177, 3 },
1745 { 178, 2 },
1746 { 178, 2 },
1747 { 178, 1 },
1748 { 178, 1 },
1749 { 176, 3 },
1750 { 176, 2 },
1751 { 179, 0 },
1752 { 179, 2 },
1753 { 179, 2 },
1754 { 154, 0 },
1755 { 154, 2 },
1756 { 180, 3 },
1757 { 180, 2 },
1758 { 180, 1 },
1759 { 181, 2 },
1760 { 181, 7 },
1761 { 181, 5 },
1762 { 181, 5 },
1763 { 181, 10 },
1764 { 183, 0 },
1765 { 183, 1 },
1766 { 171, 0 },
1767 { 171, 3 },
1768 { 184, 0 },
1769 { 184, 2 },
1770 { 185, 1 },
1771 { 185, 1 },
1772 { 185, 1 },
1773 { 143, 4 },
1774 { 187, 2 },
1775 { 187, 0 },
1776 { 143, 8 },
1777 { 143, 4 },
1778 { 143, 1 },
1779 { 155, 1 },
1780 { 155, 3 },
1781 { 190, 1 },
1782 { 190, 2 },
1783 { 190, 1 },
1784 { 189, 9 },
1785 { 191, 1 },
1786 { 191, 1 },
1787 { 191, 0 },
1788 { 199, 2 },
1789 { 199, 0 },
1790 { 192, 3 },
1791 { 192, 2 },
1792 { 192, 4 },
1793 { 200, 2 },
1794 { 200, 1 },
1795 { 200, 0 },
1796 { 193, 0 },
1797 { 193, 2 },
1798 { 202, 2 },
1799 { 202, 0 },
1800 { 201, 6 },
1801 { 201, 7 },
1802 { 206, 1 },
1803 { 206, 1 },
1804 { 152, 0 },
1805 { 152, 2 },
1806 { 188, 2 },
1807 { 203, 1 },
1808 { 203, 2 },
1809 { 203, 3 },
1810 { 203, 4 },
1811 { 204, 2 },
1812 { 204, 0 },
1813 { 205, 4 },
1814 { 205, 0 },
1815 { 197, 0 },
1816 { 197, 3 },
1817 { 209, 4 },
1818 { 209, 2 },
1819 { 210, 1 },
1820 { 172, 1 },
1821 { 172, 1 },
1822 { 172, 0 },
1823 { 195, 0 },
1824 { 195, 3 },
1825 { 196, 0 },
1826 { 196, 2 },
1827 { 198, 0 },
1828 { 198, 2 },
1829 { 198, 4 },
1830 { 198, 4 },
1831 { 143, 4 },
1832 { 194, 0 },
1833 { 194, 2 },
1834 { 143, 6 },
1835 { 212, 5 },
1836 { 212, 3 },
1837 { 143, 8 },
1838 { 143, 5 },
1839 { 143, 6 },
1840 { 213, 2 },
1841 { 213, 1 },
1842 { 215, 3 },
1843 { 215, 1 },
1844 { 214, 0 },
1845 { 214, 3 },
1846 { 208, 3 },
1847 { 208, 1 },
1848 { 170, 1 },
1849 { 170, 3 },
1850 { 169, 1 },
1851 { 170, 1 },
1852 { 170, 1 },
1853 { 170, 3 },
1854 { 170, 5 },
1855 { 169, 1 },
1856 { 169, 1 },
1857 { 170, 1 },
1858 { 170, 1 },
1859 { 170, 3 },
1860 { 170, 6 },
1861 { 170, 5 },
1862 { 170, 4 },
1863 { 169, 1 },
1864 { 170, 3 },
1865 { 170, 3 },
1866 { 170, 3 },
1867 { 170, 3 },
1868 { 170, 3 },
1869 { 170, 3 },
1870 { 170, 3 },
1871 { 170, 3 },
1872 { 217, 1 },
1873 { 217, 2 },
1874 { 217, 1 },
1875 { 217, 2 },
1876 { 218, 2 },
1877 { 218, 0 },
1878 { 170, 4 },
1879 { 170, 2 },
1880 { 170, 3 },
1881 { 170, 3 },
1882 { 170, 4 },
1883 { 170, 2 },
1884 { 170, 2 },
1885 { 170, 2 },
1886 { 170, 2 },
1887 { 219, 1 },
1888 { 219, 2 },
1889 { 170, 5 },
1890 { 220, 1 },
1891 { 220, 2 },
1892 { 170, 5 },
1893 { 170, 3 },
1894 { 170, 5 },
1895 { 170, 4 },
1896 { 170, 4 },
1897 { 170, 5 },
1898 { 222, 5 },
1899 { 222, 4 },
1900 { 223, 2 },
1901 { 223, 0 },
1902 { 221, 1 },
1903 { 221, 0 },
1904 { 216, 1 },
1905 { 216, 0 },
1906 { 211, 3 },
1907 { 211, 1 },
1908 { 143, 11 },
1909 { 224, 1 },
1910 { 224, 0 },
1911 { 174, 0 },
1912 { 174, 3 },
1913 { 182, 5 },
1914 { 182, 3 },
1915 { 225, 1 },
1916 { 226, 0 },
1917 { 226, 2 },
1918 { 143, 4 },
1919 { 143, 1 },
1920 { 143, 2 },
1921 { 143, 5 },
1922 { 143, 5 },
1923 { 143, 5 },
1924 { 143, 5 },
1925 { 143, 6 },
1926 { 143, 3 },
1927 { 227, 1 },
1928 { 227, 1 },
1929 { 165, 2 },
1930 { 166, 2 },
1931 { 229, 1 },
1932 { 228, 1 },
1933 { 228, 0 },
1934 { 143, 5 },
1935 { 230, 11 },
1936 { 232, 1 },
1937 { 232, 1 },
1938 { 232, 2 },
1939 { 232, 0 },
1940 { 233, 1 },
1941 { 233, 1 },
1942 { 233, 3 },
1943 { 234, 0 },
1944 { 234, 3 },
1945 { 235, 0 },
1946 { 235, 2 },
1947 { 231, 3 },
1948 { 231, 0 },
1949 { 236, 6 },
1950 { 236, 8 },
1951 { 236, 5 },
1952 { 236, 4 },
1953 { 236, 1 },
1954 { 170, 4 },
1955 { 170, 6 },
1956 { 186, 1 },
1957 { 186, 1 },
1958 { 186, 1 },
1959 { 143, 4 },
1960 { 143, 6 },
1961 { 143, 3 },
1962 { 238, 0 },
1963 { 238, 2 },
1964 { 237, 1 },
1965 { 237, 0 },
1966 { 143, 1 },
1967 { 143, 3 },
1968 { 143, 1 },
1969 { 143, 3 },
1970 { 143, 6 },
1971 { 143, 6 },
1972 { 239, 1 },
1973 { 240, 0 },
1974 { 240, 1 },
1975 { 143, 1 },
1976 { 143, 4 },
1977 { 241, 7 },
1978 { 242, 1 },
1979 { 242, 3 },
1980 { 243, 0 },
1981 { 243, 2 },
1982 { 244, 1 },
1983 { 244, 3 },
1984 { 245, 1 },
1985 { 246, 0 },
1986 { 246, 2 },
1987 };
1988
1989 static void yy_accept(yyParser*); /* Forward Declaration */
1990
1991 /*
1992 ** Perform a reduce action and the shift that must immediately
1993 ** follow the reduce.
1994 */
yy_reduce(yyParser * yypParser,int yyruleno)1995 static void yy_reduce(
1996 yyParser *yypParser, /* The parser */
1997 int yyruleno /* Number of the rule by which to reduce */
1998 ){
1999 int yygoto; /* The next state */
2000 int yyact; /* The next action */
2001 YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
2002 yyStackEntry *yymsp; /* The top of the parser's stack */
2003 int yysize; /* Amount to pop the stack */
2004 sqlite3ParserARG_FETCH;
2005 yymsp = &yypParser->yystack[yypParser->yyidx];
2006 #ifndef NDEBUG
2007 if( yyTraceFILE && yyruleno>=0
2008 && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
2009 fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
2010 yyRuleName[yyruleno]);
2011 }
2012 #endif /* NDEBUG */
2013
2014 /* Silence complaints from purify about yygotominor being uninitialized
2015 ** in some cases when it is copied into the stack after the following
2016 ** switch. yygotominor is uninitialized when a rule reduces that does
2017 ** not set the value of its left-hand side nonterminal. Leaving the
2018 ** value of the nonterminal uninitialized is utterly harmless as long
2019 ** as the value is never used. So really the only thing this code
2020 ** accomplishes is to quieten purify.
2021 **
2022 ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
2023 ** without this code, their parser segfaults. I'm not sure what there
2024 ** parser is doing to make this happen. This is the second bug report
2025 ** from wireshark this week. Clearly they are stressing Lemon in ways
2026 ** that it has not been previously stressed... (SQLite ticket #2172)
2027 */
2028 /*memset(&yygotominor, 0, sizeof(yygotominor));*/
2029 yygotominor = yyzerominor;
2030
2031
2032 switch( yyruleno ){
2033 /* Beginning here are the reduction cases. A typical example
2034 ** follows:
2035 ** case 0:
2036 ** { ... } // User supplied code
2037 ** break;
2038 */
2039 case 0: /* input ::= cmdlist */
2040 case 1: /* cmdlist ::= cmdlist ecmd */
2041 case 2: /* cmdlist ::= ecmd */
2042 case 4: /* ecmd ::= SEMI */
2043 case 5: /* ecmd ::= explain cmdx SEMI */
2044 case 10: /* trans_opt ::= */
2045 case 11: /* trans_opt ::= TRANSACTION */
2046 case 12: /* trans_opt ::= TRANSACTION nm */
2047 case 20: /* cmd ::= create_table create_table_args */
2048 case 28: /* columnlist ::= columnlist COMMA column */
2049 case 29: /* columnlist ::= column */
2050 case 37: /* type ::= */
2051 case 44: /* signed ::= plus_num */
2052 case 45: /* signed ::= minus_num */
2053 case 46: /* carglist ::= carglist carg */
2054 case 47: /* carglist ::= */
2055 case 48: /* carg ::= CONSTRAINT nm ccons */
2056 case 49: /* carg ::= ccons */
2057 case 55: /* ccons ::= NULL onconf */
2058 case 82: /* conslist ::= conslist COMMA tcons */
2059 case 83: /* conslist ::= conslist tcons */
2060 case 84: /* conslist ::= tcons */
2061 case 85: /* tcons ::= CONSTRAINT nm */
2062 case 258: /* plus_opt ::= PLUS */
2063 case 259: /* plus_opt ::= */
2064 case 269: /* foreach_clause ::= */
2065 case 270: /* foreach_clause ::= FOR EACH ROW */
2066 case 290: /* database_kw_opt ::= DATABASE */
2067 case 291: /* database_kw_opt ::= */
2068 case 299: /* kwcolumn_opt ::= */
2069 case 300: /* kwcolumn_opt ::= COLUMNKW */
2070 case 304: /* vtabarglist ::= vtabarg */
2071 case 305: /* vtabarglist ::= vtabarglist COMMA vtabarg */
2072 case 307: /* vtabarg ::= vtabarg vtabargtoken */
2073 case 311: /* anylist ::= */
2074 {
2075 }
2076 break;
2077 case 3: /* cmdx ::= cmd */
2078 { sqlite3FinishCoding(pParse); }
2079 break;
2080 case 6: /* explain ::= */
2081 { sqlite3BeginParse(pParse, 0); }
2082 break;
2083 case 7: /* explain ::= EXPLAIN */
2084 { sqlite3BeginParse(pParse, 1); }
2085 break;
2086 case 8: /* explain ::= EXPLAIN QUERY PLAN */
2087 { sqlite3BeginParse(pParse, 2); }
2088 break;
2089 case 9: /* cmd ::= BEGIN transtype trans_opt */
2090 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy46);}
2091 break;
2092 case 13: /* transtype ::= */
2093 {yygotominor.yy46 = TK_DEFERRED;}
2094 break;
2095 case 14: /* transtype ::= DEFERRED */
2096 case 15: /* transtype ::= IMMEDIATE */
2097 case 16: /* transtype ::= EXCLUSIVE */
2098 case 107: /* multiselect_op ::= UNION */
2099 case 109: /* multiselect_op ::= EXCEPT|INTERSECT */
2100 {yygotominor.yy46 = yymsp[0].major;}
2101 break;
2102 case 17: /* cmd ::= COMMIT trans_opt */
2103 case 18: /* cmd ::= END trans_opt */
2104 {sqlite3CommitTransaction(pParse);}
2105 break;
2106 case 19: /* cmd ::= ROLLBACK trans_opt */
2107 {sqlite3RollbackTransaction(pParse);}
2108 break;
2109 case 21: /* create_table ::= CREATE temp TABLE ifnotexists nm dbnm */
2110 {
2111 sqlite3StartTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,yymsp[-4].minor.yy46,0,0,yymsp[-2].minor.yy46);
2112 }
2113 break;
2114 case 22: /* ifnotexists ::= */
2115 case 25: /* temp ::= */
2116 case 63: /* autoinc ::= */
2117 case 77: /* init_deferred_pred_opt ::= */
2118 case 79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
2119 case 90: /* defer_subclause_opt ::= */
2120 case 101: /* ifexists ::= */
2121 case 112: /* distinct ::= ALL */
2122 case 113: /* distinct ::= */
2123 case 213: /* between_op ::= BETWEEN */
2124 case 216: /* in_op ::= IN */
2125 {yygotominor.yy46 = 0;}
2126 break;
2127 case 23: /* ifnotexists ::= IF NOT EXISTS */
2128 case 24: /* temp ::= TEMP */
2129 case 64: /* autoinc ::= AUTOINCR */
2130 case 78: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
2131 case 100: /* ifexists ::= IF EXISTS */
2132 case 111: /* distinct ::= DISTINCT */
2133 case 214: /* between_op ::= NOT BETWEEN */
2134 case 217: /* in_op ::= NOT IN */
2135 {yygotominor.yy46 = 1;}
2136 break;
2137 case 26: /* create_table_args ::= LP columnlist conslist_opt RP */
2138 {
2139 sqlite3EndTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy0,0);
2140 }
2141 break;
2142 case 27: /* create_table_args ::= AS select */
2143 {
2144 sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy219);
2145 sqlite3SelectDelete(yymsp[0].minor.yy219);
2146 }
2147 break;
2148 case 30: /* column ::= columnid type carglist */
2149 {
2150 yygotominor.yy410.z = yymsp[-2].minor.yy410.z;
2151 yygotominor.yy410.n = (pParse->sLastToken.z-yymsp[-2].minor.yy410.z) + pParse->sLastToken.n;
2152 }
2153 break;
2154 case 31: /* columnid ::= nm */
2155 {
2156 sqlite3AddColumn(pParse,&yymsp[0].minor.yy410);
2157 yygotominor.yy410 = yymsp[0].minor.yy410;
2158 }
2159 break;
2160 case 32: /* id ::= ID */
2161 case 33: /* ids ::= ID|STRING */
2162 case 34: /* nm ::= ID */
2163 case 35: /* nm ::= STRING */
2164 case 36: /* nm ::= JOIN_KW */
2165 case 257: /* number ::= INTEGER|FLOAT */
2166 {yygotominor.yy410 = yymsp[0].minor.yy0;}
2167 break;
2168 case 38: /* type ::= typetoken */
2169 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy410);}
2170 break;
2171 case 39: /* typetoken ::= typename */
2172 case 42: /* typename ::= ids */
2173 case 119: /* as ::= AS nm */
2174 case 120: /* as ::= ids */
2175 case 131: /* dbnm ::= DOT nm */
2176 case 241: /* idxitem ::= nm */
2177 case 243: /* collate ::= COLLATE ids */
2178 case 253: /* nmnum ::= plus_num */
2179 case 254: /* nmnum ::= nm */
2180 case 255: /* plus_num ::= plus_opt number */
2181 case 256: /* minus_num ::= MINUS number */
2182 {yygotominor.yy410 = yymsp[0].minor.yy410;}
2183 break;
2184 case 40: /* typetoken ::= typename LP signed RP */
2185 {
2186 yygotominor.yy410.z = yymsp[-3].minor.yy410.z;
2187 yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy410.z;
2188 }
2189 break;
2190 case 41: /* typetoken ::= typename LP signed COMMA signed RP */
2191 {
2192 yygotominor.yy410.z = yymsp[-5].minor.yy410.z;
2193 yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy410.z;
2194 }
2195 break;
2196 case 43: /* typename ::= typename ids */
2197 {yygotominor.yy410.z=yymsp[-1].minor.yy410.z; yygotominor.yy410.n=yymsp[0].minor.yy410.n+(yymsp[0].minor.yy410.z-yymsp[-1].minor.yy410.z);}
2198 break;
2199 case 50: /* ccons ::= DEFAULT term */
2200 case 52: /* ccons ::= DEFAULT PLUS term */
2201 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy172);}
2202 break;
2203 case 51: /* ccons ::= DEFAULT LP expr RP */
2204 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy172);}
2205 break;
2206 case 53: /* ccons ::= DEFAULT MINUS term */
2207 {
2208 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
2209 sqlite3AddDefaultValue(pParse,p);
2210 }
2211 break;
2212 case 54: /* ccons ::= DEFAULT id */
2213 {
2214 Expr *p = sqlite3PExpr(pParse, TK_STRING, 0, 0, &yymsp[0].minor.yy410);
2215 sqlite3AddDefaultValue(pParse,p);
2216 }
2217 break;
2218 case 56: /* ccons ::= NOT NULL onconf */
2219 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy46);}
2220 break;
2221 case 57: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
2222 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);}
2223 break;
2224 case 58: /* ccons ::= UNIQUE onconf */
2225 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy46,0,0,0,0);}
2226 break;
2227 case 59: /* ccons ::= CHECK LP expr RP */
2228 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy172);}
2229 break;
2230 case 60: /* ccons ::= REFERENCES nm idxlist_opt refargs */
2231 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy410,yymsp[-1].minor.yy174,yymsp[0].minor.yy46);}
2232 break;
2233 case 61: /* ccons ::= defer_subclause */
2234 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy46);}
2235 break;
2236 case 62: /* ccons ::= COLLATE ids */
2237 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy410);}
2238 break;
2239 case 65: /* refargs ::= */
2240 { yygotominor.yy46 = OE_Restrict * 0x010101; }
2241 break;
2242 case 66: /* refargs ::= refargs refarg */
2243 { yygotominor.yy46 = (yymsp[-1].minor.yy46 & yymsp[0].minor.yy405.mask) | yymsp[0].minor.yy405.value; }
2244 break;
2245 case 67: /* refarg ::= MATCH nm */
2246 { yygotominor.yy405.value = 0; yygotominor.yy405.mask = 0x000000; }
2247 break;
2248 case 68: /* refarg ::= ON DELETE refact */
2249 { yygotominor.yy405.value = yymsp[0].minor.yy46; yygotominor.yy405.mask = 0x0000ff; }
2250 break;
2251 case 69: /* refarg ::= ON UPDATE refact */
2252 { yygotominor.yy405.value = yymsp[0].minor.yy46<<8; yygotominor.yy405.mask = 0x00ff00; }
2253 break;
2254 case 70: /* refarg ::= ON INSERT refact */
2255 { yygotominor.yy405.value = yymsp[0].minor.yy46<<16; yygotominor.yy405.mask = 0xff0000; }
2256 break;
2257 case 71: /* refact ::= SET NULL */
2258 { yygotominor.yy46 = OE_SetNull; }
2259 break;
2260 case 72: /* refact ::= SET DEFAULT */
2261 { yygotominor.yy46 = OE_SetDflt; }
2262 break;
2263 case 73: /* refact ::= CASCADE */
2264 { yygotominor.yy46 = OE_Cascade; }
2265 break;
2266 case 74: /* refact ::= RESTRICT */
2267 { yygotominor.yy46 = OE_Restrict; }
2268 break;
2269 case 75: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
2270 case 76: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
2271 case 91: /* defer_subclause_opt ::= defer_subclause */
2272 case 93: /* onconf ::= ON CONFLICT resolvetype */
2273 case 95: /* orconf ::= OR resolvetype */
2274 case 96: /* resolvetype ::= raisetype */
2275 case 166: /* insert_cmd ::= INSERT orconf */
2276 {yygotominor.yy46 = yymsp[0].minor.yy46;}
2277 break;
2278 case 80: /* conslist_opt ::= */
2279 {yygotominor.yy410.n = 0; yygotominor.yy410.z = 0;}
2280 break;
2281 case 81: /* conslist_opt ::= COMMA conslist */
2282 {yygotominor.yy410 = yymsp[-1].minor.yy0;}
2283 break;
2284 case 86: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
2285 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy174,yymsp[0].minor.yy46,yymsp[-2].minor.yy46,0);}
2286 break;
2287 case 87: /* tcons ::= UNIQUE LP idxlist RP onconf */
2288 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy174,yymsp[0].minor.yy46,0,0,0,0);}
2289 break;
2290 case 88: /* tcons ::= CHECK LP expr RP onconf */
2291 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy172);}
2292 break;
2293 case 89: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
2294 {
2295 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy174, &yymsp[-3].minor.yy410, yymsp[-2].minor.yy174, yymsp[-1].minor.yy46);
2296 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy46);
2297 }
2298 break;
2299 case 92: /* onconf ::= */
2300 case 94: /* orconf ::= */
2301 {yygotominor.yy46 = OE_Default;}
2302 break;
2303 case 97: /* resolvetype ::= IGNORE */
2304 {yygotominor.yy46 = OE_Ignore;}
2305 break;
2306 case 98: /* resolvetype ::= REPLACE */
2307 case 167: /* insert_cmd ::= REPLACE */
2308 {yygotominor.yy46 = OE_Replace;}
2309 break;
2310 case 99: /* cmd ::= DROP TABLE ifexists fullname */
2311 {
2312 sqlite3DropTable(pParse, yymsp[0].minor.yy373, 0, yymsp[-1].minor.yy46);
2313 }
2314 break;
2315 case 102: /* cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select */
2316 {
2317 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, yymsp[0].minor.yy219, yymsp[-6].minor.yy46, yymsp[-4].minor.yy46);
2318 }
2319 break;
2320 case 103: /* cmd ::= DROP VIEW ifexists fullname */
2321 {
2322 sqlite3DropTable(pParse, yymsp[0].minor.yy373, 1, yymsp[-1].minor.yy46);
2323 }
2324 break;
2325 case 104: /* cmd ::= select */
2326 {
2327 SelectDest dest = {SRT_Callback, 0, 0, 0, 0};
2328 sqlite3Select(pParse, yymsp[0].minor.yy219, &dest, 0, 0, 0, 0);
2329 sqlite3SelectDelete(yymsp[0].minor.yy219);
2330 }
2331 break;
2332 case 105: /* select ::= oneselect */
2333 case 128: /* seltablist_paren ::= select */
2334 {yygotominor.yy219 = yymsp[0].minor.yy219;}
2335 break;
2336 case 106: /* select ::= select multiselect_op oneselect */
2337 {
2338 if( yymsp[0].minor.yy219 ){
2339 yymsp[0].minor.yy219->op = yymsp[-1].minor.yy46;
2340 yymsp[0].minor.yy219->pPrior = yymsp[-2].minor.yy219;
2341 }else{
2342 sqlite3SelectDelete(yymsp[-2].minor.yy219);
2343 }
2344 yygotominor.yy219 = yymsp[0].minor.yy219;
2345 }
2346 break;
2347 case 108: /* multiselect_op ::= UNION ALL */
2348 {yygotominor.yy46 = TK_ALL;}
2349 break;
2350 case 110: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
2351 {
2352 yygotominor.yy219 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy174,yymsp[-5].minor.yy373,yymsp[-4].minor.yy172,yymsp[-3].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy174,yymsp[-7].minor.yy46,yymsp[0].minor.yy234.pLimit,yymsp[0].minor.yy234.pOffset);
2353 }
2354 break;
2355 case 114: /* sclp ::= selcollist COMMA */
2356 case 238: /* idxlist_opt ::= LP idxlist RP */
2357 {yygotominor.yy174 = yymsp[-1].minor.yy174;}
2358 break;
2359 case 115: /* sclp ::= */
2360 case 141: /* orderby_opt ::= */
2361 case 149: /* groupby_opt ::= */
2362 case 231: /* exprlist ::= */
2363 case 237: /* idxlist_opt ::= */
2364 {yygotominor.yy174 = 0;}
2365 break;
2366 case 116: /* selcollist ::= sclp expr as */
2367 {
2368 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[-1].minor.yy172,yymsp[0].minor.yy410.n?&yymsp[0].minor.yy410:0);
2369 }
2370 break;
2371 case 117: /* selcollist ::= sclp STAR */
2372 {
2373 Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
2374 yygotominor.yy174 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy174, p, 0);
2375 }
2376 break;
2377 case 118: /* selcollist ::= sclp nm DOT STAR */
2378 {
2379 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
2380 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
2381 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
2382 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174, pDot, 0);
2383 }
2384 break;
2385 case 121: /* as ::= */
2386 {yygotominor.yy410.n = 0;}
2387 break;
2388 case 122: /* from ::= */
2389 {yygotominor.yy373 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy373));}
2390 break;
2391 case 123: /* from ::= FROM seltablist */
2392 {
2393 yygotominor.yy373 = yymsp[0].minor.yy373;
2394 sqlite3SrcListShiftJoinType(yygotominor.yy373);
2395 }
2396 break;
2397 case 124: /* stl_prefix ::= seltablist joinop */
2398 {
2399 yygotominor.yy373 = yymsp[-1].minor.yy373;
2400 if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].jointype = yymsp[0].minor.yy46;
2401 }
2402 break;
2403 case 125: /* stl_prefix ::= */
2404 {yygotominor.yy373 = 0;}
2405 break;
2406 case 126: /* seltablist ::= stl_prefix nm dbnm as on_opt using_opt */
2407 {
2408 yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy373,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,0,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
2409 }
2410 break;
2411 case 127: /* seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt */
2412 {
2413 yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy373,0,0,&yymsp[-2].minor.yy410,yymsp[-4].minor.yy219,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
2414 }
2415 break;
2416 case 129: /* seltablist_paren ::= seltablist */
2417 {
2418 sqlite3SrcListShiftJoinType(yymsp[0].minor.yy373);
2419 yygotominor.yy219 = sqlite3SelectNew(pParse,0,yymsp[0].minor.yy373,0,0,0,0,0,0,0);
2420 }
2421 break;
2422 case 130: /* dbnm ::= */
2423 {yygotominor.yy410.z=0; yygotominor.yy410.n=0;}
2424 break;
2425 case 132: /* fullname ::= nm dbnm */
2426 {yygotominor.yy373 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);}
2427 break;
2428 case 133: /* joinop ::= COMMA|JOIN */
2429 { yygotominor.yy46 = JT_INNER; }
2430 break;
2431 case 134: /* joinop ::= JOIN_KW JOIN */
2432 { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
2433 break;
2434 case 135: /* joinop ::= JOIN_KW nm JOIN */
2435 { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy410,0); }
2436 break;
2437 case 136: /* joinop ::= JOIN_KW nm nm JOIN */
2438 { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy410,&yymsp[-1].minor.yy410); }
2439 break;
2440 case 137: /* on_opt ::= ON expr */
2441 case 145: /* sortitem ::= expr */
2442 case 152: /* having_opt ::= HAVING expr */
2443 case 159: /* where_opt ::= WHERE expr */
2444 case 174: /* expr ::= term */
2445 case 202: /* escape ::= ESCAPE expr */
2446 case 226: /* case_else ::= ELSE expr */
2447 case 228: /* case_operand ::= expr */
2448 {yygotominor.yy172 = yymsp[0].minor.yy172;}
2449 break;
2450 case 138: /* on_opt ::= */
2451 case 151: /* having_opt ::= */
2452 case 158: /* where_opt ::= */
2453 case 203: /* escape ::= */
2454 case 227: /* case_else ::= */
2455 case 229: /* case_operand ::= */
2456 {yygotominor.yy172 = 0;}
2457 break;
2458 case 139: /* using_opt ::= USING LP inscollist RP */
2459 case 171: /* inscollist_opt ::= LP inscollist RP */
2460 {yygotominor.yy432 = yymsp[-1].minor.yy432;}
2461 break;
2462 case 140: /* using_opt ::= */
2463 case 170: /* inscollist_opt ::= */
2464 {yygotominor.yy432 = 0;}
2465 break;
2466 case 142: /* orderby_opt ::= ORDER BY sortlist */
2467 case 150: /* groupby_opt ::= GROUP BY nexprlist */
2468 case 230: /* exprlist ::= nexprlist */
2469 {yygotominor.yy174 = yymsp[0].minor.yy174;}
2470 break;
2471 case 143: /* sortlist ::= sortlist COMMA sortitem sortorder */
2472 {
2473 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174,yymsp[-1].minor.yy172,0);
2474 if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
2475 }
2476 break;
2477 case 144: /* sortlist ::= sortitem sortorder */
2478 {
2479 yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy172,0);
2480 if( yygotominor.yy174 && yygotominor.yy174->a ) yygotominor.yy174->a[0].sortOrder = yymsp[0].minor.yy46;
2481 }
2482 break;
2483 case 146: /* sortorder ::= ASC */
2484 case 148: /* sortorder ::= */
2485 {yygotominor.yy46 = SQLITE_SO_ASC;}
2486 break;
2487 case 147: /* sortorder ::= DESC */
2488 {yygotominor.yy46 = SQLITE_SO_DESC;}
2489 break;
2490 case 153: /* limit_opt ::= */
2491 {yygotominor.yy234.pLimit = 0; yygotominor.yy234.pOffset = 0;}
2492 break;
2493 case 154: /* limit_opt ::= LIMIT expr */
2494 {yygotominor.yy234.pLimit = yymsp[0].minor.yy172; yygotominor.yy234.pOffset = 0;}
2495 break;
2496 case 155: /* limit_opt ::= LIMIT expr OFFSET expr */
2497 {yygotominor.yy234.pLimit = yymsp[-2].minor.yy172; yygotominor.yy234.pOffset = yymsp[0].minor.yy172;}
2498 break;
2499 case 156: /* limit_opt ::= LIMIT expr COMMA expr */
2500 {yygotominor.yy234.pOffset = yymsp[-2].minor.yy172; yygotominor.yy234.pLimit = yymsp[0].minor.yy172;}
2501 break;
2502 case 157: /* cmd ::= DELETE FROM fullname where_opt */
2503 {sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy373,yymsp[0].minor.yy172);}
2504 break;
2505 case 160: /* cmd ::= UPDATE orconf fullname SET setlist where_opt */
2506 {
2507 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy174,"set list");
2508 sqlite3Update(pParse,yymsp[-3].minor.yy373,yymsp[-1].minor.yy174,yymsp[0].minor.yy172,yymsp[-4].minor.yy46);
2509 }
2510 break;
2511 case 161: /* setlist ::= setlist COMMA nm EQ expr */
2512 {yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
2513 break;
2514 case 162: /* setlist ::= nm EQ expr */
2515 {yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
2516 break;
2517 case 163: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
2518 {sqlite3Insert(pParse, yymsp[-5].minor.yy373, yymsp[-1].minor.yy174, 0, yymsp[-4].minor.yy432, yymsp[-7].minor.yy46);}
2519 break;
2520 case 164: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
2521 {sqlite3Insert(pParse, yymsp[-2].minor.yy373, 0, yymsp[0].minor.yy219, yymsp[-1].minor.yy432, yymsp[-4].minor.yy46);}
2522 break;
2523 case 165: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
2524 {sqlite3Insert(pParse, yymsp[-3].minor.yy373, 0, 0, yymsp[-2].minor.yy432, yymsp[-5].minor.yy46);}
2525 break;
2526 case 168: /* itemlist ::= itemlist COMMA expr */
2527 case 232: /* nexprlist ::= nexprlist COMMA expr */
2528 {yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[0].minor.yy172,0);}
2529 break;
2530 case 169: /* itemlist ::= expr */
2531 case 233: /* nexprlist ::= expr */
2532 {yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,0);}
2533 break;
2534 case 172: /* inscollist ::= inscollist COMMA nm */
2535 {yygotominor.yy432 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy432,&yymsp[0].minor.yy410);}
2536 break;
2537 case 173: /* inscollist ::= nm */
2538 {yygotominor.yy432 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy410);}
2539 break;
2540 case 175: /* expr ::= LP expr RP */
2541 {yygotominor.yy172 = yymsp[-1].minor.yy172; sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
2542 break;
2543 case 176: /* term ::= NULL */
2544 case 181: /* term ::= INTEGER|FLOAT|BLOB */
2545 case 182: /* term ::= STRING */
2546 {yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
2547 break;
2548 case 177: /* expr ::= ID */
2549 case 178: /* expr ::= JOIN_KW */
2550 {yygotominor.yy172 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);}
2551 break;
2552 case 179: /* expr ::= nm DOT nm */
2553 {
2554 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
2555 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy410);
2556 yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
2557 }
2558 break;
2559 case 180: /* expr ::= nm DOT nm DOT nm */
2560 {
2561 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy410);
2562 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
2563 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy410);
2564 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
2565 yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
2566 }
2567 break;
2568 case 183: /* expr ::= REGISTER */
2569 {yygotominor.yy172 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
2570 break;
2571 case 184: /* expr ::= VARIABLE */
2572 {
2573 Token *pToken = &yymsp[0].minor.yy0;
2574 Expr *pExpr = yygotominor.yy172 = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken);
2575 sqlite3ExprAssignVarNumber(pParse, pExpr);
2576 }
2577 break;
2578 case 185: /* expr ::= expr COLLATE ids */
2579 {
2580 yygotominor.yy172 = sqlite3ExprSetColl(pParse, yymsp[-2].minor.yy172, &yymsp[0].minor.yy410);
2581 }
2582 break;
2583 case 186: /* expr ::= CAST LP expr AS typetoken RP */
2584 {
2585 yygotominor.yy172 = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy172, 0, &yymsp[-1].minor.yy410);
2586 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
2587 }
2588 break;
2589 case 187: /* expr ::= ID LP distinct exprlist RP */
2590 {
2591 if( yymsp[-1].minor.yy174 && yymsp[-1].minor.yy174->nExpr>SQLITE_MAX_FUNCTION_ARG ){
2592 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
2593 }
2594 yygotominor.yy172 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy174, &yymsp[-4].minor.yy0);
2595 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
2596 if( yymsp[-2].minor.yy46 && yygotominor.yy172 ){
2597 yygotominor.yy172->flags |= EP_Distinct;
2598 }
2599 }
2600 break;
2601 case 188: /* expr ::= ID LP STAR RP */
2602 {
2603 yygotominor.yy172 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
2604 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
2605 }
2606 break;
2607 case 189: /* term ::= CTIME_KW */
2608 {
2609 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
2610 ** treated as functions that return constants */
2611 yygotominor.yy172 = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
2612 if( yygotominor.yy172 ){
2613 yygotominor.yy172->op = TK_CONST_FUNC;
2614 yygotominor.yy172->span = yymsp[0].minor.yy0;
2615 }
2616 }
2617 break;
2618 case 190: /* expr ::= expr AND expr */
2619 case 191: /* expr ::= expr OR expr */
2620 case 192: /* expr ::= expr LT|GT|GE|LE expr */
2621 case 193: /* expr ::= expr EQ|NE expr */
2622 case 194: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
2623 case 195: /* expr ::= expr PLUS|MINUS expr */
2624 case 196: /* expr ::= expr STAR|SLASH|REM expr */
2625 case 197: /* expr ::= expr CONCAT expr */
2626 {yygotominor.yy172 = sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy172,yymsp[0].minor.yy172,0);}
2627 break;
2628 case 198: /* likeop ::= LIKE_KW */
2629 case 200: /* likeop ::= MATCH */
2630 {yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 0;}
2631 break;
2632 case 199: /* likeop ::= NOT LIKE_KW */
2633 case 201: /* likeop ::= NOT MATCH */
2634 {yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 1;}
2635 break;
2636 case 204: /* expr ::= expr likeop expr escape */
2637 {
2638 ExprList *pList;
2639 pList = sqlite3ExprListAppend(pParse,0, yymsp[-1].minor.yy172, 0);
2640 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-3].minor.yy172, 0);
2641 if( yymsp[0].minor.yy172 ){
2642 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
2643 }
2644 yygotominor.yy172 = sqlite3ExprFunction(pParse, pList, &yymsp[-2].minor.yy72.eOperator);
2645 if( yymsp[-2].minor.yy72.not ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
2646 sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy172->span, &yymsp[-1].minor.yy172->span);
2647 if( yygotominor.yy172 ) yygotominor.yy172->flags |= EP_InfixFunc;
2648 }
2649 break;
2650 case 205: /* expr ::= expr ISNULL|NOTNULL */
2651 {
2652 yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, yymsp[-1].minor.yy172, 0, 0);
2653 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy172->span,&yymsp[0].minor.yy0);
2654 }
2655 break;
2656 case 206: /* expr ::= expr IS NULL */
2657 {
2658 yygotominor.yy172 = sqlite3PExpr(pParse, TK_ISNULL, yymsp[-2].minor.yy172, 0, 0);
2659 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
2660 }
2661 break;
2662 case 207: /* expr ::= expr NOT NULL */
2663 {
2664 yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-2].minor.yy172, 0, 0);
2665 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
2666 }
2667 break;
2668 case 208: /* expr ::= expr IS NOT NULL */
2669 {
2670 yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-3].minor.yy172, 0, 0);
2671 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,&yymsp[0].minor.yy0);
2672 }
2673 break;
2674 case 209: /* expr ::= NOT expr */
2675 case 210: /* expr ::= BITNOT expr */
2676 {
2677 yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy172, 0, 0);
2678 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
2679 }
2680 break;
2681 case 211: /* expr ::= MINUS expr */
2682 {
2683 yygotominor.yy172 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
2684 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
2685 }
2686 break;
2687 case 212: /* expr ::= PLUS expr */
2688 {
2689 yygotominor.yy172 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy172, 0, 0);
2690 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
2691 }
2692 break;
2693 case 215: /* expr ::= expr between_op expr AND expr */
2694 {
2695 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
2696 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
2697 yygotominor.yy172 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy172, 0, 0);
2698 if( yygotominor.yy172 ){
2699 yygotominor.yy172->pList = pList;
2700 }else{
2701 sqlite3ExprListDelete(pList);
2702 }
2703 if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
2704 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy172->span);
2705 }
2706 break;
2707 case 218: /* expr ::= expr in_op LP exprlist RP */
2708 {
2709 yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
2710 if( yygotominor.yy172 ){
2711 yygotominor.yy172->pList = yymsp[-1].minor.yy174;
2712 sqlite3ExprSetHeight(yygotominor.yy172);
2713 }else{
2714 sqlite3ExprListDelete(yymsp[-1].minor.yy174);
2715 }
2716 if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
2717 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
2718 }
2719 break;
2720 case 219: /* expr ::= LP select RP */
2721 {
2722 yygotominor.yy172 = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
2723 if( yygotominor.yy172 ){
2724 yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
2725 sqlite3ExprSetHeight(yygotominor.yy172);
2726 }else{
2727 sqlite3SelectDelete(yymsp[-1].minor.yy219);
2728 }
2729 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
2730 }
2731 break;
2732 case 220: /* expr ::= expr in_op LP select RP */
2733 {
2734 yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
2735 if( yygotominor.yy172 ){
2736 yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
2737 sqlite3ExprSetHeight(yygotominor.yy172);
2738 }else{
2739 sqlite3SelectDelete(yymsp[-1].minor.yy219);
2740 }
2741 if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
2742 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
2743 }
2744 break;
2745 case 221: /* expr ::= expr in_op nm dbnm */
2746 {
2747 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);
2748 yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy172, 0, 0);
2749 if( yygotominor.yy172 ){
2750 yygotominor.yy172->pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
2751 sqlite3ExprSetHeight(yygotominor.yy172);
2752 }else{
2753 sqlite3SrcListDelete(pSrc);
2754 }
2755 if( yymsp[-2].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
2756 sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,yymsp[0].minor.yy410.z?&yymsp[0].minor.yy410:&yymsp[-1].minor.yy410);
2757 }
2758 break;
2759 case 222: /* expr ::= EXISTS LP select RP */
2760 {
2761 Expr *p = yygotominor.yy172 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
2762 if( p ){
2763 p->pSelect = yymsp[-1].minor.yy219;
2764 sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
2765 sqlite3ExprSetHeight(yygotominor.yy172);
2766 }else{
2767 sqlite3SelectDelete(yymsp[-1].minor.yy219);
2768 }
2769 }
2770 break;
2771 case 223: /* expr ::= CASE case_operand case_exprlist case_else END */
2772 {
2773 yygotominor.yy172 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, 0);
2774 if( yygotominor.yy172 ){
2775 yygotominor.yy172->pList = yymsp[-2].minor.yy174;
2776 sqlite3ExprSetHeight(yygotominor.yy172);
2777 }else{
2778 sqlite3ExprListDelete(yymsp[-2].minor.yy174);
2779 }
2780 sqlite3ExprSpan(yygotominor.yy172, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
2781 }
2782 break;
2783 case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
2784 {
2785 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, yymsp[-2].minor.yy172, 0);
2786 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
2787 }
2788 break;
2789 case 225: /* case_exprlist ::= WHEN expr THEN expr */
2790 {
2791 yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
2792 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
2793 }
2794 break;
2795 case 234: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
2796 {
2797 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy410, &yymsp[-5].minor.yy410,
2798 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy410,0), yymsp[-1].minor.yy174, yymsp[-9].minor.yy46,
2799 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy46);
2800 }
2801 break;
2802 case 235: /* uniqueflag ::= UNIQUE */
2803 case 283: /* raisetype ::= ABORT */
2804 {yygotominor.yy46 = OE_Abort;}
2805 break;
2806 case 236: /* uniqueflag ::= */
2807 {yygotominor.yy46 = OE_None;}
2808 break;
2809 case 239: /* idxlist ::= idxlist COMMA idxitem collate sortorder */
2810 {
2811 Expr *p = 0;
2812 if( yymsp[-1].minor.yy410.n>0 ){
2813 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
2814 sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy410);
2815 }
2816 yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, p, &yymsp[-2].minor.yy410);
2817 sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
2818 if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
2819 }
2820 break;
2821 case 240: /* idxlist ::= idxitem collate sortorder */
2822 {
2823 Expr *p = 0;
2824 if( yymsp[-1].minor.yy410.n>0 ){
2825 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
2826 sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy410);
2827 }
2828 yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, p, &yymsp[-2].minor.yy410);
2829 sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
2830 if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
2831 }
2832 break;
2833 case 242: /* collate ::= */
2834 {yygotominor.yy410.z = 0; yygotominor.yy410.n = 0;}
2835 break;
2836 case 244: /* cmd ::= DROP INDEX ifexists fullname */
2837 {sqlite3DropIndex(pParse, yymsp[0].minor.yy373, yymsp[-1].minor.yy46);}
2838 break;
2839 case 245: /* cmd ::= VACUUM */
2840 case 246: /* cmd ::= VACUUM nm */
2841 {sqlite3Vacuum(pParse);}
2842 break;
2843 case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
2844 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,0);}
2845 break;
2846 case 248: /* cmd ::= PRAGMA nm dbnm EQ ON */
2847 case 249: /* cmd ::= PRAGMA nm dbnm EQ DELETE */
2848 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy0,0);}
2849 break;
2850 case 250: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
2851 {
2852 sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,1);
2853 }
2854 break;
2855 case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
2856 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-1].minor.yy410,0);}
2857 break;
2858 case 252: /* cmd ::= PRAGMA nm dbnm */
2859 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,0,0);}
2860 break;
2861 case 260: /* cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END */
2862 {
2863 Token all;
2864 all.z = yymsp[-3].minor.yy410.z;
2865 all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy410.z) + yymsp[0].minor.yy0.n;
2866 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy243, &all);
2867 }
2868 break;
2869 case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
2870 {
2871 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy410, &yymsp[-6].minor.yy410, yymsp[-5].minor.yy46, yymsp[-4].minor.yy370.a, yymsp[-4].minor.yy370.b, yymsp[-2].minor.yy373, yymsp[0].minor.yy172, yymsp[-10].minor.yy46, yymsp[-8].minor.yy46);
2872 yygotominor.yy410 = (yymsp[-6].minor.yy410.n==0?yymsp[-7].minor.yy410:yymsp[-6].minor.yy410);
2873 }
2874 break;
2875 case 262: /* trigger_time ::= BEFORE */
2876 case 265: /* trigger_time ::= */
2877 { yygotominor.yy46 = TK_BEFORE; }
2878 break;
2879 case 263: /* trigger_time ::= AFTER */
2880 { yygotominor.yy46 = TK_AFTER; }
2881 break;
2882 case 264: /* trigger_time ::= INSTEAD OF */
2883 { yygotominor.yy46 = TK_INSTEAD;}
2884 break;
2885 case 266: /* trigger_event ::= DELETE|INSERT */
2886 case 267: /* trigger_event ::= UPDATE */
2887 {yygotominor.yy370.a = yymsp[0].major; yygotominor.yy370.b = 0;}
2888 break;
2889 case 268: /* trigger_event ::= UPDATE OF inscollist */
2890 {yygotominor.yy370.a = TK_UPDATE; yygotominor.yy370.b = yymsp[0].minor.yy432;}
2891 break;
2892 case 271: /* when_clause ::= */
2893 case 288: /* key_opt ::= */
2894 { yygotominor.yy172 = 0; }
2895 break;
2896 case 272: /* when_clause ::= WHEN expr */
2897 case 289: /* key_opt ::= KEY expr */
2898 { yygotominor.yy172 = yymsp[0].minor.yy172; }
2899 break;
2900 case 273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
2901 {
2902 if( yymsp[-2].minor.yy243 ){
2903 yymsp[-2].minor.yy243->pLast->pNext = yymsp[-1].minor.yy243;
2904 }else{
2905 yymsp[-2].minor.yy243 = yymsp[-1].minor.yy243;
2906 }
2907 yymsp[-2].minor.yy243->pLast = yymsp[-1].minor.yy243;
2908 yygotominor.yy243 = yymsp[-2].minor.yy243;
2909 }
2910 break;
2911 case 274: /* trigger_cmd_list ::= */
2912 { yygotominor.yy243 = 0; }
2913 break;
2914 case 275: /* trigger_cmd ::= UPDATE orconf nm SET setlist where_opt */
2915 { yygotominor.yy243 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-3].minor.yy410, yymsp[-1].minor.yy174, yymsp[0].minor.yy172, yymsp[-4].minor.yy46); }
2916 break;
2917 case 276: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP */
2918 {yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy410, yymsp[-4].minor.yy432, yymsp[-1].minor.yy174, 0, yymsp[-7].minor.yy46);}
2919 break;
2920 case 277: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt select */
2921 {yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy410, yymsp[-1].minor.yy432, 0, yymsp[0].minor.yy219, yymsp[-4].minor.yy46);}
2922 break;
2923 case 278: /* trigger_cmd ::= DELETE FROM nm where_opt */
2924 {yygotominor.yy243 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-1].minor.yy410, yymsp[0].minor.yy172);}
2925 break;
2926 case 279: /* trigger_cmd ::= select */
2927 {yygotominor.yy243 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy219); }
2928 break;
2929 case 280: /* expr ::= RAISE LP IGNORE RP */
2930 {
2931 yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
2932 if( yygotominor.yy172 ){
2933 yygotominor.yy172->iColumn = OE_Ignore;
2934 sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
2935 }
2936 }
2937 break;
2938 case 281: /* expr ::= RAISE LP raisetype COMMA nm RP */
2939 {
2940 yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy410);
2941 if( yygotominor.yy172 ) {
2942 yygotominor.yy172->iColumn = yymsp[-3].minor.yy46;
2943 sqlite3ExprSpan(yygotominor.yy172, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
2944 }
2945 }
2946 break;
2947 case 282: /* raisetype ::= ROLLBACK */
2948 {yygotominor.yy46 = OE_Rollback;}
2949 break;
2950 case 284: /* raisetype ::= FAIL */
2951 {yygotominor.yy46 = OE_Fail;}
2952 break;
2953 case 285: /* cmd ::= DROP TRIGGER ifexists fullname */
2954 {
2955 sqlite3DropTrigger(pParse,yymsp[0].minor.yy373,yymsp[-1].minor.yy46);
2956 }
2957 break;
2958 case 286: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
2959 {
2960 sqlite3Attach(pParse, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy172);
2961 }
2962 break;
2963 case 287: /* cmd ::= DETACH database_kw_opt expr */
2964 {
2965 sqlite3Detach(pParse, yymsp[0].minor.yy172);
2966 }
2967 break;
2968 case 292: /* cmd ::= REINDEX */
2969 {sqlite3Reindex(pParse, 0, 0);}
2970 break;
2971 case 293: /* cmd ::= REINDEX nm dbnm */
2972 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
2973 break;
2974 case 294: /* cmd ::= ANALYZE */
2975 {sqlite3Analyze(pParse, 0, 0);}
2976 break;
2977 case 295: /* cmd ::= ANALYZE nm dbnm */
2978 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
2979 break;
2980 case 296: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
2981 {
2982 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy373,&yymsp[0].minor.yy410);
2983 }
2984 break;
2985 case 297: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
2986 {
2987 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy410);
2988 }
2989 break;
2990 case 298: /* add_column_fullname ::= fullname */
2991 {
2992 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy373);
2993 }
2994 break;
2995 case 301: /* cmd ::= create_vtab */
2996 {sqlite3VtabFinishParse(pParse,0);}
2997 break;
2998 case 302: /* cmd ::= create_vtab LP vtabarglist RP */
2999 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
3000 break;
3001 case 303: /* create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm */
3002 {
3003 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, &yymsp[0].minor.yy410);
3004 }
3005 break;
3006 case 306: /* vtabarg ::= */
3007 {sqlite3VtabArgInit(pParse);}
3008 break;
3009 case 308: /* vtabargtoken ::= ANY */
3010 case 309: /* vtabargtoken ::= lp anylist RP */
3011 case 310: /* lp ::= LP */
3012 case 312: /* anylist ::= anylist ANY */
3013 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
3014 break;
3015 };
3016 yygoto = yyRuleInfo[yyruleno].lhs;
3017 yysize = yyRuleInfo[yyruleno].nrhs;
3018 yypParser->yyidx -= yysize;
3019 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
3020 if( yyact < YYNSTATE ){
3021 #ifdef NDEBUG
3022 /* If we are not debugging and the reduce action popped at least
3023 ** one element off the stack, then we can push the new element back
3024 ** onto the stack here, and skip the stack overflow test in yy_shift().
3025 ** That gives a significant speed improvement. */
3026 if( yysize ){
3027 yypParser->yyidx++;
3028 yymsp -= yysize-1;
3029 yymsp->stateno = yyact;
3030 yymsp->major = yygoto;
3031 yymsp->minor = yygotominor;
3032 }else
3033 #endif
3034 {
3035 yy_shift(yypParser,yyact,yygoto,&yygotominor);
3036 }
3037 }else{
3038 assert( yyact == YYNSTATE + YYNRULE + 1 );
3039 yy_accept(yypParser);
3040 }
3041 }
3042
3043 /*
3044 ** The following code executes when the parse fails
3045 */
yy_parse_failed(yyParser * yypParser)3046 static void yy_parse_failed(
3047 yyParser *yypParser /* The parser */
3048 ){
3049 sqlite3ParserARG_FETCH;
3050 #ifndef NDEBUG
3051 if( yyTraceFILE ){
3052 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
3053 }
3054 #endif
3055 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
3056 /* Here code is inserted which will be executed whenever the
3057 ** parser fails */
3058 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
3059 }
3060
3061 /*
3062 ** The following code executes when a syntax error first occurs.
3063 */
yy_syntax_error(yyParser * yypParser,int yymajor,YYMINORTYPE yyminor)3064 static void yy_syntax_error(
3065 yyParser *yypParser, /* The parser */
3066 int yymajor, /* The major type of the error token */
3067 YYMINORTYPE yyminor /* The minor type of the error token */
3068 ){
3069 sqlite3ParserARG_FETCH;
3070 #define TOKEN (yyminor.yy0)
3071
3072 yymajor = yymajor; /* quiet the compiler */
3073 assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
3074 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
3075 pParse->parseError = 1;
3076 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
3077 }
3078
3079 /*
3080 ** The following is executed when the parser accepts
3081 */
yy_accept(yyParser * yypParser)3082 static void yy_accept(
3083 yyParser *yypParser /* The parser */
3084 ){
3085 sqlite3ParserARG_FETCH;
3086 #ifndef NDEBUG
3087 if( yyTraceFILE ){
3088 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
3089 }
3090 #endif
3091 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
3092 /* Here code is inserted which will be executed whenever the
3093 ** parser accepts */
3094 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
3095 }
3096
3097 /* The main parser program.
3098 ** The first argument is a pointer to a structure obtained from
3099 ** "sqlite3ParserAlloc" which describes the current state of the parser.
3100 ** The second argument is the major token number. The third is
3101 ** the minor token. The fourth optional argument is whatever the
3102 ** user wants (and specified in the grammar) and is available for
3103 ** use by the action routines.
3104 **
3105 ** Inputs:
3106 ** <ul>
3107 ** <li> A pointer to the parser (an opaque structure.)
3108 ** <li> The major token number.
3109 ** <li> The minor token number.
3110 ** <li> An option argument of a grammar-specified type.
3111 ** </ul>
3112 **
3113 ** Outputs:
3114 ** None.
3115 */
sqlite3Parser(void * yyp,int yymajor,sqlite3ParserTOKENTYPE yyminor sqlite3ParserARG_PDECL)3116 void sqlite3Parser(
3117 void *yyp, /* The parser */
3118 int yymajor, /* The major token code number */
3119 sqlite3ParserTOKENTYPE yyminor /* The value for the token */
3120 sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */
3121 ){
3122 YYMINORTYPE yyminorunion;
3123 int yyact; /* The parser action. */
3124 int yyendofinput; /* True if we are at the end of input */
3125 #ifdef YYERRORSYMBOL
3126 int yyerrorhit = 0; /* True if yymajor has invoked an error */
3127 #endif
3128 yyParser *yypParser; /* The parser */
3129
3130 /* (re)initialize the parser, if necessary */
3131 yypParser = (yyParser*)yyp;
3132 if( yypParser->yyidx<0 ){
3133 #if YYSTACKDEPTH<=0
3134 if( yypParser->yystksz <=0 ){
3135 /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
3136 yyminorunion = yyzerominor;
3137 yyStackOverflow(yypParser, &yyminorunion);
3138 return;
3139 }
3140 #endif
3141 yypParser->yyidx = 0;
3142 yypParser->yyerrcnt = -1;
3143 yypParser->yystack[0].stateno = 0;
3144 yypParser->yystack[0].major = 0;
3145 }
3146 yyminorunion.yy0 = yyminor;
3147 yyendofinput = (yymajor==0);
3148 sqlite3ParserARG_STORE;
3149
3150 #ifndef NDEBUG
3151 if( yyTraceFILE ){
3152 fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
3153 }
3154 #endif
3155
3156 do{
3157 yyact = yy_find_shift_action(yypParser,yymajor);
3158 if( yyact<YYNSTATE ){
3159 assert( !yyendofinput ); /* Impossible to shift the $ token */
3160 yy_shift(yypParser,yyact,yymajor,&yyminorunion);
3161 yypParser->yyerrcnt--;
3162 yymajor = YYNOCODE;
3163 }else if( yyact < YYNSTATE + YYNRULE ){
3164 yy_reduce(yypParser,yyact-YYNSTATE);
3165 }else{
3166 assert( yyact == YY_ERROR_ACTION );
3167 #ifdef YYERRORSYMBOL
3168 int yymx;
3169 #endif
3170 #ifndef NDEBUG
3171 if( yyTraceFILE ){
3172 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
3173 }
3174 #endif
3175 #ifdef YYERRORSYMBOL
3176 /* A syntax error has occurred.
3177 ** The response to an error depends upon whether or not the
3178 ** grammar defines an error token "ERROR".
3179 **
3180 ** This is what we do if the grammar does define ERROR:
3181 **
3182 ** * Call the %syntax_error function.
3183 **
3184 ** * Begin popping the stack until we enter a state where
3185 ** it is legal to shift the error symbol, then shift
3186 ** the error symbol.
3187 **
3188 ** * Set the error count to three.
3189 **
3190 ** * Begin accepting and shifting new tokens. No new error
3191 ** processing will occur until three tokens have been
3192 ** shifted successfully.
3193 **
3194 */
3195 if( yypParser->yyerrcnt<0 ){
3196 yy_syntax_error(yypParser,yymajor,yyminorunion);
3197 }
3198 yymx = yypParser->yystack[yypParser->yyidx].major;
3199 if( yymx==YYERRORSYMBOL || yyerrorhit ){
3200 #ifndef NDEBUG
3201 if( yyTraceFILE ){
3202 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
3203 yyTracePrompt,yyTokenName[yymajor]);
3204 }
3205 #endif
3206 yy_destructor(yymajor,&yyminorunion);
3207 yymajor = YYNOCODE;
3208 }else{
3209 while(
3210 yypParser->yyidx >= 0 &&
3211 yymx != YYERRORSYMBOL &&
3212 (yyact = yy_find_reduce_action(
3213 yypParser->yystack[yypParser->yyidx].stateno,
3214 YYERRORSYMBOL)) >= YYNSTATE
3215 ){
3216 yy_pop_parser_stack(yypParser);
3217 }
3218 if( yypParser->yyidx < 0 || yymajor==0 ){
3219 yy_destructor(yymajor,&yyminorunion);
3220 yy_parse_failed(yypParser);
3221 yymajor = YYNOCODE;
3222 }else if( yymx!=YYERRORSYMBOL ){
3223 YYMINORTYPE u2;
3224 u2.YYERRSYMDT = 0;
3225 yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
3226 }
3227 }
3228 yypParser->yyerrcnt = 3;
3229 yyerrorhit = 1;
3230 #else /* YYERRORSYMBOL is not defined */
3231 /* This is what we do if the grammar does not define ERROR:
3232 **
3233 ** * Report an error message, and throw away the input token.
3234 **
3235 ** * If the input token is $, then fail the parse.
3236 **
3237 ** As before, subsequent error messages are suppressed until
3238 ** three input tokens have been successfully shifted.
3239 */
3240 if( yypParser->yyerrcnt<=0 ){
3241 yy_syntax_error(yypParser,yymajor,yyminorunion);
3242 }
3243 yypParser->yyerrcnt = 3;
3244 yy_destructor(yymajor,&yyminorunion);
3245 if( yyendofinput ){
3246 yy_parse_failed(yypParser);
3247 }
3248 yymajor = YYNOCODE;
3249 #endif
3250 }
3251 }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
3252 return;
3253 }
3254