/ Check-in [3e5975aa]
Login

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

Overview
Comment:Fix a parser bug that was causing the relative precedence of LIKE and < operators to be incorrect.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3e5975aa3bb9df9e1f954bcce99384e0f13cb453
User & Date: drh 2010-07-19 02:30:33
References
2010-07-19
05:27
Enable previously failing tests in e_expr.test that pass following [3e5975aa3b]. check-in: 3d59c54a user: dan tags: trunk
Context
2010-07-19
05:27
Enable previously failing tests in e_expr.test that pass following [3e5975aa3b]. check-in: 3d59c54a user: dan tags: trunk
02:30
Fix a parser bug that was causing the relative precedence of LIKE and < operators to be incorrect. check-in: 3e5975aa user: drh tags: trunk
01:52
Improvements to the formatting of parse.out file from Lemon. Add the -r option to Lemon to disable the state sorting, making debugging easier. check-in: a2eaf829 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

   844    844                                           {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
   845    845   expr(A) ::= expr(X) CONCAT(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
   846    846   %type likeop {struct LikeOp}
   847    847   likeop(A) ::= LIKE_KW(X).     {A.eOperator = X; A.not = 0;}
   848    848   likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
   849    849   likeop(A) ::= MATCH(X).       {A.eOperator = X; A.not = 0;}
   850    850   likeop(A) ::= NOT MATCH(X).   {A.eOperator = X; A.not = 1;}
   851         -%type escape {ExprSpan}
   852         -%destructor escape {sqlite3ExprDelete(pParse->db, $$.pExpr);}
   853         -escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;}
   854         -escape(X) ::= .               [ESCAPE] {memset(&X,0,sizeof(X));}
   855         -expr(A) ::= expr(X) likeop(OP) expr(Y) escape(E).  [LIKE_KW]  {
          851  +expr(A) ::= expr(X) likeop(OP) expr(Y).  [LIKE_KW]  {
   856    852     ExprList *pList;
   857    853     pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
   858    854     pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
   859         -  if( E.pExpr ){
   860         -    pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
   861         -  }
   862    855     A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
   863    856     if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
   864    857     A.zStart = X.zStart;
   865    858     A.zEnd = Y.zEnd;
   866    859     if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
          860  +}
          861  +expr(A) ::= expr(X) likeop(OP) expr(Y) ESCAPE expr(E).  [LIKE_KW]  {
          862  +  ExprList *pList;
          863  +  pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
          864  +  pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
          865  +  pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
          866  +  A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
          867  +  if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
          868  +  A.zStart = X.zStart;
          869  +  A.zEnd = E.zEnd;
          870  +  if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
   867    871   }
   868    872   
   869    873   %include {
   870    874     /* Construct an expression node for a unary postfix operator
   871    875     */
   872    876     static void spanUnaryPostfix(
   873    877       ExprSpan *pOut,        /* Write the new expression node here */