📄 parse.c
字号:
/* Driver template for the LEMON parser generator.** The author disclaims copyright to this source code.*//* First off, code is include which follows the "include" declaration** in the input file. */#include <stdio.h>#line 56 "parse.y"#include "sqliteInt.h"#include "parse.h"/*** An instance of this structure holds information about the** LIMIT clause of a SELECT statement.*/struct LimitVal { Expr *pLimit; /* The LIMIT expression. NULL if there is no limit */ Expr *pOffset; /* The OFFSET expression. NULL if there is none */};/*** An instance of this structure is used to store the LIKE,** GLOB, NOT LIKE, and NOT GLOB operators.*/struct LikeOp { Token eOperator; /* "like" or "glob" or "regexp" */ int not; /* True if the NOT keyword is present */};/*** An instance of the following structure describes the event of a** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT,** TK_DELETE, or TK_INSTEAD. If the event is of the form**** UPDATE ON (a,b,c)**** Then the "b" IdList records the list "a,b,c".*/struct TrigEvent { int a; IdList * b; };/*** An instance of this structure holds the ATTACH key and the key type.*/struct AttachKey { int type; Token key; };#line 48 "parse.c"/* Next is all token values, in a form suitable for use by makeheaders.** This section will be null unless lemon is run with the -m switch.*//* ** These constants (all generated automatically by the parser generator)** specify the various kinds of tokens (terminals) that the parser** understands. **** Each symbol here is a terminal symbol in the grammar.*//* Make sure the INTERFACE macro is defined.*/#ifndef INTERFACE# define INTERFACE 1#endif/* The next thing included is series of defines which control** various aspects of the generated parser.** YYCODETYPE is the data type used for storing terminal** and nonterminal numbers. "unsigned char" is** used if there are fewer than 250 terminals** and nonterminals. "int" is used otherwise.** YYNOCODE is a number of type YYCODETYPE which corresponds** to no legal terminal or nonterminal number. This** number is used to fill in empty slots of the hash ** table.** YYFALLBACK If defined, this indicates that one or more tokens** have fall-back values which should be used if the** original value of the token will not parse.** YYACTIONTYPE is the data type used for storing terminal** and nonterminal numbers. "unsigned char" is** used if there are fewer than 250 rules and** states combined. "int" is used otherwise.** sqlite3ParserTOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer.** YYMINORTYPE is the data type used for all minor tokens.** This is typically a union of many types, one of** which is sqlite3ParserTOKENTYPE. The entry in the union** for base tokens is called "yy0".** YYSTACKDEPTH is the maximum depth of the parser's stack.** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser** YYNSTATE the combined number of states.** YYNRULE the number of rules in the grammar** YYERRORSYMBOL is the code number of the error symbol. If not** defined, then do no error processing.*/#define YYCODETYPE unsigned char#define YYNOCODE 248#define YYACTIONTYPE unsigned short int#define YYWILDCARD 60#define sqlite3ParserTOKENTYPE Tokentypedef union { sqlite3ParserTOKENTYPE yy0; int yy46; struct LikeOp yy72; Expr* yy172; ExprList* yy174; Select* yy219; struct LimitVal yy234; TriggerStep* yy243; struct TrigEvent yy370; SrcList* yy373; Expr * yy386; struct {int value; int mask;} yy405; Token yy410; IdList* yy432; int yy495;} YYMINORTYPE;#define YYSTACKDEPTH 100#define sqlite3ParserARG_SDECL Parse *pParse;#define sqlite3ParserARG_PDECL ,Parse *pParse#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse#define sqlite3ParserARG_STORE yypParser->pParse = pParse#define YYNSTATE 581#define YYNRULE 309#define YYERRORSYMBOL 139#define YYERRSYMDT yy495#define YYFALLBACK 1#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)#define YY_ERROR_ACTION (YYNSTATE+YYNRULE)/* Next are that tables used to determine what action to take based on the** current state and lookahead token. These tables are used to implement** functions that take a state number and lookahead value and return an** action integer. **** Suppose the action integer is N. Then the action is determined as** follows**** 0 <= N < YYNSTATE Shift N. That is, push the lookahead** token onto the stack and goto state N.**** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.**** N == YYNSTATE+YYNRULE A syntax error has occurred.**** N == YYNSTATE+YYNRULE+1 The parser accepts its input.**** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused** slots in the yy_action[] table.**** The action table is constructed as a single large table named yy_action[].** Given state S and lookahead X, the action is computed as**** yy_action[ yy_shift_ofst[S] + X ]**** If the index value yy_shift_ofst[S]+X is out of range or if the value** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table** and that yy_default[S] should be used instead. **** The formula above is for computing the action when the lookahead is** a terminal symbol. If the lookahead is a non-terminal (as occurs after** a reduce action) then the yy_reduce_ofst[] array is used in place of** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of** YY_SHIFT_USE_DFLT.**** The following are the tables generated in this section:**** yy_action[] A single table containing all actions.** yy_lookahead[] A table containing the lookahead for each entry in** yy_action. Used to detect hash collisions.** yy_shift_ofst[] For each state, the offset into yy_action for** shifting terminals.** yy_reduce_ofst[] For each state, the offset into yy_action for** shifting non-terminals after a reduce.** yy_default[] Default action for each state.*/static const YYACTIONTYPE yy_action[] = { /* 0 */ 287, 67, 291, 69, 150, 168, 206, 431, 61, 61, /* 10 */ 61, 61, 66, 63, 63, 63, 63, 64, 64, 65, /* 20 */ 65, 65, 66, 441, 322, 164, 444, 450, 68, 63, /* 30 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 64, /* 40 */ 64, 65, 65, 65, 66, 60, 58, 295, 454, 455, /* 50 */ 451, 451, 62, 62, 61, 61, 61, 61, 513, 63, /* 60 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 287, /* 70 */ 318, 67, 431, 69, 150, 79, 160, 114, 224, 314, /* 80 */ 229, 315, 172, 249, 891, 120, 580, 515, 518, 2, /* 90 */ 250, 566, 422, 35, 223, 444, 450, 528, 20, 57, /* 100 */ 384, 381, 63, 63, 63, 63, 64, 64, 65, 65, /* 110 */ 65, 66, 287, 473, 60, 58, 295, 454, 455, 451, /* 120 */ 451, 62, 62, 61, 61, 61, 61, 389, 63, 63, /* 130 */ 63, 63, 64, 64, 65, 65, 65, 66, 444, 450, /* 140 */ 91, 311, 385, 480, 236, 383, 269, 204, 2, 83, /* 150 */ 581, 384, 381, 470, 196, 439, 209, 60, 58, 295, /* 160 */ 454, 455, 451, 451, 62, 62, 61, 61, 61, 61, /* 170 */ 170, 63, 63, 63, 63, 64, 64, 65, 65, 65, /* 180 */ 66, 287, 486, 439, 209, 132, 109, 270, 423, 443, /* 190 */ 402, 281, 390, 391, 441, 517, 164, 318, 507, 67, /* 200 */ 526, 69, 150, 562, 423, 143, 516, 444, 450, 145, /* 210 */ 146, 578, 882, 373, 882, 511, 171, 156, 514, 422, /* 220 */ 40, 337, 426, 19, 287, 140, 60, 58, 295, 454, /* 230 */ 455, 451, 451, 62, 62, 61, 61, 61, 61, 380, /* 240 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 250 */ 444, 450, 575, 404, 405, 428, 428, 428, 329, 332, /* 260 */ 240, 545, 67, 468, 69, 150, 271, 287, 291, 60, /* 270 */ 58, 295, 454, 455, 451, 451, 62, 62, 61, 61, /* 280 */ 61, 61, 124, 63, 63, 63, 63, 64, 64, 65, /* 290 */ 65, 65, 66, 444, 450, 401, 510, 389, 290, 544, /* 300 */ 65, 65, 65, 66, 507, 389, 542, 405, 443, 294, /* 310 */ 434, 435, 60, 58, 295, 454, 455, 451, 451, 62, /* 320 */ 62, 61, 61, 61, 61, 206, 63, 63, 63, 63, /* 330 */ 64, 64, 65, 65, 65, 66, 519, 514, 366, 287, /* 340 */ 75, 426, 148, 490, 224, 314, 229, 315, 172, 249, /* 350 */ 367, 265, 264, 1, 574, 286, 250, 389, 416, 445, /* 360 */ 446, 206, 390, 391, 177, 444, 450, 340, 343, 344, /* 370 */ 390, 391, 208, 357, 428, 428, 428, 360, 168, 345, /* 380 */ 431, 448, 449, 78, 60, 58, 295, 454, 455, 451, /* 390 */ 451, 62, 62, 61, 61, 61, 61, 476, 63, 63, /* 400 */ 63, 63, 64, 64, 65, 65, 65, 66, 287, 447, /* 410 */ 177, 561, 493, 340, 343, 344, 21, 318, 518, 318, /* 420 */ 431, 318, 390, 391, 318, 345, 475, 400, 20, 563, /* 430 */ 564, 489, 151, 177, 444, 450, 340, 343, 344, 422, /* 440 */ 34, 422, 34, 422, 34, 431, 422, 34, 345, 192, /* 450 */ 237, 147, 527, 60, 58, 295, 454, 455, 451, 451, /* 460 */ 62, 62, 61, 61, 61, 61, 423, 63, 63, 63, /* 470 */ 63, 64, 64, 65, 65, 65, 66, 287, 230, 348, /* 480 */ 408, 512, 298, 423, 334, 431, 318, 206, 318, 296, /* 490 */ 318, 208, 409, 154, 465, 9, 465, 458, 464, 389, /* 500 */ 374, 465, 173, 444, 450, 410, 173, 406, 422, 40, /* 510 */ 422, 48, 422, 48, 321, 434, 435, 407, 324, 475, /* 520 */ 457, 457, 60, 58, 295, 454, 455, 451, 451, 62, /* 530 */ 62, 61, 61, 61, 61, 459, 63, 63, 63, 63, /* 540 */ 64, 64, 65, 65, 65, 66, 287, 318, 499, 238, /* 550 */ 253, 480, 389, 338, 408, 149, 421, 306, 289, 307, /* 560 */ 420, 389, 289, 389, 390, 391, 409, 250, 500, 422, /* 570 */ 27, 155, 444, 450, 431, 422, 3, 208, 539, 410, /* 580 */ 335, 328, 578, 881, 324, 881, 457, 457, 484, 423, /* 590 */ 242, 60, 58, 295, 454, 455, 451, 451, 62, 62, /* 600 */ 61, 61, 61, 61, 255, 63, 63, 63, 63, 64, /* 610 */ 64, 65, 65, 65, 66, 287, 368, 390, 391, 488, /* 620 */ 90, 299, 324, 575, 457, 457, 390, 391, 390, 391, /* 630 */ 318, 525, 494, 318, 392, 393, 394, 518, 524, 431, /* 640 */ 241, 444, 450, 183, 477, 181, 571, 20, 324, 297, /* 650 */ 457, 457, 422, 28, 541, 422, 23, 505, 287, 339, /* 660 */ 60, 58, 295, 454, 455, 451, 451, 62, 62, 61, /* 670 */ 61, 61, 61, 318, 63, 63, 63, 63, 64, 64, /* 680 */ 65, 65, 65, 66, 444, 450, 421, 535, 354, 535, /* 690 */ 420, 259, 300, 505, 816, 422, 32, 74, 505, 76, /* 700 */ 188, 287, 505, 60, 58, 295, 454, 455, 451, 451, /* 710 */ 62, 62, 61, 61, 61, 61, 318, 63, 63, 63, /* 720 */ 63, 64, 64, 65, 65, 65, 66, 444, 450, 174, /* 730 */ 175, 176, 377, 216, 423, 480, 248, 301, 422, 53, /* 740 */ 505, 505, 259, 259, 287, 259, 60, 70, 295, 454, /* 750 */ 455, 451, 451, 62, 62, 61, 61, 61, 61, 365, /* 760 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 770 */ 444, 450, 247, 319, 244, 302, 304, 248, 167, 156, /* 780 */ 361, 248, 379, 260, 552, 259, 554, 287, 259, 219, /* 790 */ 58, 295, 454, 455, 451, 451, 62, 62, 61, 61, /* 800 */ 61, 61, 318, 63, 63, 63, 63, 64, 64, 65, /* 810 */ 65, 65, 66, 444, 450, 484, 432, 484, 22, 248, /* 820 */ 248, 207, 388, 364, 422, 24, 555, 364, 54, 556, /* 830 */ 309, 119, 437, 437, 295, 454, 455, 451, 451, 62, /* 840 */ 62, 61, 61, 61, 61, 318, 63, 63, 63, 63, /* 850 */ 64, 64, 65, 65, 65, 66, 71, 325, 318, 4, /* 860 */ 318, 537, 318, 293, 259, 536, 259, 422, 51, 318, /* 870 */ 161, 320, 71, 325, 318, 4, 355, 356, 305, 293, /* 880 */ 422, 96, 422, 93, 422, 98, 225, 320, 327, 217, /* 890 */ 115, 422, 99, 218, 190, 318, 422, 110, 226, 443, /* 900 */ 318, 259, 318, 417, 327, 272, 427, 372, 318, 5, /* 910 */ 418, 318, 413, 414, 330, 443, 318, 422, 111, 73, /* 920 */ 72, 197, 422, 16, 422, 97, 152, 71, 316, 317, /* 930 */ 422, 33, 426, 422, 94, 73, 72, 487, 422, 52, /* 940 */ 318, 200, 274, 71, 316, 317, 71, 325, 426, 4,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -