📄 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 33 "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 241#define YYACTIONTYPE unsigned short int#define sqlite3ParserTOKENTYPE Tokentypedef union { sqlite3ParserTOKENTYPE yy0; Expr* yy2; struct {int value; int mask;} yy47; SrcList* yy67; ExprList* yy82; struct AttachKey yy132; struct TrigEvent yy210; IdList* yy240; struct LimitVal yy244; Token yy258; TriggerStep* yy347; int yy412; struct LikeOp yy438; Select* yy459; int yy481;} 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 565#define YYNRULE 305#define YYERRORSYMBOL 141#define YYERRSYMDT yy481#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 */ 259, 65, 257, 112, 114, 110, 116, 66, 122, 124, /* 10 */ 126, 128, 130, 132, 134, 136, 138, 140, 568, 142, /* 20 */ 150, 122, 124, 126, 128, 130, 132, 134, 136, 138, /* 30 */ 140, 130, 132, 134, 136, 138, 140, 108, 94, 143, /* 40 */ 153, 158, 163, 152, 157, 118, 120, 112, 114, 110, /* 50 */ 116, 72, 122, 124, 126, 128, 130, 132, 134, 136, /* 60 */ 138, 140, 7, 106, 219, 258, 122, 124, 126, 128, /* 70 */ 130, 132, 134, 136, 138, 140, 367, 13, 9, 369, /* 80 */ 376, 381, 142, 871, 1, 564, 92, 27, 4, 399, /* 90 */ 363, 384, 844, 341, 291, 28, 10, 95, 398, 33, /* 100 */ 108, 94, 143, 153, 158, 163, 152, 157, 118, 120, /* 110 */ 112, 114, 110, 116, 96, 122, 124, 126, 128, 130, /* 120 */ 132, 134, 136, 138, 140, 456, 565, 142, 395, 305, /* 130 */ 101, 102, 103, 288, 75, 394, 3, 563, 231, 275, /* 140 */ 14, 15, 575, 597, 437, 108, 94, 143, 153, 158, /* 150 */ 163, 152, 157, 118, 120, 112, 114, 110, 116, 13, /* 160 */ 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, /* 170 */ 573, 77, 142, 223, 232, 13, 490, 462, 452, 167, /* 180 */ 306, 169, 170, 276, 254, 3, 563, 81, 277, 183, /* 190 */ 108, 94, 143, 153, 158, 163, 152, 157, 118, 120, /* 200 */ 112, 114, 110, 116, 52, 122, 124, 126, 128, 130, /* 210 */ 132, 134, 136, 138, 140, 48, 54, 799, 448, 51, /* 220 */ 797, 77, 14, 15, 49, 363, 134, 136, 138, 140, /* 230 */ 16, 17, 18, 32, 33, 50, 308, 197, 14, 15, /* 240 */ 367, 261, 13, 369, 376, 381, 142, 37, 337, 40, /* 250 */ 59, 67, 69, 301, 332, 384, 364, 397, 259, 807, /* 260 */ 257, 334, 51, 193, 108, 94, 143, 153, 158, 163, /* 270 */ 152, 157, 118, 120, 112, 114, 110, 116, 262, 122, /* 280 */ 124, 126, 128, 130, 132, 134, 136, 138, 140, 13, /* 290 */ 171, 142, 40, 59, 67, 69, 301, 332, 642, 148, /* 300 */ 365, 159, 164, 261, 334, 14, 15, 44, 45, 108, /* 310 */ 94, 143, 153, 158, 163, 152, 157, 118, 120, 112, /* 320 */ 114, 110, 116, 258, 122, 124, 126, 128, 130, 132, /* 330 */ 134, 136, 138, 140, 148, 218, 159, 164, 184, 12, /* 340 */ 284, 417, 48, 360, 358, 293, 290, 347, 352, 353, /* 350 */ 289, 49, 14, 15, 688, 2, 96, 148, 4, 159, /* 360 */ 164, 257, 50, 530, 46, 142, 367, 155, 165, 369, /* 370 */ 376, 381, 13, 576, 47, 167, 75, 169, 170, 554, /* 380 */ 172, 384, 207, 108, 94, 143, 153, 158, 163, 152, /* 390 */ 157, 118, 120, 112, 114, 110, 116, 154, 122, 124, /* 400 */ 126, 128, 130, 132, 134, 136, 138, 140, 299, 354, /* 410 */ 350, 352, 353, 96, 96, 13, 34, 20, 294, 362, /* 420 */ 345, 144, 581, 167, 258, 169, 170, 821, 142, 558, /* 430 */ 213, 244, 254, 75, 75, 14, 15, 172, 186, 167, /* 440 */ 533, 169, 170, 146, 147, 417, 108, 94, 143, 153, /* 450 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, /* 460 */ 96, 122, 124, 126, 128, 130, 132, 134, 136, 138, /* 470 */ 140, 145, 354, 142, 22, 239, 383, 589, 14, 15, /* 480 */ 75, 36, 336, 419, 172, 187, 842, 213, 528, 582, /* 490 */ 331, 108, 94, 143, 153, 158, 163, 152, 157, 118, /* 500 */ 120, 112, 114, 110, 116, 249, 122, 124, 126, 128, /* 510 */ 130, 132, 134, 136, 138, 140, 306, 661, 142, 327, /* 520 */ 574, 849, 148, 11, 159, 164, 309, 316, 318, 168, /* 530 */ 42, 327, 666, 327, 212, 393, 108, 94, 143, 153, /* 540 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, /* 550 */ 96, 122, 124, 126, 128, 130, 132, 134, 136, 138, /* 560 */ 140, 847, 83, 142, 321, 641, 372, 31, 663, 282, /* 570 */ 75, 242, 308, 689, 231, 246, 167, 334, 169, 170, /* 580 */ 269, 108, 94, 143, 153, 158, 163, 152, 157, 118, /* 590 */ 120, 112, 114, 110, 116, 324, 122, 124, 126, 128, /* 600 */ 130, 132, 134, 136, 138, 140, 246, 328, 142, 328, /* 610 */ 225, 434, 24, 39, 433, 210, 167, 211, 169, 170, /* 620 */ 167, 331, 169, 170, 583, 435, 108, 161, 143, 153, /* 630 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, /* 640 */ 248, 122, 124, 126, 128, 130, 132, 134, 136, 138, /* 650 */ 140, 57, 58, 142, 624, 837, 323, 727, 271, 261, /* 660 */ 167, 243, 169, 170, 313, 312, 247, 167, 798, 169, /* 670 */ 170, 248, 94, 143, 153, 158, 163, 152, 157, 118, /* 680 */ 120, 112, 114, 110, 116, 96, 122, 124, 126, 128, /* 690 */ 130, 132, 134, 136, 138, 140, 279, 247, 142, 360, /* 700 */ 358, 6, 5, 363, 346, 75, 274, 25, 257, 489, /* 710 */ 13, 561, 33, 503, 13, 268, 267, 269, 143, 153, /* 720 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, /* 730 */ 64, 122, 124, 126, 128, 130, 132, 134, 136, 138, /* 740 */ 140, 26, 76, 96, 400, 77, 71, 584, 96, 451,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -