/ Check-in [cfd1b005]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor grammar changes that help the parser run faster by reducing the number of NUL rule reductions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:cfd1b00592bd550e444dfc7b6a6a93c77c07b835729c6cc69a4b6361038964ba
User & Date: drh 2018-07-27 22:14:50
Context
2018-07-27
22:55
When doing a DROP VIEW do not try to delete entries from the sqlite_stat1 table as there are none. check-in: 7efdba2b user: drh tags: trunk
22:14
Minor grammar changes that help the parser run faster by reducing the number of NUL rule reductions. check-in: cfd1b005 user: drh tags: trunk
20:45
Enhance Makefile for MSVC to support building the shell tool without using the amalgamation. check-in: 3d815d83 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

   527    527     A = pRhs;
   528    528   }
   529    529   %type multiselect_op {int}
   530    530   multiselect_op(A) ::= UNION(OP).             {A = @OP; /*A-overwrites-OP*/}
   531    531   multiselect_op(A) ::= UNION ALL.             {A = TK_ALL;}
   532    532   multiselect_op(A) ::= EXCEPT|INTERSECT(OP).  {A = @OP; /*A-overwrites-OP*/}
   533    533   %endif SQLITE_OMIT_COMPOUND_SELECT
          534  +
   534    535   oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
   535    536                    groupby_opt(P) having_opt(Q) 
          537  +                 orderby_opt(Z) limit_opt(L). {
          538  +  A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L);
          539  +}
   536    540   %ifndef SQLITE_OMIT_WINDOWFUNC
   537         -                 windowdefn_opt(R)
   538         -%endif
          541  +oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
          542  +                 groupby_opt(P) having_opt(Q) window_clause(R)
   539    543                    orderby_opt(Z) limit_opt(L). {
   540    544     A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L);
   541         -#ifndef SQLITE_OMIT_WINDOWFUNC
   542    545     if( A ){
   543    546       A->pWinDefn = R;
   544    547     }else{
   545    548       sqlite3WindowListDelete(pParse->db, R);
   546    549     }
   547         -#endif /* SQLITE_OMIT_WINDOWFUNC */
   548    550   }
          551  +%endif
          552  +
          553  +
   549    554   oneselect(A) ::= values(A).
   550    555   
   551    556   %type values {Select*}
   552    557   %destructor values {sqlite3SelectDelete(pParse->db, $$);}
   553    558   values(A) ::= VALUES LP nexprlist(X) RP. {
   554    559     A = sqlite3SelectNew(pParse,X,0,0,0,0,0,SF_Values,0);
   555    560   }
................................................................................
   989    994   }
   990    995   %ifndef SQLITE_OMIT_CAST
   991    996   expr(A) ::= CAST LP expr(E) AS typetoken(T) RP. {
   992    997     A = sqlite3ExprAlloc(pParse->db, TK_CAST, &T, 1);
   993    998     sqlite3ExprAttachSubtrees(pParse->db, A, E, 0);
   994    999   }
   995   1000   %endif  SQLITE_OMIT_CAST
   996         -expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP 
         1001  +
         1002  +
         1003  +expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP. {
         1004  +  if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
         1005  +    sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
         1006  +  }
         1007  +  A = sqlite3ExprFunction(pParse, Y, &X);
         1008  +  if( D==SF_Distinct && A ){
         1009  +    A->flags |= EP_Distinct;
         1010  +  }
         1011  +}
         1012  +expr(A) ::= id(X) LP STAR RP. {
         1013  +  A = sqlite3ExprFunction(pParse, 0, &X);
         1014  +}
         1015  +
   997   1016   %ifndef SQLITE_OMIT_WINDOWFUNC
   998         -  over_opt(Z)
   999         -%endif
  1000         -. {
         1017  +expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP over_clause(Z). {
  1001   1018     if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
  1002   1019       sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
  1003   1020     }
  1004   1021     A = sqlite3ExprFunction(pParse, Y, &X);
  1005   1022     if( D==SF_Distinct && A ){
  1006   1023       A->flags |= EP_Distinct;
  1007   1024     }
  1008   1025     sqlite3WindowAttach(pParse, A, Z);
  1009   1026   }
  1010         -expr(A) ::= id(X) LP STAR RP
  1011         -%ifndef SQLITE_OMIT_WINDOWFUNC
  1012         -  over_opt(Z)
  1013         -%endif
  1014         -. {
         1027  +expr(A) ::= id(X) LP STAR RP over_clause(Z). {
  1015   1028     A = sqlite3ExprFunction(pParse, 0, &X);
  1016   1029     sqlite3WindowAttach(pParse, A, Z);
  1017   1030   }
         1031  +%endif
         1032  +
  1018   1033   term(A) ::= CTIME_KW(OP). {
  1019   1034     A = sqlite3ExprFunction(pParse, 0, &OP);
  1020   1035   }
  1021   1036   
  1022   1037   expr(A) ::= LP nexprlist(X) COMMA expr(Y) RP. {
  1023   1038     ExprList *pList = sqlite3ExprListAppend(pParse, X, Y);
  1024   1039     A = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
................................................................................
  1647   1662   frame_bound_e(A) ::= frame_bound(X). { A = X; }
  1648   1663   frame_bound_e(A) ::= UNBOUNDED FOLLOWING. {A.eType = TK_UNBOUNDED; A.pExpr = 0;}
  1649   1664   
  1650   1665   frame_bound(A) ::= expr(X) PRECEDING.   { A.eType = TK_PRECEDING; A.pExpr = X; }
  1651   1666   frame_bound(A) ::= CURRENT ROW.         { A.eType = TK_CURRENT  ; A.pExpr = 0; }
  1652   1667   frame_bound(A) ::= expr(X) FOLLOWING.   { A.eType = TK_FOLLOWING; A.pExpr = X; }
  1653   1668   
  1654         -%type windowdefn_opt {Window*}
  1655         -%destructor windowdefn_opt {sqlite3WindowListDelete(pParse->db, $$);}
  1656         -windowdefn_opt(A) ::= . { A = 0; }
  1657         -windowdefn_opt(A) ::= WINDOW windowdefn_list(B). { A = B; }
         1669  +%type window_clause {Window*}
         1670  +%destructor window_clause {sqlite3WindowListDelete(pParse->db, $$);}
         1671  +window_clause(A) ::= WINDOW windowdefn_list(B). { A = B; }
  1658   1672   
  1659         -%type over_opt {Window*}
  1660         -%destructor over_opt {sqlite3WindowDelete(pParse->db, $$);}
  1661         -over_opt(A) ::= . { A = 0; }
  1662         -over_opt(A) ::= filter_opt(W) OVER window(Z). {
         1673  +%type over_clause {Window*}
         1674  +%destructor over_clause {sqlite3WindowDelete(pParse->db, $$);}
         1675  +over_clause(A) ::= filter_opt(W) OVER window(Z). {
  1663   1676     A = Z;
  1664   1677     assert( A!=0 );
  1665   1678     A->pFilter = W;
  1666   1679   }
  1667         -over_opt(A) ::= filter_opt(W) OVER nm(Z). {
         1680  +over_clause(A) ::= filter_opt(W) OVER nm(Z). {
  1668   1681     A = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  1669   1682     if( A ){
  1670   1683       A->zName = sqlite3DbStrNDup(pParse->db, Z.z, Z.n);
  1671   1684       A->pFilter = W;
  1672   1685     }else{
  1673   1686       sqlite3ExprDelete(pParse->db, W);
  1674   1687     }
  1675   1688   }
  1676   1689   
  1677   1690   filter_opt(A) ::= .                            { A = 0; }
  1678   1691   filter_opt(A) ::= FILTER LP WHERE expr(X) RP.  { A = X; }
  1679   1692   %endif /* SQLITE_OMIT_WINDOWFUNC */