📄 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 586#define YYNRULE 310#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 */ 290, 67, 294, 69, 150, 168, 206, 435, 61, 61, /* 10 */ 61, 61, 66, 63, 63, 63, 63, 64, 64, 65, /* 20 */ 65, 65, 66, 445, 325, 164, 448, 454, 68, 63, /* 30 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 64, /* 40 */ 64, 65, 65, 65, 66, 60, 58, 298, 458, 459, /* 50 */ 455, 455, 62, 62, 61, 61, 61, 61, 517, 63, /* 60 */ 63, 63, 63, 64, 64, 65, 65, 65, 66, 290, /* 70 */ 321, 67, 435, 69, 150, 79, 160, 114, 224, 317, /* 80 */ 229, 318, 172, 249, 897, 120, 585, 519, 522, 2, /* 90 */ 250, 571, 426, 35, 223, 448, 454, 532, 20, 57, /* 100 */ 388, 385, 63, 63, 63, 63, 64, 64, 65, 65, /* 110 */ 65, 66, 290, 477, 60, 58, 298, 458, 459, 455, /* 120 */ 455, 62, 62, 61, 61, 61, 61, 393, 63, 63, /* 130 */ 63, 63, 64, 64, 65, 65, 65, 66, 448, 454, /* 140 */ 91, 314, 389, 484, 236, 387, 271, 204, 2, 83, /* 150 */ 586, 388, 385, 474, 196, 443, 209, 60, 58, 298, /* 160 */ 458, 459, 455, 455, 62, 62, 61, 61, 61, 61, /* 170 */ 170, 63, 63, 63, 63, 64, 64, 65, 65, 65, /* 180 */ 66, 290, 490, 443, 209, 274, 109, 272, 427, 447, /* 190 */ 406, 284, 394, 395, 445, 521, 164, 321, 511, 67, /* 200 */ 530, 69, 150, 567, 427, 143, 520, 448, 454, 145, /* 210 */ 146, 583, 888, 376, 888, 515, 171, 156, 518, 426, /* 220 */ 40, 340, 430, 19, 290, 140, 60, 58, 298, 458, /* 230 */ 459, 455, 455, 62, 62, 61, 61, 61, 61, 384, /* 240 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 250 */ 448, 454, 580, 408, 409, 432, 432, 432, 332, 335, /* 260 */ 240, 549, 67, 472, 69, 150, 273, 290, 294, 60, /* 270 */ 58, 298, 458, 459, 455, 455, 62, 62, 61, 61, /* 280 */ 61, 61, 124, 63, 63, 63, 63, 64, 64, 65, /* 290 */ 65, 65, 66, 448, 454, 405, 514, 393, 293, 548, /* 300 */ 65, 65, 65, 66, 511, 393, 546, 409, 447, 297, /* 310 */ 438, 439, 60, 58, 298, 458, 459, 455, 455, 62, /* 320 */ 62, 61, 61, 61, 61, 206, 63, 63, 63, 63, /* 330 */ 64, 64, 65, 65, 65, 66, 523, 518, 369, 290, /* 340 */ 75, 430, 148, 494, 224, 317, 229, 318, 172, 249, /* 350 */ 370, 267, 266, 1, 579, 289, 250, 393, 420, 449, /* 360 */ 450, 206, 394, 395, 177, 448, 454, 343, 346, 347, /* 370 */ 394, 395, 208, 360, 432, 432, 432, 363, 168, 348, /* 380 */ 435, 452, 453, 78, 60, 58, 298, 458, 459, 455, /* 390 */ 455, 62, 62, 61, 61, 61, 61, 480, 63, 63, /* 400 */ 63, 63, 64, 64, 65, 65, 65, 66, 290, 451, /* 410 */ 177, 566, 497, 343, 346, 347, 21, 321, 522, 321, /* 420 */ 435, 321, 394, 395, 321, 348, 479, 404, 20, 568, /* 430 */ 569, 493, 151, 177, 448, 454, 343, 346, 347, 426, /* 440 */ 34, 426, 34, 426, 34, 435, 426, 34, 348, 197, /* 450 */ 237, 147, 531, 60, 58, 298, 458, 459, 455, 455, /* 460 */ 62, 62, 61, 61, 61, 61, 427, 63, 63, 63, /* 470 */ 63, 64, 64, 65, 65, 65, 66, 290, 230, 351, /* 480 */ 412, 516, 301, 427, 337, 435, 321, 155, 321, 299, /* 490 */ 321, 208, 413, 154, 469, 9, 469, 462, 468, 393, /* 500 */ 74, 469, 76, 448, 454, 414, 173, 410, 426, 40, /* 510 */ 426, 48, 426, 48, 324, 438, 439, 411, 327, 479, /* 520 */ 461, 461, 60, 58, 298, 458, 459, 455, 455, 62, /* 530 */ 62, 61, 61, 61, 61, 463, 63, 63, 63, 63, /* 540 */ 64, 64, 65, 65, 65, 66, 290, 321, 503, 238, /* 550 */ 253, 484, 393, 341, 412, 149, 425, 309, 338, 310, /* 560 */ 424, 393, 292, 393, 394, 395, 413, 250, 504, 426, /* 570 */ 27, 241, 448, 454, 435, 426, 3, 208, 543, 414, /* 580 */ 322, 331, 583, 887, 327, 887, 461, 461, 488, 427, /* 590 */ 242, 60, 58, 298, 458, 459, 455, 455, 62, 62, /* 600 */ 61, 61, 61, 61, 255, 63, 63, 63, 63, 64, /* 610 */ 64, 65, 65, 65, 66, 290, 371, 394, 395, 492, /* 620 */ 90, 302, 327, 580, 461, 461, 394, 395, 394, 395, /* 630 */ 321, 529, 498, 321, 396, 397, 398, 522, 528, 435, /* 640 */ 219, 448, 454, 259, 481, 257, 576, 20, 327, 300, /* 650 */ 461, 461, 426, 28, 545, 426, 23, 509, 290, 342, /* 660 */ 60, 58, 298, 458, 459, 455, 455, 62, 62, 61, /* 670 */ 61, 61, 61, 321, 63, 63, 63, 63, 64, 64, /* 680 */ 65, 65, 65, 66, 448, 454, 425, 539, 357, 539, /* 690 */ 424, 261, 303, 509, 822, 426, 32, 436, 509, 22, /* 700 */ 188, 290, 509, 60, 58, 298, 458, 459, 455, 455, /* 710 */ 62, 62, 61, 61, 61, 61, 321, 63, 63, 63, /* 720 */ 63, 64, 64, 65, 65, 65, 66, 448, 454, 174, /* 730 */ 175, 176, 381, 216, 427, 484, 248, 304, 426, 53, /* 740 */ 509, 509, 261, 261, 290, 261, 60, 70, 298, 458, /* 750 */ 459, 455, 455, 62, 62, 61, 61, 61, 61, 368, /* 760 */ 63, 63, 63, 63, 64, 64, 65, 65, 65, 66, /* 770 */ 448, 454, 247, 392, 244, 305, 307, 248, 167, 156, /* 780 */ 364, 248, 383, 262, 556, 261, 558, 290, 261, 115, /* 790 */ 58, 298, 458, 459, 455, 455, 62, 62, 61, 61, /* 800 */ 61, 61, 321, 63, 63, 63, 63, 64, 64, 65, /* 810 */ 65, 65, 66, 448, 454, 488, 467, 488, 12, 248, /* 820 */ 248, 207, 5, 367, 426, 24, 559, 367, 54, 560, /* 830 */ 312, 119, 441, 441, 298, 458, 459, 455, 455, 62, /* 840 */ 62, 61, 61, 61, 61, 321, 63, 63, 63, 63, /* 850 */ 64, 64, 65, 65, 65, 66, 71, 328, 321, 4, /* 860 */ 321, 541, 321, 296, 261, 540, 261, 426, 51, 321, /* 870 */ 161, 323, 71, 328, 321, 4, 358, 359, 308, 296, /* 880 */ 426, 96, 426, 93, 426, 98, 225, 323, 330, 217, /* 890 */ 431, 426, 99, 218, 444, 321, 426, 110, 226, 447, /* 900 */ 321, 261, 321, 421, 330, 275, 190, 375, 321, 333, /* 910 */ 422, 321, 417, 418, 470, 447, 321, 426, 111, 73, /* 920 */ 72, 192, 426, 16, 426, 97, 152, 71, 319, 320, /* 930 */ 426, 33, 430, 426, 94, 73, 72, 491, 426, 52, /* 940 */ 321, 478, 277, 71, 319, 320, 71, 328, 430, 4,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -