]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor grammar changes that help the parser run faster by reducing the
authordrh <drh@noemail.net>
Fri, 27 Jul 2018 22:14:50 +0000 (22:14 +0000)
committerdrh <drh@noemail.net>
Fri, 27 Jul 2018 22:14:50 +0000 (22:14 +0000)
number of NUL rule reductions.

FossilOrigin-Name: cfd1b00592bd550e444dfc7b6a6a93c77c07b835729c6cc69a4b6361038964ba

manifest
manifest.uuid
src/parse.y

index ddb0ba8ef0497e40a524ddc4c578bd24f305815e..f5c3dd153686aede078fac44e7ab67645818a9da 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\sMakefile\sfor\sMSVC\sto\ssupport\sbuilding\sthe\sshell\stool\swithout\susing\sthe\samalgamation.
-D 2018-07-27T20:45:28.697
+C Minor\sgrammar\schanges\sthat\shelp\sthe\sparser\srun\sfaster\sby\sreducing\sthe\nnumber\sof\sNUL\srule\sreductions.
+D 2018-07-27T22:14:50.240
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
@@ -487,7 +487,7 @@ F src/os_win.c 070cdbb400097c6cda54aa005356095afdc2f3ee691d17192c54724ef146a971
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c 76d29b8a960dcb8b67210f095899d91e4a90673a6674ea58cfd1115b705a7fb9
 F src/pager.h c571b064df842ec8f2e90855dead9acf4cbe0d1b2c05afe0ef0d0145f7fd0388
-F src/parse.y 3bd43415ea974b9921b0ff2c0bd3e9100f6e501ede0b6d3b90cca2ab6af25485
+F src/parse.y a3020c881f558dea6dc1138c58a2a657c26c792120e019792d3e72801da0bf90
 F src/pcache.c 135ef0bc6fb2e3b7178d49ab5c9176254c8a691832c1bceb1156b2fbdd0869bd
 F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
 F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
@@ -1753,7 +1753,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f4229707ac08d66c5b0f53483ce17a63f5ac40a21922f66c3408e1b6fda3a7c2
-R 464c2ff9b3e195b7b1100f9454773c91
-U mistachkin
-Z e7898633f0a206319f76d54e6b9d0ac3
+P 3d815d83a6805938b87e03ffabe6d71ca2ecfd05052e8e02c6cc5d3c9ea4ddf3
+R fafb9bb1288976042bff1f58b5ef3552
+U drh
+Z cc0d4bd09cbef3882dca6f536e3b608a
index ff2eae2a86d575dbf9aa5a2403d049cc85cfc1a3..f8bb6bcf31eb23bb1f6a2631bc61246bd0c0264f 100644 (file)
@@ -1 +1 @@
-3d815d83a6805938b87e03ffabe6d71ca2ecfd05052e8e02c6cc5d3c9ea4ddf3
\ No newline at end of file
+cfd1b00592bd550e444dfc7b6a6a93c77c07b835729c6cc69a4b6361038964ba
\ No newline at end of file
index 1f7c30eaeb31147910b314b22567898d6b10c173..f8757df6ba00b3b7bcbc2328bb8c78fbdb342734 100644 (file)
@@ -531,21 +531,26 @@ multiselect_op(A) ::= UNION(OP).             {A = @OP; /*A-overwrites-OP*/}
 multiselect_op(A) ::= UNION ALL.             {A = TK_ALL;}
 multiselect_op(A) ::= EXCEPT|INTERSECT(OP).  {A = @OP; /*A-overwrites-OP*/}
 %endif SQLITE_OMIT_COMPOUND_SELECT
+
 oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
                  groupby_opt(P) having_opt(Q) 
+                 orderby_opt(Z) limit_opt(L). {
+  A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L);
+}
 %ifndef SQLITE_OMIT_WINDOWFUNC
-                 windowdefn_opt(R)
-%endif
+oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
+                 groupby_opt(P) having_opt(Q) window_clause(R)
                  orderby_opt(Z) limit_opt(L). {
   A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L);
-#ifndef SQLITE_OMIT_WINDOWFUNC
   if( A ){
     A->pWinDefn = R;
   }else{
     sqlite3WindowListDelete(pParse->db, R);
   }
-#endif /* SQLITE_OMIT_WINDOWFUNC */
 }
+%endif
+
+
 oneselect(A) ::= values(A).
 
 %type values {Select*}
@@ -993,11 +998,23 @@ expr(A) ::= CAST LP expr(E) AS typetoken(T) RP. {
   sqlite3ExprAttachSubtrees(pParse->db, A, E, 0);
 }
 %endif  SQLITE_OMIT_CAST
-expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP 
+
+
+expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP. {
+  if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
+    sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
+  }
+  A = sqlite3ExprFunction(pParse, Y, &X);
+  if( D==SF_Distinct && A ){
+    A->flags |= EP_Distinct;
+  }
+}
+expr(A) ::= id(X) LP STAR RP. {
+  A = sqlite3ExprFunction(pParse, 0, &X);
+}
+
 %ifndef SQLITE_OMIT_WINDOWFUNC
-  over_opt(Z)
-%endif
-. {
+expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP over_clause(Z). {
   if( Y && Y->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
     sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
   }
@@ -1007,14 +1024,12 @@ expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP
   }
   sqlite3WindowAttach(pParse, A, Z);
 }
-expr(A) ::= id(X) LP STAR RP
-%ifndef SQLITE_OMIT_WINDOWFUNC
-  over_opt(Z)
-%endif
-. {
+expr(A) ::= id(X) LP STAR RP over_clause(Z). {
   A = sqlite3ExprFunction(pParse, 0, &X);
   sqlite3WindowAttach(pParse, A, Z);
 }
+%endif
+
 term(A) ::= CTIME_KW(OP). {
   A = sqlite3ExprFunction(pParse, 0, &OP);
 }
@@ -1651,20 +1666,18 @@ frame_bound(A) ::= expr(X) PRECEDING.   { A.eType = TK_PRECEDING; A.pExpr = X; }
 frame_bound(A) ::= CURRENT ROW.         { A.eType = TK_CURRENT  ; A.pExpr = 0; }
 frame_bound(A) ::= expr(X) FOLLOWING.   { A.eType = TK_FOLLOWING; A.pExpr = X; }
 
-%type windowdefn_opt {Window*}
-%destructor windowdefn_opt {sqlite3WindowListDelete(pParse->db, $$);}
-windowdefn_opt(A) ::= . { A = 0; }
-windowdefn_opt(A) ::= WINDOW windowdefn_list(B). { A = B; }
+%type window_clause {Window*}
+%destructor window_clause {sqlite3WindowListDelete(pParse->db, $$);}
+window_clause(A) ::= WINDOW windowdefn_list(B). { A = B; }
 
-%type over_opt {Window*}
-%destructor over_opt {sqlite3WindowDelete(pParse->db, $$);}
-over_opt(A) ::= . { A = 0; }
-over_opt(A) ::= filter_opt(W) OVER window(Z). {
+%type over_clause {Window*}
+%destructor over_clause {sqlite3WindowDelete(pParse->db, $$);}
+over_clause(A) ::= filter_opt(W) OVER window(Z). {
   A = Z;
   assert( A!=0 );
   A->pFilter = W;
 }
-over_opt(A) ::= filter_opt(W) OVER nm(Z). {
+over_clause(A) ::= filter_opt(W) OVER nm(Z). {
   A = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
   if( A ){
     A->zName = sqlite3DbStrNDup(pParse->db, Z.z, Z.n);