/ Check-in [b48a4bfd]
Login

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

Overview
Comment:Fix a bug in the grammar. We were giving the ones-complement operator ~ the same precedence as the NOT operator, which is incorrect. (CVS 4548)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b48a4bfd3288906dfb7659c37f76d345011c91a0
User & Date: drh 2007-11-17 22:23:28
Context
2007-11-21
15:24
Handle out-of-memory situations inside the query flattener. Ticket #2784. (CVS 4549) check-in: 2655a3f2 user: drh tags: trunk
2007-11-17
22:23
Fix a bug in the grammar. We were giving the ones-complement operator ~ the same precedence as the NOT operator, which is incorrect. (CVS 4548) check-in: b48a4bfd user: drh tags: trunk
2007-11-16
14:55
Fix a crash that can occur after a malloc failure. Ticket #2775. (CVS 4547) check-in: c91bc8d3 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.235 2007/11/12 09:50:26 danielk1977 Exp $
           17  +** @(#) $Id: parse.y,v 1.236 2007/11/17 22:23:28 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
   645    645   expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
   646    646     Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
   647    647     Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
   648    648     Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Z);
   649    649     Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
   650    650     A = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
   651    651   }
   652         -term(A) ::= INTEGER|FLOAT|BLOB(X).      {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
          652  +term(A) ::= INTEGER|FLOAT|BLOB(X).  {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
   653    653   term(A) ::= STRING(X).       {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
   654    654   expr(A) ::= REGISTER(X).     {A = sqlite3RegisterExpr(pParse, &X);}
   655    655   expr(A) ::= VARIABLE(X).     {
   656    656     Token *pToken = &X;
   657    657     Expr *pExpr = A = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken);
   658    658     sqlite3ExprAssignVarNumber(pParse, pExpr);
   659    659   }
................................................................................
   734    734     A = sqlite3PExpr(pParse, TK_NOTNULL, X, 0, 0);
   735    735     sqlite3ExprSpan(A,&X->span,&E);
   736    736   }
   737    737   expr(A) ::= expr(X) IS NOT NULL(E). {
   738    738     A = sqlite3PExpr(pParse, TK_NOTNULL, X, 0, 0);
   739    739     sqlite3ExprSpan(A,&X->span,&E);
   740    740   }
   741         -expr(A) ::= NOT|BITNOT(B) expr(X). {
          741  +expr(A) ::= NOT(B) expr(X). {
          742  +  A = sqlite3PExpr(pParse, @B, X, 0, 0);
          743  +  sqlite3ExprSpan(A,&B,&X->span);
          744  +}
          745  +expr(A) ::= BITNOT(B) expr(X). {
   742    746     A = sqlite3PExpr(pParse, @B, X, 0, 0);
   743    747     sqlite3ExprSpan(A,&B,&X->span);
   744    748   }
   745    749   expr(A) ::= MINUS(B) expr(X). [UMINUS] {
   746    750     A = sqlite3PExpr(pParse, TK_UMINUS, X, 0, 0);
   747    751     sqlite3ExprSpan(A,&B,&X->span);
   748    752   }