parse.c.svn-base
上传用户:sunhongbo
上传日期:2022-01-25
资源大小:3010k
文件大小:130k
- { 170, 2 },
- { 170, 2 },
- { 170, 2 },
- { 170, 2 },
- { 219, 1 },
- { 219, 2 },
- { 170, 5 },
- { 220, 1 },
- { 220, 2 },
- { 170, 5 },
- { 170, 3 },
- { 170, 5 },
- { 170, 4 },
- { 170, 4 },
- { 170, 5 },
- { 222, 5 },
- { 222, 4 },
- { 223, 2 },
- { 223, 0 },
- { 221, 1 },
- { 221, 0 },
- { 216, 1 },
- { 216, 0 },
- { 211, 3 },
- { 211, 1 },
- { 143, 11 },
- { 224, 1 },
- { 224, 0 },
- { 174, 0 },
- { 174, 3 },
- { 182, 5 },
- { 182, 3 },
- { 225, 1 },
- { 226, 0 },
- { 226, 2 },
- { 143, 4 },
- { 143, 1 },
- { 143, 2 },
- { 143, 5 },
- { 143, 5 },
- { 143, 5 },
- { 143, 6 },
- { 143, 3 },
- { 227, 1 },
- { 227, 1 },
- { 165, 2 },
- { 166, 2 },
- { 229, 1 },
- { 228, 1 },
- { 228, 0 },
- { 143, 5 },
- { 230, 11 },
- { 232, 1 },
- { 232, 1 },
- { 232, 2 },
- { 232, 0 },
- { 233, 1 },
- { 233, 1 },
- { 233, 3 },
- { 234, 0 },
- { 234, 3 },
- { 235, 0 },
- { 235, 2 },
- { 231, 3 },
- { 231, 0 },
- { 236, 6 },
- { 236, 8 },
- { 236, 5 },
- { 236, 4 },
- { 236, 1 },
- { 170, 4 },
- { 170, 6 },
- { 186, 1 },
- { 186, 1 },
- { 186, 1 },
- { 143, 4 },
- { 143, 6 },
- { 143, 3 },
- { 238, 0 },
- { 238, 2 },
- { 237, 1 },
- { 237, 0 },
- { 143, 1 },
- { 143, 3 },
- { 143, 1 },
- { 143, 3 },
- { 143, 6 },
- { 143, 6 },
- { 239, 1 },
- { 240, 0 },
- { 240, 1 },
- { 143, 1 },
- { 143, 4 },
- { 241, 7 },
- { 242, 1 },
- { 242, 3 },
- { 243, 0 },
- { 243, 2 },
- { 244, 1 },
- { 244, 3 },
- { 245, 1 },
- { 246, 0 },
- { 246, 2 },
- };
- static void yy_accept(yyParser*); /* Forward Declaration */
- /*
- ** Perform a reduce action and the shift that must immediately
- ** follow the reduce.
- */
- static void yy_reduce(
- yyParser *yypParser, /* The parser */
- int yyruleno /* Number of the rule by which to reduce */
- ){
- int yygoto; /* The next state */
- int yyact; /* The next action */
- YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
- yyStackEntry *yymsp; /* The top of the parser's stack */
- int yysize; /* Amount to pop the stack */
- sqlite3ParserARG_FETCH;
- yymsp = &yypParser->yystack[yypParser->yyidx];
- #ifndef NDEBUG
- if( yyTraceFILE && yyruleno>=0
- && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
- fprintf(yyTraceFILE, "%sReduce [%s].n", yyTracePrompt,
- yyRuleName[yyruleno]);
- }
- #endif /* NDEBUG */
- /* Silence complaints from purify about yygotominor being uninitialized
- ** in some cases when it is copied into the stack after the following
- ** switch. yygotominor is uninitialized when a rule reduces that does
- ** not set the value of its left-hand side nonterminal. Leaving the
- ** value of the nonterminal uninitialized is utterly harmless as long
- ** as the value is never used. So really the only thing this code
- ** accomplishes is to quieten purify.
- **
- ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
- ** without this code, their parser segfaults. I'm not sure what there
- ** parser is doing to make this happen. This is the second bug report
- ** from wireshark this week. Clearly they are stressing Lemon in ways
- ** that it has not been previously stressed... (SQLite ticket #2172)
- */
- /*memset(&yygotominor, 0, sizeof(yygotominor));*/
- yygotominor = yyzerominor;
- switch( yyruleno ){
- /* Beginning here are the reduction cases. A typical example
- ** follows:
- ** case 0:
- ** #line <lineno> <grammarfile>
- ** { ... } // User supplied code
- ** #line <lineno> <thisfile>
- ** break;
- */
- case 0: /* input ::= cmdlist */
- case 1: /* cmdlist ::= cmdlist ecmd */
- case 2: /* cmdlist ::= ecmd */
- case 4: /* ecmd ::= SEMI */
- case 5: /* ecmd ::= explain cmdx SEMI */
- case 10: /* trans_opt ::= */
- case 11: /* trans_opt ::= TRANSACTION */
- case 12: /* trans_opt ::= TRANSACTION nm */
- case 20: /* cmd ::= create_table create_table_args */
- case 28: /* columnlist ::= columnlist COMMA column */
- case 29: /* columnlist ::= column */
- case 37: /* type ::= */
- case 44: /* signed ::= plus_num */
- case 45: /* signed ::= minus_num */
- case 46: /* carglist ::= carglist carg */
- case 47: /* carglist ::= */
- case 48: /* carg ::= CONSTRAINT nm ccons */
- case 49: /* carg ::= ccons */
- case 55: /* ccons ::= NULL onconf */
- case 82: /* conslist ::= conslist COMMA tcons */
- case 83: /* conslist ::= conslist tcons */
- case 84: /* conslist ::= tcons */
- case 85: /* tcons ::= CONSTRAINT nm */
- case 257: /* plus_opt ::= PLUS */
- case 258: /* plus_opt ::= */
- case 268: /* foreach_clause ::= */
- case 269: /* foreach_clause ::= FOR EACH ROW */
- case 289: /* database_kw_opt ::= DATABASE */
- case 290: /* database_kw_opt ::= */
- case 298: /* kwcolumn_opt ::= */
- case 299: /* kwcolumn_opt ::= COLUMNKW */
- case 303: /* vtabarglist ::= vtabarg */
- case 304: /* vtabarglist ::= vtabarglist COMMA vtabarg */
- case 306: /* vtabarg ::= vtabarg vtabargtoken */
- case 310: /* anylist ::= */
- #line 91 "parse.y"
- {
- }
- #line 1943 "parse.c"
- break;
- case 3: /* cmdx ::= cmd */
- #line 94 "parse.y"
- { sqlite3FinishCoding(pParse); }
- #line 1948 "parse.c"
- break;
- case 6: /* explain ::= */
- #line 97 "parse.y"
- { sqlite3BeginParse(pParse, 0); }
- #line 1953 "parse.c"
- break;
- case 7: /* explain ::= EXPLAIN */
- #line 99 "parse.y"
- { sqlite3BeginParse(pParse, 1); }
- #line 1958 "parse.c"
- break;
- case 8: /* explain ::= EXPLAIN QUERY PLAN */
- #line 100 "parse.y"
- { sqlite3BeginParse(pParse, 2); }
- #line 1963 "parse.c"
- break;
- case 9: /* cmd ::= BEGIN transtype trans_opt */
- #line 106 "parse.y"
- {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy46);}
- #line 1968 "parse.c"
- break;
- case 13: /* transtype ::= */
- #line 111 "parse.y"
- {yygotominor.yy46 = TK_DEFERRED;}
- #line 1973 "parse.c"
- break;
- case 14: /* transtype ::= DEFERRED */
- case 15: /* transtype ::= IMMEDIATE */
- case 16: /* transtype ::= EXCLUSIVE */
- case 107: /* multiselect_op ::= UNION */
- case 109: /* multiselect_op ::= EXCEPT|INTERSECT */
- #line 112 "parse.y"
- {yygotominor.yy46 = yymsp[0].major;}
- #line 1982 "parse.c"
- break;
- case 17: /* cmd ::= COMMIT trans_opt */
- case 18: /* cmd ::= END trans_opt */
- #line 115 "parse.y"
- {sqlite3CommitTransaction(pParse);}
- #line 1988 "parse.c"
- break;
- case 19: /* cmd ::= ROLLBACK trans_opt */
- #line 117 "parse.y"
- {sqlite3RollbackTransaction(pParse);}
- #line 1993 "parse.c"
- break;
- case 21: /* create_table ::= CREATE temp TABLE ifnotexists nm dbnm */
- #line 122 "parse.y"
- {
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,yymsp[-4].minor.yy46,0,0,yymsp[-2].minor.yy46);
- }
- #line 2000 "parse.c"
- break;
- case 22: /* ifnotexists ::= */
- case 25: /* temp ::= */
- case 63: /* autoinc ::= */
- case 77: /* init_deferred_pred_opt ::= */
- case 79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
- case 90: /* defer_subclause_opt ::= */
- case 101: /* ifexists ::= */
- case 112: /* distinct ::= ALL */
- case 113: /* distinct ::= */
- case 213: /* between_op ::= BETWEEN */
- case 216: /* in_op ::= IN */
- #line 126 "parse.y"
- {yygotominor.yy46 = 0;}
- #line 2015 "parse.c"
- break;
- case 23: /* ifnotexists ::= IF NOT EXISTS */
- case 24: /* temp ::= TEMP */
- case 64: /* autoinc ::= AUTOINCR */
- case 78: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
- case 100: /* ifexists ::= IF EXISTS */
- case 111: /* distinct ::= DISTINCT */
- case 214: /* between_op ::= NOT BETWEEN */
- case 217: /* in_op ::= NOT IN */
- #line 127 "parse.y"
- {yygotominor.yy46 = 1;}
- #line 2027 "parse.c"
- break;
- case 26: /* create_table_args ::= LP columnlist conslist_opt RP */
- #line 133 "parse.y"
- {
- sqlite3EndTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy0,0);
- }
- #line 2034 "parse.c"
- break;
- case 27: /* create_table_args ::= AS select */
- #line 136 "parse.y"
- {
- sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy219);
- sqlite3SelectDelete(yymsp[0].minor.yy219);
- }
- #line 2042 "parse.c"
- break;
- case 30: /* column ::= columnid type carglist */
- #line 148 "parse.y"
- {
- yygotominor.yy410.z = yymsp[-2].minor.yy410.z;
- yygotominor.yy410.n = (pParse->sLastToken.z-yymsp[-2].minor.yy410.z) + pParse->sLastToken.n;
- }
- #line 2050 "parse.c"
- break;
- case 31: /* columnid ::= nm */
- #line 152 "parse.y"
- {
- sqlite3AddColumn(pParse,&yymsp[0].minor.yy410);
- yygotominor.yy410 = yymsp[0].minor.yy410;
- }
- #line 2058 "parse.c"
- break;
- case 32: /* id ::= ID */
- case 33: /* ids ::= ID|STRING */
- case 34: /* nm ::= ID */
- case 35: /* nm ::= STRING */
- case 36: /* nm ::= JOIN_KW */
- case 256: /* number ::= INTEGER|FLOAT */
- #line 162 "parse.y"
- {yygotominor.yy410 = yymsp[0].minor.yy0;}
- #line 2068 "parse.c"
- break;
- case 38: /* type ::= typetoken */
- #line 223 "parse.y"
- {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy410);}
- #line 2073 "parse.c"
- break;
- case 39: /* typetoken ::= typename */
- case 42: /* typename ::= ids */
- case 119: /* as ::= AS nm */
- case 120: /* as ::= ids */
- case 131: /* dbnm ::= DOT nm */
- case 241: /* idxitem ::= nm */
- case 243: /* collate ::= COLLATE ids */
- case 252: /* nmnum ::= plus_num */
- case 253: /* nmnum ::= nm */
- case 254: /* plus_num ::= plus_opt number */
- case 255: /* minus_num ::= MINUS number */
- #line 224 "parse.y"
- {yygotominor.yy410 = yymsp[0].minor.yy410;}
- #line 2088 "parse.c"
- break;
- case 40: /* typetoken ::= typename LP signed RP */
- #line 225 "parse.y"
- {
- yygotominor.yy410.z = yymsp[-3].minor.yy410.z;
- yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy410.z;
- }
- #line 2096 "parse.c"
- break;
- case 41: /* typetoken ::= typename LP signed COMMA signed RP */
- #line 229 "parse.y"
- {
- yygotominor.yy410.z = yymsp[-5].minor.yy410.z;
- yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy410.z;
- }
- #line 2104 "parse.c"
- break;
- case 43: /* typename ::= typename ids */
- #line 235 "parse.y"
- {yygotominor.yy410.z=yymsp[-1].minor.yy410.z; yygotominor.yy410.n=yymsp[0].minor.yy410.n+(yymsp[0].minor.yy410.z-yymsp[-1].minor.yy410.z);}
- #line 2109 "parse.c"
- break;
- case 50: /* ccons ::= DEFAULT term */
- case 52: /* ccons ::= DEFAULT PLUS term */
- #line 246 "parse.y"
- {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy172);}
- #line 2115 "parse.c"
- break;
- case 51: /* ccons ::= DEFAULT LP expr RP */
- #line 247 "parse.y"
- {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy172);}
- #line 2120 "parse.c"
- break;
- case 53: /* ccons ::= DEFAULT MINUS term */
- #line 249 "parse.y"
- {
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
- sqlite3AddDefaultValue(pParse,p);
- }
- #line 2128 "parse.c"
- break;
- case 54: /* ccons ::= DEFAULT id */
- #line 253 "parse.y"
- {
- Expr *p = sqlite3PExpr(pParse, TK_STRING, 0, 0, &yymsp[0].minor.yy410);
- sqlite3AddDefaultValue(pParse,p);
- }
- #line 2136 "parse.c"
- break;
- case 56: /* ccons ::= NOT NULL onconf */
- #line 262 "parse.y"
- {sqlite3AddNotNull(pParse, yymsp[0].minor.yy46);}
- #line 2141 "parse.c"
- break;
- case 57: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
- #line 264 "parse.y"
- {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);}
- #line 2146 "parse.c"
- break;
- case 58: /* ccons ::= UNIQUE onconf */
- #line 265 "parse.y"
- {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy46,0,0,0,0);}
- #line 2151 "parse.c"
- break;
- case 59: /* ccons ::= CHECK LP expr RP */
- #line 266 "parse.y"
- {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy172);}
- #line 2156 "parse.c"
- break;
- case 60: /* ccons ::= REFERENCES nm idxlist_opt refargs */
- #line 268 "parse.y"
- {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy410,yymsp[-1].minor.yy174,yymsp[0].minor.yy46);}
- #line 2161 "parse.c"
- break;
- case 61: /* ccons ::= defer_subclause */
- #line 269 "parse.y"
- {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy46);}
- #line 2166 "parse.c"
- break;
- case 62: /* ccons ::= COLLATE ids */
- #line 270 "parse.y"
- {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy410);}
- #line 2171 "parse.c"
- break;
- case 65: /* refargs ::= */
- #line 283 "parse.y"
- { yygotominor.yy46 = OE_Restrict * 0x010101; }
- #line 2176 "parse.c"
- break;
- case 66: /* refargs ::= refargs refarg */
- #line 284 "parse.y"
- { yygotominor.yy46 = (yymsp[-1].minor.yy46 & yymsp[0].minor.yy405.mask) | yymsp[0].minor.yy405.value; }
- #line 2181 "parse.c"
- break;
- case 67: /* refarg ::= MATCH nm */
- #line 286 "parse.y"
- { yygotominor.yy405.value = 0; yygotominor.yy405.mask = 0x000000; }
- #line 2186 "parse.c"
- break;
- case 68: /* refarg ::= ON DELETE refact */
- #line 287 "parse.y"
- { yygotominor.yy405.value = yymsp[0].minor.yy46; yygotominor.yy405.mask = 0x0000ff; }
- #line 2191 "parse.c"
- break;
- case 69: /* refarg ::= ON UPDATE refact */
- #line 288 "parse.y"
- { yygotominor.yy405.value = yymsp[0].minor.yy46<<8; yygotominor.yy405.mask = 0x00ff00; }
- #line 2196 "parse.c"
- break;
- case 70: /* refarg ::= ON INSERT refact */
- #line 289 "parse.y"
- { yygotominor.yy405.value = yymsp[0].minor.yy46<<16; yygotominor.yy405.mask = 0xff0000; }
- #line 2201 "parse.c"
- break;
- case 71: /* refact ::= SET NULL */
- #line 291 "parse.y"
- { yygotominor.yy46 = OE_SetNull; }
- #line 2206 "parse.c"
- break;
- case 72: /* refact ::= SET DEFAULT */
- #line 292 "parse.y"
- { yygotominor.yy46 = OE_SetDflt; }
- #line 2211 "parse.c"
- break;
- case 73: /* refact ::= CASCADE */
- #line 293 "parse.y"
- { yygotominor.yy46 = OE_Cascade; }
- #line 2216 "parse.c"
- break;
- case 74: /* refact ::= RESTRICT */
- #line 294 "parse.y"
- { yygotominor.yy46 = OE_Restrict; }
- #line 2221 "parse.c"
- break;
- case 75: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
- case 76: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
- case 91: /* defer_subclause_opt ::= defer_subclause */
- case 93: /* onconf ::= ON CONFLICT resolvetype */
- case 95: /* orconf ::= OR resolvetype */
- case 96: /* resolvetype ::= raisetype */
- case 166: /* insert_cmd ::= INSERT orconf */
- #line 296 "parse.y"
- {yygotominor.yy46 = yymsp[0].minor.yy46;}
- #line 2232 "parse.c"
- break;
- case 80: /* conslist_opt ::= */
- #line 306 "parse.y"
- {yygotominor.yy410.n = 0; yygotominor.yy410.z = 0;}
- #line 2237 "parse.c"
- break;
- case 81: /* conslist_opt ::= COMMA conslist */
- #line 307 "parse.y"
- {yygotominor.yy410 = yymsp[-1].minor.yy0;}
- #line 2242 "parse.c"
- break;
- case 86: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
- #line 313 "parse.y"
- {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy174,yymsp[0].minor.yy46,yymsp[-2].minor.yy46,0);}
- #line 2247 "parse.c"
- break;
- case 87: /* tcons ::= UNIQUE LP idxlist RP onconf */
- #line 315 "parse.y"
- {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy174,yymsp[0].minor.yy46,0,0,0,0);}
- #line 2252 "parse.c"
- break;
- case 88: /* tcons ::= CHECK LP expr RP onconf */
- #line 316 "parse.y"
- {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy172);}
- #line 2257 "parse.c"
- break;
- case 89: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
- #line 318 "parse.y"
- {
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy174, &yymsp[-3].minor.yy410, yymsp[-2].minor.yy174, yymsp[-1].minor.yy46);
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy46);
- }
- #line 2265 "parse.c"
- break;
- case 92: /* onconf ::= */
- case 94: /* orconf ::= */
- #line 332 "parse.y"
- {yygotominor.yy46 = OE_Default;}
- #line 2271 "parse.c"
- break;
- case 97: /* resolvetype ::= IGNORE */
- #line 337 "parse.y"
- {yygotominor.yy46 = OE_Ignore;}
- #line 2276 "parse.c"
- break;
- case 98: /* resolvetype ::= REPLACE */
- case 167: /* insert_cmd ::= REPLACE */
- #line 338 "parse.y"
- {yygotominor.yy46 = OE_Replace;}
- #line 2282 "parse.c"
- break;
- case 99: /* cmd ::= DROP TABLE ifexists fullname */
- #line 342 "parse.y"
- {
- sqlite3DropTable(pParse, yymsp[0].minor.yy373, 0, yymsp[-1].minor.yy46);
- }
- #line 2289 "parse.c"
- break;
- case 102: /* cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select */
- #line 352 "parse.y"
- {
- sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, yymsp[0].minor.yy219, yymsp[-6].minor.yy46, yymsp[-4].minor.yy46);
- }
- #line 2296 "parse.c"
- break;
- case 103: /* cmd ::= DROP VIEW ifexists fullname */
- #line 355 "parse.y"
- {
- sqlite3DropTable(pParse, yymsp[0].minor.yy373, 1, yymsp[-1].minor.yy46);
- }
- #line 2303 "parse.c"
- break;
- case 104: /* cmd ::= select */
- #line 362 "parse.y"
- {
- SelectDest dest = {SRT_Callback, 0, 0, 0, 0};
- sqlite3Select(pParse, yymsp[0].minor.yy219, &dest, 0, 0, 0, 0);
- sqlite3SelectDelete(yymsp[0].minor.yy219);
- }
- #line 2312 "parse.c"
- break;
- case 105: /* select ::= oneselect */
- case 128: /* seltablist_paren ::= select */
- #line 373 "parse.y"
- {yygotominor.yy219 = yymsp[0].minor.yy219;}
- #line 2318 "parse.c"
- break;
- case 106: /* select ::= select multiselect_op oneselect */
- #line 375 "parse.y"
- {
- if( yymsp[0].minor.yy219 ){
- yymsp[0].minor.yy219->op = yymsp[-1].minor.yy46;
- yymsp[0].minor.yy219->pPrior = yymsp[-2].minor.yy219;
- }else{
- sqlite3SelectDelete(yymsp[-2].minor.yy219);
- }
- yygotominor.yy219 = yymsp[0].minor.yy219;
- }
- #line 2331 "parse.c"
- break;
- case 108: /* multiselect_op ::= UNION ALL */
- #line 386 "parse.y"
- {yygotominor.yy46 = TK_ALL;}
- #line 2336 "parse.c"
- break;
- case 110: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
- #line 390 "parse.y"
- {
- yygotominor.yy219 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy174,yymsp[-5].minor.yy373,yymsp[-4].minor.yy172,yymsp[-3].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy174,yymsp[-7].minor.yy46,yymsp[0].minor.yy234.pLimit,yymsp[0].minor.yy234.pOffset);
- }
- #line 2343 "parse.c"
- break;
- case 114: /* sclp ::= selcollist COMMA */
- case 238: /* idxlist_opt ::= LP idxlist RP */
- #line 411 "parse.y"
- {yygotominor.yy174 = yymsp[-1].minor.yy174;}
- #line 2349 "parse.c"
- break;
- case 115: /* sclp ::= */
- case 141: /* orderby_opt ::= */
- case 149: /* groupby_opt ::= */
- case 231: /* exprlist ::= */
- case 237: /* idxlist_opt ::= */
- #line 412 "parse.y"
- {yygotominor.yy174 = 0;}
- #line 2358 "parse.c"
- break;
- case 116: /* selcollist ::= sclp expr as */
- #line 413 "parse.y"
- {
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[-1].minor.yy172,yymsp[0].minor.yy410.n?&yymsp[0].minor.yy410:0);
- }
- #line 2365 "parse.c"
- break;
- case 117: /* selcollist ::= sclp STAR */
- #line 416 "parse.y"
- {
- Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
- yygotominor.yy174 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy174, p, 0);
- }
- #line 2373 "parse.c"
- break;
- case 118: /* selcollist ::= sclp nm DOT STAR */
- #line 420 "parse.y"
- {
- Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
- Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
- Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174, pDot, 0);
- }
- #line 2383 "parse.c"
- break;
- case 121: /* as ::= */
- #line 433 "parse.y"
- {yygotominor.yy410.n = 0;}
- #line 2388 "parse.c"
- break;
- case 122: /* from ::= */
- #line 445 "parse.y"
- {yygotominor.yy373 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy373));}
- #line 2393 "parse.c"
- break;
- case 123: /* from ::= FROM seltablist */
- #line 446 "parse.y"
- {
- yygotominor.yy373 = yymsp[0].minor.yy373;
- sqlite3SrcListShiftJoinType(yygotominor.yy373);
- }
- #line 2401 "parse.c"
- break;
- case 124: /* stl_prefix ::= seltablist joinop */
- #line 454 "parse.y"
- {
- yygotominor.yy373 = yymsp[-1].minor.yy373;
- if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].jointype = yymsp[0].minor.yy46;
- }
- #line 2409 "parse.c"
- break;
- case 125: /* stl_prefix ::= */
- #line 458 "parse.y"
- {yygotominor.yy373 = 0;}
- #line 2414 "parse.c"
- break;
- case 126: /* seltablist ::= stl_prefix nm dbnm as on_opt using_opt */
- #line 459 "parse.y"
- {
- yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy373,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,0,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
- }
- #line 2421 "parse.c"
- break;
- case 127: /* seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt */
- #line 464 "parse.y"
- {
- yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy373,0,0,&yymsp[-2].minor.yy410,yymsp[-4].minor.yy219,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
- }
- #line 2428 "parse.c"
- break;
- case 129: /* seltablist_paren ::= seltablist */
- #line 475 "parse.y"
- {
- sqlite3SrcListShiftJoinType(yymsp[0].minor.yy373);
- yygotominor.yy219 = sqlite3SelectNew(pParse,0,yymsp[0].minor.yy373,0,0,0,0,0,0,0);
- }
- #line 2436 "parse.c"
- break;
- case 130: /* dbnm ::= */
- #line 482 "parse.y"
- {yygotominor.yy410.z=0; yygotominor.yy410.n=0;}
- #line 2441 "parse.c"
- break;
- case 132: /* fullname ::= nm dbnm */
- #line 487 "parse.y"
- {yygotominor.yy373 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);}
- #line 2446 "parse.c"
- break;
- case 133: /* joinop ::= COMMA|JOIN */
- #line 491 "parse.y"
- { yygotominor.yy46 = JT_INNER; }
- #line 2451 "parse.c"
- break;
- case 134: /* joinop ::= JOIN_KW JOIN */
- #line 492 "parse.y"
- { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
- #line 2456 "parse.c"
- break;
- case 135: /* joinop ::= JOIN_KW nm JOIN */
- #line 493 "parse.y"
- { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy410,0); }
- #line 2461 "parse.c"
- break;
- case 136: /* joinop ::= JOIN_KW nm nm JOIN */
- #line 495 "parse.y"
- { yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy410,&yymsp[-1].minor.yy410); }
- #line 2466 "parse.c"
- break;
- case 137: /* on_opt ::= ON expr */
- case 145: /* sortitem ::= expr */
- case 152: /* having_opt ::= HAVING expr */
- case 159: /* where_opt ::= WHERE expr */
- case 174: /* expr ::= term */
- case 202: /* escape ::= ESCAPE expr */
- case 226: /* case_else ::= ELSE expr */
- case 228: /* case_operand ::= expr */
- #line 499 "parse.y"
- {yygotominor.yy172 = yymsp[0].minor.yy172;}
- #line 2478 "parse.c"
- break;
- case 138: /* on_opt ::= */
- case 151: /* having_opt ::= */
- case 158: /* where_opt ::= */
- case 203: /* escape ::= */
- case 227: /* case_else ::= */
- case 229: /* case_operand ::= */
- #line 500 "parse.y"
- {yygotominor.yy172 = 0;}
- #line 2488 "parse.c"
- break;
- case 139: /* using_opt ::= USING LP inscollist RP */
- case 171: /* inscollist_opt ::= LP inscollist RP */
- #line 504 "parse.y"
- {yygotominor.yy432 = yymsp[-1].minor.yy432;}
- #line 2494 "parse.c"
- break;
- case 140: /* using_opt ::= */
- case 170: /* inscollist_opt ::= */
- #line 505 "parse.y"
- {yygotominor.yy432 = 0;}
- #line 2500 "parse.c"
- break;
- case 142: /* orderby_opt ::= ORDER BY sortlist */
- case 150: /* groupby_opt ::= GROUP BY nexprlist */
- case 230: /* exprlist ::= nexprlist */
- #line 516 "parse.y"
- {yygotominor.yy174 = yymsp[0].minor.yy174;}
- #line 2507 "parse.c"
- break;
- case 143: /* sortlist ::= sortlist COMMA sortitem sortorder */
- #line 517 "parse.y"
- {
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174,yymsp[-1].minor.yy172,0);
- if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
- }
- #line 2515 "parse.c"
- break;
- case 144: /* sortlist ::= sortitem sortorder */
- #line 521 "parse.y"
- {
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy172,0);
- if( yygotominor.yy174 && yygotominor.yy174->a ) yygotominor.yy174->a[0].sortOrder = yymsp[0].minor.yy46;
- }
- #line 2523 "parse.c"
- break;
- case 146: /* sortorder ::= ASC */
- case 148: /* sortorder ::= */
- #line 529 "parse.y"
- {yygotominor.yy46 = SQLITE_SO_ASC;}
- #line 2529 "parse.c"
- break;
- case 147: /* sortorder ::= DESC */
- #line 530 "parse.y"
- {yygotominor.yy46 = SQLITE_SO_DESC;}
- #line 2534 "parse.c"
- break;
- case 153: /* limit_opt ::= */
- #line 556 "parse.y"
- {yygotominor.yy234.pLimit = 0; yygotominor.yy234.pOffset = 0;}
- #line 2539 "parse.c"
- break;
- case 154: /* limit_opt ::= LIMIT expr */
- #line 557 "parse.y"
- {yygotominor.yy234.pLimit = yymsp[0].minor.yy172; yygotominor.yy234.pOffset = 0;}
- #line 2544 "parse.c"
- break;
- case 155: /* limit_opt ::= LIMIT expr OFFSET expr */
- #line 559 "parse.y"
- {yygotominor.yy234.pLimit = yymsp[-2].minor.yy172; yygotominor.yy234.pOffset = yymsp[0].minor.yy172;}
- #line 2549 "parse.c"
- break;
- case 156: /* limit_opt ::= LIMIT expr COMMA expr */
- #line 561 "parse.y"
- {yygotominor.yy234.pOffset = yymsp[-2].minor.yy172; yygotominor.yy234.pLimit = yymsp[0].minor.yy172;}
- #line 2554 "parse.c"
- break;
- case 157: /* cmd ::= DELETE FROM fullname where_opt */
- #line 565 "parse.y"
- {sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy373,yymsp[0].minor.yy172);}
- #line 2559 "parse.c"
- break;
- case 160: /* cmd ::= UPDATE orconf fullname SET setlist where_opt */
- #line 575 "parse.y"
- {
- sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy174,"set list");
- sqlite3Update(pParse,yymsp[-3].minor.yy373,yymsp[-1].minor.yy174,yymsp[0].minor.yy172,yymsp[-4].minor.yy46);
- }
- #line 2567 "parse.c"
- break;
- case 161: /* setlist ::= setlist COMMA nm EQ expr */
- #line 584 "parse.y"
- {yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
- #line 2572 "parse.c"
- break;
- case 162: /* setlist ::= nm EQ expr */
- #line 586 "parse.y"
- {yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);}
- #line 2577 "parse.c"
- break;
- case 163: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
- #line 592 "parse.y"
- {sqlite3Insert(pParse, yymsp[-5].minor.yy373, yymsp[-1].minor.yy174, 0, yymsp[-4].minor.yy432, yymsp[-7].minor.yy46);}
- #line 2582 "parse.c"
- break;
- case 164: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
- #line 594 "parse.y"
- {sqlite3Insert(pParse, yymsp[-2].minor.yy373, 0, yymsp[0].minor.yy219, yymsp[-1].minor.yy432, yymsp[-4].minor.yy46);}
- #line 2587 "parse.c"
- break;
- case 165: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
- #line 596 "parse.y"
- {sqlite3Insert(pParse, yymsp[-3].minor.yy373, 0, 0, yymsp[-2].minor.yy432, yymsp[-5].minor.yy46);}
- #line 2592 "parse.c"
- break;
- case 168: /* itemlist ::= itemlist COMMA expr */
- case 232: /* nexprlist ::= nexprlist COMMA expr */
- #line 607 "parse.y"
- {yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[0].minor.yy172,0);}
- #line 2598 "parse.c"
- break;
- case 169: /* itemlist ::= expr */
- case 233: /* nexprlist ::= expr */
- #line 609 "parse.y"
- {yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,0);}
- #line 2604 "parse.c"
- break;
- case 172: /* inscollist ::= inscollist COMMA nm */
- #line 619 "parse.y"
- {yygotominor.yy432 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy432,&yymsp[0].minor.yy410);}
- #line 2609 "parse.c"
- break;
- case 173: /* inscollist ::= nm */
- #line 621 "parse.y"
- {yygotominor.yy432 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy410);}
- #line 2614 "parse.c"
- break;
- case 175: /* expr ::= LP expr RP */
- #line 632 "parse.y"
- {yygotominor.yy172 = yymsp[-1].minor.yy172; sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
- #line 2619 "parse.c"
- break;
- case 176: /* term ::= NULL */
- case 181: /* term ::= INTEGER|FLOAT|BLOB */
- case 182: /* term ::= STRING */
- #line 633 "parse.y"
- {yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
- #line 2626 "parse.c"
- break;
- case 177: /* expr ::= ID */
- case 178: /* expr ::= JOIN_KW */
- #line 634 "parse.y"
- {yygotominor.yy172 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);}
- #line 2632 "parse.c"
- break;
- case 179: /* expr ::= nm DOT nm */
- #line 636 "parse.y"
- {
- Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
- Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy410);
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
- }
- #line 2641 "parse.c"
- break;
- case 180: /* expr ::= nm DOT nm DOT nm */
- #line 641 "parse.y"
- {
- Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy410);
- Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy410);
- Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy410);
- Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
- }
- #line 2652 "parse.c"
- break;
- case 183: /* expr ::= REGISTER */
- #line 650 "parse.y"
- {yygotominor.yy172 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
- #line 2657 "parse.c"
- break;
- case 184: /* expr ::= VARIABLE */
- #line 651 "parse.y"
- {
- Token *pToken = &yymsp[0].minor.yy0;
- Expr *pExpr = yygotominor.yy172 = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken);
- sqlite3ExprAssignVarNumber(pParse, pExpr);
- }
- #line 2666 "parse.c"
- break;
- case 185: /* expr ::= expr COLLATE ids */
- #line 656 "parse.y"
- {
- yygotominor.yy172 = sqlite3ExprSetColl(pParse, yymsp[-2].minor.yy172, &yymsp[0].minor.yy410);
- }
- #line 2673 "parse.c"
- break;
- case 186: /* expr ::= CAST LP expr AS typetoken RP */
- #line 660 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy172, 0, &yymsp[-1].minor.yy410);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
- }
- #line 2681 "parse.c"
- break;
- case 187: /* expr ::= ID LP distinct exprlist RP */
- #line 665 "parse.y"
- {
- if( yymsp[-1].minor.yy174 && yymsp[-1].minor.yy174->nExpr>SQLITE_MAX_FUNCTION_ARG ){
- sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
- }
- yygotominor.yy172 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy174, &yymsp[-4].minor.yy0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
- if( yymsp[-2].minor.yy46 && yygotominor.yy172 ){
- yygotominor.yy172->flags |= EP_Distinct;
- }
- }
- #line 2695 "parse.c"
- break;
- case 188: /* expr ::= ID LP STAR RP */
- #line 675 "parse.y"
- {
- yygotominor.yy172 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
- }
- #line 2703 "parse.c"
- break;
- case 189: /* term ::= CTIME_KW */
- #line 679 "parse.y"
- {
- /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
- ** treated as functions that return constants */
- yygotominor.yy172 = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->op = TK_CONST_FUNC;
- yygotominor.yy172->span = yymsp[0].minor.yy0;
- }
- }
- #line 2716 "parse.c"
- break;
- case 190: /* expr ::= expr AND expr */
- case 191: /* expr ::= expr OR expr */
- case 192: /* expr ::= expr LT|GT|GE|LE expr */
- case 193: /* expr ::= expr EQ|NE expr */
- case 194: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
- case 195: /* expr ::= expr PLUS|MINUS expr */
- case 196: /* expr ::= expr STAR|SLASH|REM expr */
- case 197: /* expr ::= expr CONCAT expr */
- #line 688 "parse.y"
- {yygotominor.yy172 = sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy172,yymsp[0].minor.yy172,0);}
- #line 2728 "parse.c"
- break;
- case 198: /* likeop ::= LIKE_KW */
- case 200: /* likeop ::= MATCH */
- #line 700 "parse.y"
- {yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 0;}
- #line 2734 "parse.c"
- break;
- case 199: /* likeop ::= NOT LIKE_KW */
- case 201: /* likeop ::= NOT MATCH */
- #line 701 "parse.y"
- {yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 1;}
- #line 2740 "parse.c"
- break;
- case 204: /* expr ::= expr likeop expr escape */
- #line 708 "parse.y"
- {
- ExprList *pList;
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-1].minor.yy172, 0);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-3].minor.yy172, 0);
- if( yymsp[0].minor.yy172 ){
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
- }
- yygotominor.yy172 = sqlite3ExprFunction(pParse, pList, &yymsp[-2].minor.yy72.eOperator);
- if( yymsp[-2].minor.yy72.not ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy172->span, &yymsp[-1].minor.yy172->span);
- if( yygotominor.yy172 ) yygotominor.yy172->flags |= EP_InfixFunc;
- }
- #line 2756 "parse.c"
- break;
- case 205: /* expr ::= expr ISNULL|NOTNULL */
- #line 721 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, yymsp[-1].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2764 "parse.c"
- break;
- case 206: /* expr ::= expr IS NULL */
- #line 725 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_ISNULL, yymsp[-2].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2772 "parse.c"
- break;
- case 207: /* expr ::= expr NOT NULL */
- #line 729 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-2].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2780 "parse.c"
- break;
- case 208: /* expr ::= expr IS NOT NULL */
- #line 733 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-3].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2788 "parse.c"
- break;
- case 209: /* expr ::= NOT expr */
- case 210: /* expr ::= BITNOT expr */
- #line 737 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
- }
- #line 2797 "parse.c"
- break;
- case 211: /* expr ::= MINUS expr */
- #line 745 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
- }
- #line 2805 "parse.c"
- break;
- case 212: /* expr ::= PLUS expr */
- #line 749 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
- }
- #line 2813 "parse.c"
- break;
- case 215: /* expr ::= expr between_op expr AND expr */
- #line 756 "parse.y"
- {
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy172, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pList = pList;
- }else{
- sqlite3ExprListDelete(pList);
- }
- if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy172->span);
- }
- #line 2829 "parse.c"
- break;
- case 218: /* expr ::= expr in_op LP exprlist RP */
- #line 772 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pList = yymsp[-1].minor.yy174;
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3ExprListDelete(yymsp[-1].minor.yy174);
- }
- if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2844 "parse.c"
- break;
- case 219: /* expr ::= LP select RP */
- #line 783 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3SelectDelete(yymsp[-1].minor.yy219);
- }
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
- }
- #line 2858 "parse.c"
- break;
- case 220: /* expr ::= expr in_op LP select RP */
- #line 793 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3SelectDelete(yymsp[-1].minor.yy219);
- }
- if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
- }
- #line 2873 "parse.c"
- break;
- case 221: /* expr ::= expr in_op nm dbnm */
- #line 804 "parse.y"
- {
- SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy172, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3SrcListDelete(pSrc);
- }
- if( yymsp[-2].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
- sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,yymsp[0].minor.yy410.z?&yymsp[0].minor.yy410:&yymsp[-1].minor.yy410);
- }
- #line 2889 "parse.c"
- break;
- case 222: /* expr ::= EXISTS LP select RP */
- #line 816 "parse.y"
- {
- Expr *p = yygotominor.yy172 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
- if( p ){
- p->pSelect = yymsp[-1].minor.yy219;
- sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3SelectDelete(yymsp[-1].minor.yy219);
- }
- }
- #line 2903 "parse.c"
- break;
- case 223: /* expr ::= CASE case_operand case_exprlist case_else END */
- #line 829 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->pList = yymsp[-2].minor.yy174;
- sqlite3ExprSetHeight(yygotominor.yy172);
- }else{
- sqlite3ExprListDelete(yymsp[-2].minor.yy174);
- }
- sqlite3ExprSpan(yygotominor.yy172, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
- }
- #line 2917 "parse.c"
- break;
- case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
- #line 841 "parse.y"
- {
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, yymsp[-2].minor.yy172, 0);
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
- }
- #line 2925 "parse.c"
- break;
- case 225: /* case_exprlist ::= WHEN expr THEN expr */
- #line 845 "parse.y"
- {
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
- }
- #line 2933 "parse.c"
- break;
- case 234: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
- #line 874 "parse.y"
- {
- sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy410, &yymsp[-5].minor.yy410,
- sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy410,0), yymsp[-1].minor.yy174, yymsp[-9].minor.yy46,
- &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy46);
- }
- #line 2942 "parse.c"
- break;
- case 235: /* uniqueflag ::= UNIQUE */
- case 282: /* raisetype ::= ABORT */
- #line 881 "parse.y"
- {yygotominor.yy46 = OE_Abort;}
- #line 2948 "parse.c"
- break;
- case 236: /* uniqueflag ::= */
- #line 882 "parse.y"
- {yygotominor.yy46 = OE_None;}
- #line 2953 "parse.c"
- break;
- case 239: /* idxlist ::= idxlist COMMA idxitem collate sortorder */
- #line 892 "parse.y"
- {
- Expr *p = 0;
- if( yymsp[-1].minor.yy410.n>0 ){
- p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
- sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy410);
- }
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, p, &yymsp[-2].minor.yy410);
- sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
- if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
- }
- #line 2967 "parse.c"
- break;
- case 240: /* idxlist ::= idxitem collate sortorder */
- #line 902 "parse.y"
- {
- Expr *p = 0;
- if( yymsp[-1].minor.yy410.n>0 ){
- p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
- sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy410);
- }
- yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, p, &yymsp[-2].minor.yy410);
- sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
- if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
- }
- #line 2981 "parse.c"
- break;
- case 242: /* collate ::= */
- #line 915 "parse.y"
- {yygotominor.yy410.z = 0; yygotominor.yy410.n = 0;}
- #line 2986 "parse.c"
- break;
- case 244: /* cmd ::= DROP INDEX ifexists fullname */
- #line 921 "parse.y"
- {sqlite3DropIndex(pParse, yymsp[0].minor.yy373, yymsp[-1].minor.yy46);}
- #line 2991 "parse.c"
- break;
- case 245: /* cmd ::= VACUUM */
- case 246: /* cmd ::= VACUUM nm */
- #line 927 "parse.y"
- {sqlite3Vacuum(pParse);}
- #line 2997 "parse.c"
- break;
- case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
- #line 935 "parse.y"
- {sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,0);}
- #line 3002 "parse.c"
- break;
- case 248: /* cmd ::= PRAGMA nm dbnm EQ ON */
- #line 936 "parse.y"
- {sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy0,0);}
- #line 3007 "parse.c"
- break;
- case 249: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
- #line 937 "parse.y"
- {
- sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,1);
- }
- #line 3014 "parse.c"
- break;
- case 250: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
- #line 940 "parse.y"
- {sqlite3Pragma(pParse,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-1].minor.yy410,0);}
- #line 3019 "parse.c"
- break;
- case 251: /* cmd ::= PRAGMA nm dbnm */
- #line 941 "parse.y"
- {sqlite3Pragma(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,0,0);}
- #line 3024 "parse.c"
- break;
- case 259: /* cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END */
- #line 955 "parse.y"
- {
- Token all;
- all.z = yymsp[-3].minor.yy410.z;
- all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy410.z) + yymsp[0].minor.yy0.n;
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy243, &all);
- }
- #line 3034 "parse.c"
- break;
- case 260: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
- #line 964 "parse.y"
- {
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy410, &yymsp[-6].minor.yy410, yymsp[-5].minor.yy46, yymsp[-4].minor.yy370.a, yymsp[-4].minor.yy370.b, yymsp[-2].minor.yy373, yymsp[0].minor.yy172, yymsp[-10].minor.yy46, yymsp[-8].minor.yy46);
- yygotominor.yy410 = (yymsp[-6].minor.yy410.n==0?yymsp[-7].minor.yy410:yymsp[-6].minor.yy410);
- }
- #line 3042 "parse.c"
- break;
- case 261: /* trigger_time ::= BEFORE */
- case 264: /* trigger_time ::= */
- #line 970 "parse.y"
- { yygotominor.yy46 = TK_BEFORE; }
- #line 3048 "parse.c"
- break;
- case 262: /* trigger_time ::= AFTER */
- #line 971 "parse.y"
- { yygotominor.yy46 = TK_AFTER; }
- #line 3053 "parse.c"
- break;
- case 263: /* trigger_time ::= INSTEAD OF */
- #line 972 "parse.y"
- { yygotominor.yy46 = TK_INSTEAD;}
- #line 3058 "parse.c"
- break;
- case 265: /* trigger_event ::= DELETE|INSERT */
- case 266: /* trigger_event ::= UPDATE */
- #line 977 "parse.y"
- {yygotominor.yy370.a = yymsp[0].major; yygotominor.yy370.b = 0;}
- #line 3064 "parse.c"
- break;
- case 267: /* trigger_event ::= UPDATE OF inscollist */
- #line 979 "parse.y"
- {yygotominor.yy370.a = TK_UPDATE; yygotominor.yy370.b = yymsp[0].minor.yy432;}
- #line 3069 "parse.c"
- break;
- case 270: /* when_clause ::= */
- case 287: /* key_opt ::= */
- #line 986 "parse.y"
- { yygotominor.yy172 = 0; }
- #line 3075 "parse.c"
- break;
- case 271: /* when_clause ::= WHEN expr */
- case 288: /* key_opt ::= KEY expr */
- #line 987 "parse.y"
- { yygotominor.yy172 = yymsp[0].minor.yy172; }
- #line 3081 "parse.c"
- break;
- case 272: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
- #line 991 "parse.y"
- {
- if( yymsp[-2].minor.yy243 ){
- yymsp[-2].minor.yy243->pLast->pNext = yymsp[-1].minor.yy243;
- }else{
- yymsp[-2].minor.yy243 = yymsp[-1].minor.yy243;
- }
- yymsp[-2].minor.yy243->pLast = yymsp[-1].minor.yy243;
- yygotominor.yy243 = yymsp[-2].minor.yy243;
- }
- #line 3094 "parse.c"
- break;
- case 273: /* trigger_cmd_list ::= */
- #line 1000 "parse.y"
- { yygotominor.yy243 = 0; }
- #line 3099 "parse.c"
- break;
- case 274: /* trigger_cmd ::= UPDATE orconf nm SET setlist where_opt */
- #line 1006 "parse.y"
- { yygotominor.yy243 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-3].minor.yy410, yymsp[-1].minor.yy174, yymsp[0].minor.yy172, yymsp[-4].minor.yy46); }
- #line 3104 "parse.c"
- break;
- case 275: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP */
- #line 1011 "parse.y"
- {yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy410, yymsp[-4].minor.yy432, yymsp[-1].minor.yy174, 0, yymsp[-7].minor.yy46);}
- #line 3109 "parse.c"
- break;
- case 276: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt select */
- #line 1014 "parse.y"
- {yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy410, yymsp[-1].minor.yy432, 0, yymsp[0].minor.yy219, yymsp[-4].minor.yy46);}
- #line 3114 "parse.c"
- break;
- case 277: /* trigger_cmd ::= DELETE FROM nm where_opt */
- #line 1018 "parse.y"
- {yygotominor.yy243 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-1].minor.yy410, yymsp[0].minor.yy172);}
- #line 3119 "parse.c"
- break;
- case 278: /* trigger_cmd ::= select */
- #line 1021 "parse.y"
- {yygotominor.yy243 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy219); }
- #line 3124 "parse.c"
- break;
- case 279: /* expr ::= RAISE LP IGNORE RP */
- #line 1024 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
- if( yygotominor.yy172 ){
- yygotominor.yy172->iColumn = OE_Ignore;
- sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
- }
- }
- #line 3135 "parse.c"
- break;
- case 280: /* expr ::= RAISE LP raisetype COMMA nm RP */
- #line 1031 "parse.y"
- {
- yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy410);
- if( yygotominor.yy172 ) {
- yygotominor.yy172->iColumn = yymsp[-3].minor.yy46;
- sqlite3ExprSpan(yygotominor.yy172, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
- }
- }
- #line 3146 "parse.c"
- break;
- case 281: /* raisetype ::= ROLLBACK */
- #line 1041 "parse.y"
- {yygotominor.yy46 = OE_Rollback;}
- #line 3151 "parse.c"
- break;
- case 283: /* raisetype ::= FAIL */
- #line 1043 "parse.y"
- {yygotominor.yy46 = OE_Fail;}
- #line 3156 "parse.c"
- break;
- case 284: /* cmd ::= DROP TRIGGER ifexists fullname */
- #line 1048 "parse.y"
- {
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy373,yymsp[-1].minor.yy46);
- }
- #line 3163 "parse.c"
- break;
- case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
- #line 1055 "parse.y"
- {
- sqlite3Attach(pParse, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy172);
- }
- #line 3170 "parse.c"
- break;
- case 286: /* cmd ::= DETACH database_kw_opt expr */
- #line 1058 "parse.y"
- {
- sqlite3Detach(pParse, yymsp[0].minor.yy172);
- }
- #line 3177 "parse.c"
- break;
- case 291: /* cmd ::= REINDEX */
- #line 1073 "parse.y"
- {sqlite3Reindex(pParse, 0, 0);}
- #line 3182 "parse.c"
- break;
- case 292: /* cmd ::= REINDEX nm dbnm */
- #line 1074 "parse.y"
- {sqlite3Reindex(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
- #line 3187 "parse.c"
- break;
- case 293: /* cmd ::= ANALYZE */
- #line 1079 "parse.y"
- {sqlite3Analyze(pParse, 0, 0);}
- #line 3192 "parse.c"
- break;
- case 294: /* cmd ::= ANALYZE nm dbnm */
- #line 1080 "parse.y"
- {sqlite3Analyze(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);}
- #line 3197 "parse.c"
- break;
- case 295: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
- #line 1085 "parse.y"
- {
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy373,&yymsp[0].minor.yy410);
- }
- #line 3204 "parse.c"
- break;
- case 296: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
- #line 1088 "parse.y"
- {
- sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy410);
- }
- #line 3211 "parse.c"
- break;
- case 297: /* add_column_fullname ::= fullname */
- #line 1091 "parse.y"
- {
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy373);
- }
- #line 3218 "parse.c"
- break;
- case 300: /* cmd ::= create_vtab */
- #line 1100 "parse.y"
- {sqlite3VtabFinishParse(pParse,0);}
- #line 3223 "parse.c"
- break;
- case 301: /* cmd ::= create_vtab LP vtabarglist RP */
- #line 1101 "parse.y"
- {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
- #line 3228 "parse.c"
- break;
- case 302: /* create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm */
- #line 1102 "parse.y"
- {
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, &yymsp[0].minor.yy410);
- }
- #line 3235 "parse.c"
- break;
- case 305: /* vtabarg ::= */
- #line 1107 "parse.y"
- {sqlite3VtabArgInit(pParse);}
- #line 3240 "parse.c"
- break;
- case 307: /* vtabargtoken ::= ANY */
- case 308: /* vtabargtoken ::= lp anylist RP */
- case 309: /* lp ::= LP */
- case 311: /* anylist ::= anylist ANY */
- #line 1109 "parse.y"
- {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
- #line 3248 "parse.c"
- break;
- };
- yygoto = yyRuleInfo[yyruleno].lhs;
- yysize = yyRuleInfo[yyruleno].nrhs;
- yypParser->yyidx -= yysize;
- yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
- if( yyact < YYNSTATE ){
- #ifdef NDEBUG
- /* If we are not debugging and the reduce action popped at least
- ** one element off the stack, then we can push the new element back
- ** onto the stack here, and skip the stack overflow test in yy_shift().
- ** That gives a significant speed improvement. */
- if( yysize ){
- yypParser->yyidx++;
- yymsp -= yysize-1;
- yymsp->stateno = yyact;
- yymsp->major = yygoto;
- yymsp->minor = yygotominor;
- }else
- #endif
- {
- yy_shift(yypParser,yyact,yygoto,&yygotominor);
- }
- }else{
- assert( yyact == YYNSTATE + YYNRULE + 1 );
- yy_accept(yypParser);
- }
- }
- /*
- ** The following code executes when the parse fails
- */
- static void yy_parse_failed(
- yyParser *yypParser /* The parser */
- ){
- sqlite3ParserARG_FETCH;
- #ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sFail!n",yyTracePrompt);
- }
- #endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
- /* Here code is inserted which will be executed whenever the
- ** parser fails */
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
- }
- /*
- ** The following code executes when a syntax error first occurs.
- */
- static void yy_syntax_error(
- yyParser *yypParser, /* The parser */
- int yymajor, /* The major type of the error token */
- YYMINORTYPE yyminor /* The minor type of the error token */
- ){
- sqlite3ParserARG_FETCH;
- #define TOKEN (yyminor.yy0)
- #line 34 "parse.y"
- assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */
- sqlite3ErrorMsg(pParse, "near "%T": syntax error", &TOKEN);
- pParse->parseError = 1;
- #line 3312 "parse.c"
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
- }
- /*
- ** The following is executed when the parser accepts
- */
- static void yy_accept(
- yyParser *yypParser /* The parser */
- ){
- sqlite3ParserARG_FETCH;
- #ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sAccept!n",yyTracePrompt);
- }
- #endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
- /* Here code is inserted which will be executed whenever the
- ** parser accepts */
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
- }
- /* The main parser program.
- ** The first argument is a pointer to a structure obtained from
- ** "sqlite3ParserAlloc" which describes the current state of the parser.
- ** The second argument is the major token number. The third is
- ** the minor token. The fourth optional argument is whatever the
- ** user wants (and specified in the grammar) and is available for
- ** use by the action routines.
- **
- ** Inputs:
- ** <ul>
- ** <li> A pointer to the parser (an opaque structure.)
- ** <li> The major token number.
- ** <li> The minor token number.
- ** <li> An option argument of a grammar-specified type.
- ** </ul>
- **
- ** Outputs:
- ** None.
- */
- void sqlite3Parser(
- void *yyp, /* The parser */
- int yymajor, /* The major token code number */
- sqlite3ParserTOKENTYPE yyminor /* The value for the token */
- sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */
- ){
- YYMINORTYPE yyminorunion;
- int yyact; /* The parser action. */
- int yyendofinput; /* True if we are at the end of input */
- #ifdef YYERRORSYMBOL
- int yyerrorhit = 0; /* True if yymajor has invoked an error */
- #endif
- yyParser *yypParser; /* The parser */
- /* (re)initialize the parser, if necessary */
- yypParser = (yyParser*)yyp;
- if( yypParser->yyidx<0 ){
- #if YYSTACKDEPTH<=0
- if( yypParser->yystksz <=0 ){
- /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
- yyminorunion = yyzerominor;
- yyStackOverflow(yypParser, &yyminorunion);
- return;
- }
- #endif
- yypParser->yyidx = 0;
- yypParser->yyerrcnt = -1;
- yypParser->yystack[0].stateno = 0;
- yypParser->yystack[0].major = 0;
- }
- yyminorunion.yy0 = yyminor;
- yyendofinput = (yymajor==0);
- sqlite3ParserARG_STORE;
- #ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sInput %sn",yyTracePrompt,yyTokenName[yymajor]);
- }
- #endif
- do{
- yyact = yy_find_shift_action(yypParser,yymajor);
- if( yyact<YYNSTATE ){
- assert( !yyendofinput ); /* Impossible to shift the $ token */
- yy_shift(yypParser,yyact,yymajor,&yyminorunion);
- yypParser->yyerrcnt--;
- yymajor = YYNOCODE;
- }else if( yyact < YYNSTATE + YYNRULE ){
- yy_reduce(yypParser,yyact-YYNSTATE);
- }else{
- assert( yyact == YY_ERROR_ACTION );
- #ifdef YYERRORSYMBOL
- int yymx;
- #endif
- #ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sSyntax Error!n",yyTracePrompt);
- }
- #endif
- #ifdef YYERRORSYMBOL
- /* A syntax error has occurred.
- ** The response to an error depends upon whether or not the
- ** grammar defines an error token "ERROR".
- **
- ** This is what we do if the grammar does define ERROR:
- **
- ** * Call the %syntax_error function.
- **
- ** * Begin popping the stack until we enter a state where
- ** it is legal to shift the error symbol, then shift
- ** the error symbol.
- **
- ** * Set the error count to three.
- **
- ** * Begin accepting and shifting new tokens. No new error
- ** processing will occur until three tokens have been
- ** shifted successfully.
- **
- */
- if( yypParser->yyerrcnt<0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
- }
- yymx = yypParser->yystack[yypParser->yyidx].major;
- if( yymx==YYERRORSYMBOL || yyerrorhit ){
- #ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sDiscard input token %sn",
- yyTracePrompt,yyTokenName[yymajor]);
- }
- #endif
- yy_destructor(yymajor,&yyminorunion);
- yymajor = YYNOCODE;
- }else{
- while(
- yypParser->yyidx >= 0 &&
- yymx != YYERRORSYMBOL &&
- (yyact = yy_find_reduce_action(
- yypParser->yystack[yypParser->yyidx].stateno,
- YYERRORSYMBOL)) >= YYNSTATE
- ){
- yy_pop_parser_stack(yypParser);
- }
- if( yypParser->yyidx < 0 || yymajor==0 ){
- yy_destructor(yymajor,&yyminorunion);
- yy_parse_failed(yypParser);
- yymajor = YYNOCODE;
- }else if( yymx!=YYERRORSYMBOL ){
- YYMINORTYPE u2;
- u2.YYERRSYMDT = 0;
- yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
- }
- }
- yypParser->yyerrcnt = 3;
- yyerrorhit = 1;
- #else /* YYERRORSYMBOL is not defined */
- /* This is what we do if the grammar does not define ERROR:
- **
- ** * Report an error message, and throw away the input token.
- **
- ** * If the input token is $, then fail the parse.
- **
- ** As before, subsequent error messages are suppressed until
- ** three input tokens have been successfully shifted.
- */
- if( yypParser->yyerrcnt<=0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
- }
- yypParser->yyerrcnt = 3;
- yy_destructor(yymajor,&yyminorunion);
- if( yyendofinput ){
- yy_parse_failed(yypParser);
- }
- yymajor = YYNOCODE;
- #endif
- }
- }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
- return;
- }