📄 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 51 "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 operator; /* "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 247#define YYACTIONTYPE unsigned short int#define sqlite3ParserTOKENTYPE Tokentypedef union { sqlite3ParserTOKENTYPE yy0; struct TrigEvent yy30; Expr* yy62; SrcList* yy151; Token yy198; struct LimitVal yy220; struct LikeOp yy222; IdList* yy240; int yy280; struct {int value; int mask;} yy359; TriggerStep* yy360; struct AttachKey yy361; Select* yy375; ExprList* yy418; int yy493;} 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 311#define YYERRORSYMBOL 146#define YYERRSYMDT yy493#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 */ 286, 584, 113, 140, 142, 138, 144, 581, 150, 152, /* 10 */ 154, 156, 158, 160, 162, 164, 166, 168, 3, 577, /* 20 */ 740, 170, 178, 150, 152, 154, 156, 158, 160, 162, /* 30 */ 164, 166, 168, 158, 160, 162, 164, 166, 168, 135, /* 40 */ 97, 171, 181, 186, 191, 180, 185, 146, 148, 140, /* 50 */ 142, 138, 144, 51, 150, 152, 154, 156, 158, 160, /* 60 */ 162, 164, 166, 168, 16, 17, 18, 114, 7, 248, /* 70 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, /* 80 */ 13, 37, 362, 40, 59, 67, 69, 326, 357, 170, /* 90 */ 6, 5, 331, 95, 364, 359, 25, 374, 258, 893, /* 100 */ 1, 580, 514, 13, 4, 575, 33, 135, 97, 171, /* 110 */ 181, 186, 191, 180, 185, 146, 148, 140, 142, 138, /* 120 */ 144, 9, 150, 152, 154, 156, 158, 160, 162, 164, /* 130 */ 166, 168, 374, 136, 592, 80, 112, 99, 269, 34, /* 140 */ 32, 33, 132, 373, 115, 14, 15, 378, 333, 99, /* 150 */ 380, 387, 392, 13, 367, 370, 194, 170, 78, 500, /* 160 */ 525, 315, 395, 369, 375, 408, 10, 98, 14, 15, /* 170 */ 78, 200, 286, 864, 113, 135, 97, 171, 181, 186, /* 180 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 80, /* 190 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, /* 200 */ 104, 105, 106, 661, 496, 376, 374, 170, 467, 13, /* 210 */ 2, 28, 237, 4, 409, 33, 3, 577, 14, 15, /* 220 */ 51, 132, 133, 115, 241, 135, 97, 171, 181, 186, /* 230 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 114, /* 240 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, /* 250 */ 40, 59, 67, 69, 326, 357, 136, 44, 45, 501, /* 260 */ 473, 463, 359, 36, 361, 130, 128, 660, 275, 31, /* 270 */ 84, 99, 356, 378, 14, 15, 380, 387, 392, 52, /* 280 */ 170, 117, 122, 123, 113, 541, 369, 643, 395, 348, /* 290 */ 98, 54, 78, 200, 302, 57, 58, 819, 135, 97, /* 300 */ 171, 181, 186, 191, 180, 185, 146, 148, 140, 142, /* 310 */ 138, 144, 861, 150, 152, 154, 156, 158, 160, 162, /* 320 */ 164, 166, 168, 104, 105, 106, 817, 80, 48, 316, /* 330 */ 162, 164, 166, 168, 319, 277, 12, 49, 99, 303, /* 340 */ 283, 818, 99, 124, 304, 99, 241, 172, 593, 114, /* 350 */ 50, 193, 46, 378, 170, 13, 380, 387, 392, 78, /* 360 */ 260, 276, 47, 78, 200, 64, 78, 260, 395, 174, /* 370 */ 175, 221, 135, 97, 171, 181, 186, 191, 180, 185, /* 380 */ 146, 148, 140, 142, 138, 144, 199, 150, 152, 154, /* 390 */ 156, 158, 160, 162, 164, 166, 168, 173, 252, 261, /* 400 */ 120, 122, 123, 212, 170, 268, 254, 130, 128, 288, /* 410 */ 590, 176, 246, 187, 192, 414, 195, 241, 197, 198, /* 420 */ 14, 15, 135, 97, 171, 181, 186, 191, 180, 185, /* 430 */ 146, 148, 140, 142, 138, 144, 433, 150, 152, 154, /* 440 */ 156, 158, 160, 162, 164, 166, 168, 311, 99, 707, /* 450 */ 99, 422, 708, 417, 275, 81, 318, 598, 99, 219, /* 460 */ 13, 231, 124, 13, 176, 48, 187, 192, 20, 78, /* 470 */ 317, 78, 214, 195, 49, 197, 198, 462, 170, 78, /* 480 */ 200, 116, 27, 13, 410, 113, 591, 50, 80, 225, /* 490 */ 195, 11, 197, 198, 506, 235, 135, 97, 171, 181, /* 500 */ 186, 191, 180, 185, 146, 148, 140, 142, 138, 144, /* 510 */ 80, 150, 152, 154, 156, 158, 160, 162, 164, 166, /* 520 */ 168, 277, 215, 324, 606, 14, 15, 301, 14, 15, /* 530 */ 512, 13, 508, 240, 196, 486, 195, 685, 197, 198, /* 540 */ 22, 834, 445, 331, 462, 170, 444, 276, 14, 15, /* 550 */ 114, 468, 278, 394, 599, 280, 470, 288, 446, 680, /* 560 */ 13, 321, 404, 135, 97, 171, 181, 186, 191, 180, /* 570 */ 185, 146, 148, 140, 142, 138, 144, 80, 150, 152, /* 580 */ 154, 156, 158, 160, 162, 164, 166, 168, 74, 99, /* 590 */ 540, 366, 73, 99, 352, 289, 14, 15, 176, 333, /* 600 */ 187, 192, 486, 869, 359, 273, 283, 542, 543, 867, /* 610 */ 78, 500, 510, 170, 78, 323, 682, 176, 472, 187, /* 620 */ 192, 746, 118, 470, 119, 14, 15, 195, 346, 197, /* 630 */ 198, 135, 97, 171, 181, 186, 191, 180, 185, 146, /* 640 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, /* 650 */ 158, 160, 162, 164, 166, 168, 532, 334, 341, 343, /* 660 */ 841, 39, 195, 170, 197, 198, 78, 94, 124, 356, /* 670 */ 271, 353, 439, 441, 440, 544, 883, 428, 72, 862, /* 680 */ 288, 135, 97, 171, 181, 186, 191, 180, 185, 146, /* 690 */ 148, 140, 142, 138, 144, 13, 150, 152, 154, 156, /* 700 */ 158, 160, 162, 164, 166, 168, 195, 99, 197, 198,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -