📄 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 54 "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 240#define YYACTIONTYPE unsigned short int#define sqlite3ParserTOKENTYPE Tokentypedef union { sqlite3ParserTOKENTYPE yy0; struct {int value; int mask;} yy13; struct TrigEvent yy132; IdList* yy160; Expr* yy178; int yy230; Select* yy239; TriggerStep* yy247; struct LimitVal yy270; SrcList* yy285; Expr * yy292; Token yy384; struct LikeOp yy440; ExprList* yy462; int yy479;} 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 559#define YYNRULE 295#define YYERRORSYMBOL 137#define YYERRSYMDT yy479#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 */ 279, 67, 283, 69, 147, 165, 545, 418, 61, 61, /* 10 */ 61, 61, 201, 63, 63, 63, 63, 64, 64, 65, /* 20 */ 65, 65, 66, 66, 547, 548, 431, 68, 63, 63, /* 30 */ 63, 63, 64, 64, 65, 65, 65, 66, 67, 453, /* 40 */ 69, 147, 498, 60, 58, 287, 439, 440, 436, 436, /* 50 */ 62, 62, 61, 61, 61, 61, 500, 63, 63, 63, /* 60 */ 63, 64, 64, 65, 65, 65, 66, 279, 370, 283, /* 70 */ 418, 2, 376, 79, 157, 114, 219, 304, 224, 305, /* 80 */ 169, 244, 855, 118, 558, 503, 203, 2, 245, 388, /* 90 */ 495, 218, 21, 431, 513, 20, 418, 57, 492, 511, /* 100 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 110 */ 60, 58, 287, 439, 440, 436, 436, 62, 62, 61, /* 120 */ 61, 61, 61, 530, 63, 63, 63, 63, 64, 64, /* 130 */ 65, 65, 65, 66, 279, 377, 378, 174, 371, 368, /* 140 */ 330, 333, 334, 219, 304, 224, 305, 169, 244, 510, /* 150 */ 479, 19, 335, 138, 376, 245, 509, 301, 372, 418, /* 160 */ 431, 529, 91, 199, 65, 65, 65, 66, 504, 167, /* 170 */ 191, 64, 64, 65, 65, 65, 66, 60, 58, 287, /* 180 */ 439, 440, 436, 436, 62, 62, 61, 61, 61, 61, /* 190 */ 254, 63, 63, 63, 63, 64, 64, 65, 65, 65, /* 200 */ 66, 279, 250, 410, 410, 430, 109, 395, 426, 204, /* 210 */ 357, 260, 259, 308, 145, 168, 153, 377, 378, 396, /* 220 */ 327, 201, 67, 189, 69, 147, 225, 431, 546, 361, /* 230 */ 465, 365, 397, 499, 318, 409, 40, 413, 428, 312, /* 240 */ 161, 180, 550, 178, 60, 58, 287, 439, 440, 436, /* 250 */ 436, 62, 62, 61, 61, 61, 61, 410, 63, 63, /* 260 */ 63, 63, 64, 64, 65, 65, 65, 66, 279, 471, /* 270 */ 415, 415, 415, 282, 308, 322, 235, 426, 204, 308, /* 280 */ 174, 367, 308, 330, 333, 334, 67, 308, 69, 147, /* 290 */ 148, 559, 371, 368, 431, 335, 409, 34, 165, 465, /* 300 */ 418, 409, 34, 275, 409, 34, 428, 502, 161, 409, /* 310 */ 35, 60, 58, 287, 439, 440, 436, 436, 62, 62, /* 320 */ 61, 61, 61, 61, 410, 63, 63, 63, 63, 64, /* 330 */ 64, 65, 65, 65, 66, 308, 503, 395, 237, 290, /* 340 */ 279, 391, 392, 146, 324, 387, 20, 288, 347, 396, /* 350 */ 174, 450, 350, 330, 333, 334, 450, 409, 27, 450, /* 360 */ 474, 231, 397, 418, 393, 335, 431, 501, 354, 144, /* 370 */ 512, 503, 524, 232, 394, 465, 496, 410, 527, 392, /* 380 */ 555, 20, 75, 60, 58, 287, 439, 440, 436, 436, /* 390 */ 62, 62, 61, 61, 61, 61, 220, 63, 63, 63, /* 400 */ 63, 64, 64, 65, 65, 65, 66, 308, 221, 185, /* 410 */ 338, 254, 279, 308, 239, 443, 475, 308, 319, 308, /* 420 */ 389, 444, 286, 421, 422, 379, 380, 381, 492, 409, /* 430 */ 34, 311, 421, 422, 212, 409, 48, 170, 431, 409, /* 440 */ 40, 409, 48, 410, 122, 314, 526, 442, 442, 1, /* 450 */ 376, 469, 255, 376, 78, 60, 58, 287, 439, 440, /* 460 */ 436, 436, 62, 62, 61, 61, 61, 61, 355, 63, /* 470 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 279, /* 480 */ 233, 152, 298, 478, 449, 203, 792, 192, 299, 351, /* 490 */ 376, 281, 376, 9, 203, 376, 245, 376, 201, 432, /* 500 */ 314, 376, 442, 442, 490, 431, 314, 325, 442, 442, /* 510 */ 418, 356, 289, 377, 378, 354, 377, 378, 403, 434, /* 520 */ 435, 410, 60, 58, 287, 439, 440, 436, 436, 62, /* 530 */ 62, 61, 61, 61, 61, 263, 63, 63, 63, 63, /* 540 */ 64, 64, 65, 65, 65, 66, 279, 433, 328, 236, /* 550 */ 497, 473, 490, 377, 378, 377, 378, 484, 377, 378, /* 560 */ 377, 378, 308, 522, 377, 378, 314, 521, 442, 442, /* 570 */ 409, 3, 431, 418, 130, 254, 264, 485, 309, 346, /* 580 */ 461, 213, 462, 242, 409, 28, 469, 292, 214, 60, /* 590 */ 58, 287, 439, 440, 436, 436, 62, 62, 61, 61, /* 600 */ 61, 61, 308, 63, 63, 63, 63, 64, 64, 65, /* 610 */ 65, 65, 66, 279, 308, 458, 536, 248, 5, 308, /* 620 */ 201, 308, 469, 308, 409, 23, 308, 202, 291, 308, /* 630 */ 375, 243, 308, 362, 54, 115, 409, 32, 74, 431, /* 640 */ 76, 409, 53, 409, 24, 409, 51, 345, 409, 96, /* 650 */ 149, 409, 93, 265, 409, 98, 60, 58, 287, 439, /* 660 */ 440, 436, 436, 62, 62, 61, 61, 61, 61, 308, /* 670 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 680 */ 279, 308, 404, 297, 410, 90, 308, 176, 308, 405, /* 690 */ 308, 409, 99, 308, 419, 308, 22, 308, 520, 344, /* 700 */ 520, 164, 153, 409, 110, 141, 431, 313, 409, 111, /* 710 */ 409, 16, 409, 97, 254, 409, 33, 409, 94, 409, /* 720 */ 52, 410, 187, 60, 58, 287, 439, 440, 436, 436, /* 730 */ 62, 62, 61, 61, 61, 61, 308, 63, 63, 63, /* 740 */ 63, 64, 64, 65, 65, 65, 66, 279, 308, 490, /* 750 */ 490, 414, 308, 320, 308, 538, 308, 460, 409, 112, /* 760 */ 308, 171, 172, 173, 308, 408, 308, 424, 424, 407, /* 770 */ 409, 113, 427, 431, 409, 25, 409, 36, 409, 37, /* 780 */ 170, 437, 409, 26, 211, 293, 409, 38, 409, 39, /* 790 */ 60, 58, 287, 439, 440, 436, 436, 62, 62, 61, /* 800 */ 61, 61, 61, 308, 63, 63, 63, 63, 64, 64, /* 810 */ 65, 65, 65, 66, 279, 308, 490, 490, 451, 308, /* 820 */ 81, 308, 151, 308, 459, 409, 41, 308, 243, 243, /* 830 */ 400, 401, 308, 448, 281, 12, 464, 409, 42, 468, /* 840 */ 431, 409, 43, 409, 29, 409, 30, 241, 460, 409, /* 850 */ 44, 294, 296, 480, 409, 45, 329, 60, 70, 287, /* 860 */ 439, 440, 436, 436, 62, 62, 61, 61, 61, 61, /* 870 */ 308, 63, 63, 63, 63, 64, 64, 65, 65, 65, /* 880 */ 66, 279, 308, 408, 483, 482, 308, 407, 308, 467, /* 890 */ 308, 166, 409, 46, 308, 243, 243, 476, 488, 12, /* 900 */ 122, 518, 519, 179, 409, 47, 481, 431, 409, 31, /* 910 */ 409, 10, 409, 49, 505, 486, 409, 50, 254, 249, /* 920 */ 254, 254, 254, 158, 279, 58, 287, 439, 440, 436, /* 930 */ 436, 62, 62, 61, 61, 61, 61, 410, 63, 63, /* 940 */ 63, 63, 64, 64, 65, 65, 65, 66, 487, 247, /* 950 */ 431, 122, 254, 337, 525, 122, 122, 251, 533, 539, /* 960 */ 166, 540, 266, 360, 534, 543, 88, 88, 252, 287, /* 970 */ 439, 440, 436, 436, 62, 62, 61, 61, 61, 61, /* 980 */ 195, 63, 63, 63, 63, 64, 64, 65, 65, 65, /* 990 */ 66, 71, 315, 268, 4, 253, 182, 258, 285, 349, /* 1000 */ 342, 352, 353, 261, 262, 544, 310, 71, 315, 269,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -