⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse.c

📁 这是一个开源的数据库系统,值得学习啊, 里面用了SQL语句,与微软的SQL SERVIER,差不了多少
💻 C
📖 第 1 页 / 共 5 页
字号:
/* 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"/*** 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 47 "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.  If**                       zero the stack is dynamically sized using realloc()**    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 59#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;#ifndef YYSTACKDEPTH#define YYSTACKDEPTH 100#endif#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 311#define YYERRORSYMBOL 138#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,  898,  122,  585,  407,  170,    2,  437,   61,   61, /*    10 */    61,   61,  517,   63,   63,   63,   63,   64,   64,   65, /*    20 */    65,   65,   66,  231,  445,  209,  422,  428,   68,   63, /*    30 */    63,   63,   63,   64,   64,   65,   65,   65,   66,  231, /*    40 */   389,  386,  394,  449,   60,   59,  295,  432,  433,  429, /*    50 */   429,   62,   62,   61,   61,   61,   61,  261,   63,   63, /*    60 */    63,   63,   64,   64,   65,   65,   65,   66,  231,  290, /*    70 */   491,  492,  437,  487,  206,   81,   67,  417,   69,  152, /*    80 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66, /*    90 */   231,   67,  460,   69,  152,  422,  428,  571,  262,   58, /*   100 */    64,   64,   65,   65,   65,   66,  231,  395,  396,  419, /*   110 */   419,  419,  290,   60,   59,  295,  432,  433,  429,  429, /*   120 */    62,   62,   61,   61,   61,   61,  315,   63,   63,   63, /*   130 */    63,   64,   64,   65,   65,   65,   66,  231,  422,  428, /*   140 */    93,   65,   65,   65,   66,  231,  394,  231,  412,   34, /*   150 */    56,  296,  440,  441,  408,  486,   60,   59,  295,  432, /*   160 */   433,  429,  429,   62,   62,   61,   61,   61,   61,  488, /*   170 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66, /*   180 */   231,  290,  255,  522,  293,  569,  112,  406,  520,  449, /*   190 */   329,  315,  405,   20,  437,  338,  517,  394,  530,  529, /*   200 */   503,  445,  209,  568,  567,  206,  528,  422,  428,  147, /*   210 */   148,  395,  396,  412,   41,  208,  149,  531,  370,  487, /*   220 */   259,  566,  257,  417,  290,   60,   59,  295,  432,  433, /*   230 */   429,  429,   62,   62,   61,   61,   61,   61,  315,   63, /*   240 */    63,   63,   63,   64,   64,   65,   65,   65,   66,  231, /*   250 */   422,  428,  445,  331,  212,  419,  419,  419,  361,  437, /*   260 */   412,   41,  395,  396,  364,  565,  208,  290,   60,   59, /*   270 */   295,  432,  433,  429,  429,   62,   62,   61,   61,   61, /*   280 */    61,  394,   63,   63,   63,   63,   64,   64,   65,   65, /*   290 */    65,   66,  231,  422,  428,  489,  298,  522,  472,   66, /*   300 */   231,  211,  472,  224,  409,  284,  532,   20,  447,  521, /*   310 */   166,   60,   59,  295,  432,  433,  429,  429,   62,   62, /*   320 */    61,   61,   61,   61,  472,   63,   63,   63,   63,   64, /*   330 */    64,   65,   65,   65,   66,  231,  207,  478,  315,   76, /*   340 */   290,  235,  298,   55,  482,  225,  395,  396,  179,  545, /*   350 */   492,  343,  346,  347,   67,  150,   69,  152,  337,  522, /*   360 */   412,   35,  348,  237,  249,  368,  422,  428,  576,   20, /*   370 */   162,  116,  239,  341,  244,  342,  174,  320,  440,  441, /*   380 */   412,    3,   79,  250,   60,   59,  295,  432,  433,  429, /*   390 */   429,   62,   62,   61,   61,   61,   61,  172,   63,   63, /*   400 */    63,   63,   64,   64,   65,   65,   65,   66,  231,  290, /*   410 */   249,  548,  232,  485,  508,  351,  315,  116,  239,  341, /*   420 */   244,  342,  174,  179,  315,  523,  343,  346,  347,  250, /*   430 */   218,  413,  153,  462,  509,  422,  428,  348,  412,   34, /*   440 */   463,  208,  175,  173,  158,  233,  412,   34,  336,  547, /*   450 */   447,  321,  166,   60,   59,  295,  432,  433,  429,  429, /*   460 */    62,   62,   61,   61,   61,   61,  413,   63,   63,   63, /*   470 */    63,   64,   64,   65,   65,   65,   66,  231,  290,  540, /*   480 */   333,  515,  502,  539,  454,  569,  300,   19,  329,  142, /*   490 */   315,  388,  315,  328,    2,  360,  455,  292,  481,  371, /*   500 */   267,  266,  250,  568,  422,  428,  586,  389,  386,  456, /*   510 */   206,  493,  412,   49,  412,   49,  301,  583,  889,  157, /*   520 */   889,  494,   60,   59,  295,  432,  433,  429,  429,   62, /*   530 */    62,   61,   61,   61,   61,  199,   63,   63,   63,   63, /*   540 */    64,   64,   65,   65,   65,   66,  231,  290,  315,  179, /*   550 */   436,  253,  343,  346,  347,  368,  151,  580,  306,  248, /*   560 */   307,  450,   75,  348,   77,  380,  208,  423,  424,  413, /*   570 */   412,   27,  317,  422,  428,  438,    1,   22,  583,  888, /*   580 */   394,  888,  542,  476,  318,  261,  435,  435,  426,  427, /*   590 */   413,   60,   59,  295,  432,  433,  429,  429,   62,   62, /*   600 */    61,   61,   61,   61,  326,   63,   63,   63,   63,   64, /*   610 */    64,   65,   65,   65,   66,  231,  290,  425,  580,  372, /*   620 */   219,   92,  515,    9,  334,  394,  555,  394,  454,   67, /*   630 */   394,   69,  152,  397,  398,  399,  318,  234,  435,  435, /*   640 */   455,  316,  422,  428,  297,  395,  396,  318,  430,  435, /*   650 */   435,  579,  289,  456,  220,  325,    5,  217,  544,  290, /*   660 */    60,   59,  295,  432,  433,  429,  429,   62,   62,   61, /*   670 */    61,   61,   61,  393,   63,   63,   63,   63,   64,   64, /*   680 */    65,   65,   65,   66,  231,  422,  428,  480,  311,  390, /*   690 */   395,  396,  395,  396,  205,  395,  396,  821,  271,  515, /*   700 */   248,  198,  290,   60,   59,  295,  432,  433,  429,  429, /*   710 */    62,   62,   61,   61,   61,   61,  468,   63,   63,   63, /*   720 */    63,   64,   64,   65,   65,   65,   66,  231,  422,  428, /*   730 */   169,  158,  261,  261,  302,  413,  274,  117,  272,  261, /*   740 */   515,  515,  261,  515,  190,  290,   60,   70,  295,  432, /*   750 */   433,  429,  429,   62,   62,   61,   61,   61,   61,  377, /*   760 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66, /*   770 */   231,  422,  428,  382,  557,  303,  304,  248,  413,  318, /*   780 */   558,  435,  435,  559,  538,  358,  538,  385,  290,  194, /*   790 */    59,  295,  432,  433,  429,  429,   62,   62,   61,   61, /*   800 */    61,   61,  369,   63,   63,   63,   63,   64,   64,   65, /*   810 */    65,   65,   66,  231,  422,  428,  394,  273,  248,  248, /*   820 */   170,  246,  437,  413,  384,  365,  176,  177,  178,  467, /*   830 */   309,  121,  154,  126,  295,  432,  433,  429,  429,   62, /*   840 */    62,   61,   61,   61,   61,  315,   63,   63,   63,   63, /*   850 */    64,   64,   65,   65,   65,   66,  231,   72,  322,  175, /*   860 */     4,  315,  261,  315,  294,  261,  413,  412,   28,  315, /*   870 */   261,  315,  319,   72,  322,  315,    4,  418,  443,  443, /*   880 */   294,  395,  396,  412,   23,  412,   32,  437,  319,  324, /*   890 */   327,  412,   53,  412,   52,  315,  156,  412,   97,  449,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -