📄 parse.c
字号:
** parser's stack. Information stored includes:**** + The state number for the parser at this level of the stack.**** + The value of the token stored at this level of the stack.** (In other words, the "major" token.)**** + The semantic value stored at this level of the stack. This is** the information used by the action routines in the grammar.** It is sometimes called the "minor" token.*/struct yyStackEntry { int stateno; /* The state-number */ int major; /* The major token value. This is the code ** number for the token at this stack level */ YYMINORTYPE minor; /* The user-supplied minor token value. This ** is the value of the token */};typedef struct yyStackEntry yyStackEntry;/* The state of the parser is completely contained in an instance of** the following structure */struct yyParser { int yyidx; /* Index of top element in stack */ int yyerrcnt; /* Shifts left before out of the error */ sqlite3ParserARG_SDECL /* A place to hold %extra_argument */#if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */#else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */#endif};typedef struct yyParser yyParser;#ifndef NDEBUG#include <stdio.h>static FILE *yyTraceFILE = 0;static char *yyTracePrompt = 0;#endif /* NDEBUG */#ifndef NDEBUG/* ** Turn parser tracing on by giving a stream to which to write the trace** and a prompt to preface each trace message. Tracing is turned off** by making either argument NULL **** Inputs:** <ul>** <li> A FILE* to which trace output should be written.** If NULL, then tracing is turned off.** <li> A prefix string written at the beginning of every** line of trace output. If NULL, then tracing is** turned off.** </ul>**** Outputs:** None.*/void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){ yyTraceFILE = TraceFILE; yyTracePrompt = zTracePrompt; if( yyTraceFILE==0 ) yyTracePrompt = 0; else if( yyTracePrompt==0 ) yyTraceFILE = 0;}#endif /* NDEBUG */#ifndef NDEBUG/* For tracing shifts, the names of all terminals and nonterminals** are required. The following table supplies these names */static const char *const yyTokenName[] = { "$", "SEMI", "EXPLAIN", "QUERY", "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", "ROLLBACK", "CREATE", "TABLE", "IF", "NOT", "EXISTS", "TEMP", "LP", "RP", "AS", "COMMA", "ID", "ABORT", "AFTER", "ANALYZE", "ASC", "ATTACH", "BEFORE", "CASCADE", "CAST", "CONFLICT", "DATABASE", "DESC", "DETACH", "EACH", "FAIL", "FOR", "IGNORE", "INITIALLY", "INSTEAD", "LIKE_KW", "MATCH", "KEY", "OF", "OFFSET", "PRAGMA", "RAISE", "REPLACE", "RESTRICT", "ROW", "TRIGGER", "VACUUM", "VIEW", "VIRTUAL", "REINDEX", "RENAME", "CTIME_KW", "ANY", "OR", "AND", "IS", "BETWEEN", "IN", "ISNULL", "NOTNULL", "NE", "EQ", "GT", "LE", "LT", "GE", "ESCAPE", "BITAND", "BITOR", "LSHIFT", "RSHIFT", "PLUS", "MINUS", "STAR", "SLASH", "REM", "CONCAT", "COLLATE", "UMINUS", "UPLUS", "BITNOT", "STRING", "JOIN_KW", "CONSTRAINT", "DEFAULT", "NULL", "PRIMARY", "UNIQUE", "CHECK", "REFERENCES", "AUTOINCR", "ON", "DELETE", "UPDATE", "INSERT", "SET", "DEFERRABLE", "FOREIGN", "DROP", "UNION", "ALL", "EXCEPT", "INTERSECT", "SELECT", "DISTINCT", "DOT", "FROM", "JOIN", "USING", "ORDER", "BY", "GROUP", "HAVING", "LIMIT", "WHERE", "INTO", "VALUES", "INTEGER", "FLOAT", "BLOB", "REGISTER", "VARIABLE", "CASE", "WHEN", "THEN", "ELSE", "INDEX", "ALTER", "TO", "ADD", "COLUMNKW", "error", "input", "cmdlist", "ecmd", "cmdx", "cmd", "explain", "transtype", "trans_opt", "nm", "create_table", "create_table_args", "temp", "ifnotexists", "dbnm", "columnlist", "conslist_opt", "select", "column", "columnid", "type", "carglist", "id", "ids", "typetoken", "typename", "signed", "plus_num", "minus_num", "carg", "ccons", "term", "expr", "onconf", "sortorder", "autoinc", "idxlist_opt", "refargs", "defer_subclause", "refarg", "refact", "init_deferred_pred_opt", "conslist", "tcons", "idxlist", "defer_subclause_opt", "orconf", "resolvetype", "raisetype", "ifexists", "fullname", "oneselect", "multiselect_op", "distinct", "selcollist", "from", "where_opt", "groupby_opt", "having_opt", "orderby_opt", "limit_opt", "sclp", "as", "seltablist", "stl_prefix", "joinop", "on_opt", "using_opt", "seltablist_paren", "joinop2", "inscollist", "sortlist", "sortitem", "nexprlist", "setlist", "insert_cmd", "inscollist_opt", "itemlist", "exprlist", "likeop", "escape", "between_op", "in_op", "case_operand", "case_exprlist", "case_else", "uniqueflag", "idxitem", "collate", "nmnum", "plus_opt", "number", "trigger_decl", "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", "when_clause", "trigger_cmd", "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken", "lp", "anylist", };#endif /* NDEBUG */#ifndef NDEBUG/* For tracing reduce actions, the names of all rules are required.*/static const char *const yyRuleName[] = { /* 0 */ "input ::= cmdlist", /* 1 */ "cmdlist ::= cmdlist ecmd", /* 2 */ "cmdlist ::= ecmd", /* 3 */ "cmdx ::= cmd", /* 4 */ "ecmd ::= SEMI", /* 5 */ "ecmd ::= explain cmdx SEMI", /* 6 */ "explain ::=", /* 7 */ "explain ::= EXPLAIN", /* 8 */ "explain ::= EXPLAIN QUERY PLAN", /* 9 */ "cmd ::= BEGIN transtype trans_opt", /* 10 */ "trans_opt ::=", /* 11 */ "trans_opt ::= TRANSACTION", /* 12 */ "trans_opt ::= TRANSACTION nm", /* 13 */ "transtype ::=", /* 14 */ "transtype ::= DEFERRED", /* 15 */ "transtype ::= IMMEDIATE", /* 16 */ "transtype ::= EXCLUSIVE", /* 17 */ "cmd ::= COMMIT trans_opt", /* 18 */ "cmd ::= END trans_opt", /* 19 */ "cmd ::= ROLLBACK trans_opt", /* 20 */ "cmd ::= create_table create_table_args", /* 21 */ "create_table ::= CREATE temp TABLE ifnotexists nm dbnm", /* 22 */ "ifnotexists ::=", /* 23 */ "ifnotexists ::= IF NOT EXISTS", /* 24 */ "temp ::= TEMP", /* 25 */ "temp ::=", /* 26 */ "create_table_args ::= LP columnlist conslist_opt RP", /* 27 */ "create_table_args ::= AS select", /* 28 */ "columnlist ::= columnlist COMMA column", /* 29 */ "columnlist ::= column", /* 30 */ "column ::= columnid type carglist", /* 31 */ "columnid ::= nm", /* 32 */ "id ::= ID", /* 33 */ "ids ::= ID|STRING", /* 34 */ "nm ::= ID", /* 35 */ "nm ::= STRING", /* 36 */ "nm ::= JOIN_KW", /* 37 */ "type ::=", /* 38 */ "type ::= typetoken", /* 39 */ "typetoken ::= typename", /* 40 */ "typetoken ::= typename LP signed RP", /* 41 */ "typetoken ::= typename LP signed COMMA signed RP", /* 42 */ "typename ::= ids", /* 43 */ "typename ::= typename ids", /* 44 */ "signed ::= plus_num", /* 45 */ "signed ::= minus_num", /* 46 */ "carglist ::= carglist carg", /* 47 */ "carglist ::=", /* 48 */ "carg ::= CONSTRAINT nm ccons", /* 49 */ "carg ::= ccons", /* 50 */ "ccons ::= DEFAULT term", /* 51 */ "ccons ::= DEFAULT LP expr RP", /* 52 */ "ccons ::= DEFAULT PLUS term", /* 53 */ "ccons ::= DEFAULT MINUS term", /* 54 */ "ccons ::= DEFAULT id", /* 55 */ "ccons ::= NULL onconf", /* 56 */ "ccons ::= NOT NULL onconf", /* 57 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", /* 58 */ "ccons ::= UNIQUE onconf", /* 59 */ "ccons ::= CHECK LP expr RP", /* 60 */ "ccons ::= REFERENCES nm idxlist_opt refargs", /* 61 */ "ccons ::= defer_subclause", /* 62 */ "ccons ::= COLLATE ids", /* 63 */ "autoinc ::=", /* 64 */ "autoinc ::= AUTOINCR", /* 65 */ "refargs ::=", /* 66 */ "refargs ::= refargs refarg", /* 67 */ "refarg ::= MATCH nm", /* 68 */ "refarg ::= ON DELETE refact", /* 69 */ "refarg ::= ON UPDATE refact", /* 70 */ "refarg ::= ON INSERT refact", /* 71 */ "refact ::= SET NULL", /* 72 */ "refact ::= SET DEFAULT", /* 73 */ "refact ::= CASCADE", /* 74 */ "refact ::= RESTRICT", /* 75 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", /* 76 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", /* 77 */ "init_deferred_pred_opt ::=", /* 78 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", /* 79 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", /* 80 */ "conslist_opt ::=", /* 81 */ "conslist_opt ::= COMMA conslist", /* 82 */ "conslist ::= conslist COMMA tcons", /* 83 */ "conslist ::= conslist tcons", /* 84 */ "conslist ::= tcons", /* 85 */ "tcons ::= CONSTRAINT nm", /* 86 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", /* 87 */ "tcons ::= UNIQUE LP idxlist RP onconf", /* 88 */ "tcons ::= CHECK LP expr RP onconf", /* 89 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", /* 90 */ "defer_subclause_opt ::=", /* 91 */ "defer_subclause_opt ::= defer_subclause", /* 92 */ "onconf ::=", /* 93 */ "onconf ::= ON CONFLICT resolvetype", /* 94 */ "orconf ::=", /* 95 */ "orconf ::= OR resolvetype", /* 96 */ "resolvetype ::= raisetype", /* 97 */ "resolvetype ::= IGNORE", /* 98 */ "resolvetype ::= REPLACE", /* 99 */ "cmd ::= DROP TABLE ifexists fullname", /* 100 */ "ifexists ::= IF EXISTS", /* 101 */ "ifexists ::=", /* 102 */ "cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select", /* 103 */ "cmd ::= DROP VIEW ifexists fullname", /* 104 */ "cmd ::= select", /* 105 */ "select ::= oneselect", /* 106 */ "select ::= select multiselect_op oneselect", /* 107 */ "multiselect_op ::= UNION", /* 108 */ "multiselect_op ::= UNION ALL", /* 109 */ "multiselect_op ::= EXCEPT|INTERSECT", /* 110 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", /* 111 */ "distinct ::= DISTINCT", /* 112 */ "distinct ::= ALL", /* 113 */ "distinct ::=", /* 114 */ "sclp ::= selcollist COMMA", /* 115 */ "sclp ::=", /* 116 */ "selcollist ::= sclp expr as", /* 117 */ "selcollist ::= sclp STAR",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -