From e9cf59e344a17fe4ecc3a42e6332e5a6ada6e4f4 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 17 Nov 2007 22:23:27 +0000 Subject: [PATCH] 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) FossilOrigin-Name: b48a4bfd3288906dfb7659c37f76d345011c91a0 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/parse.y | 10 +++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 41c0e9438e..40c0e37617 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scrash\sthat\scan\soccur\safter\sa\smalloc\sfailure.\sTicket\s#2775.\s(CVS\s4547) -D 2007-11-16T14:55:46 +C Fix\sa\sbug\sin\sthe\sgrammar.\s\sWe\swere\sgiving\sthe\sones-complement\soperator\s~\nthe\ssame\sprecedence\sas\sthe\sNOT\soperator,\swhich\sis\sincorrect.\s(CVS\s4548) +D 2007-11-17T22:23:28 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 30c7e3ba426ddb253b8ef037d1873425da6009a8 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -124,7 +124,7 @@ F src/os_win.c 1fb40eb62fb0719ea578d69edcb1a2974f04d214 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c c5ffa55c299663b579fbcb430752c1e79d302c5b F src/pager.h d783e7f184afdc33adff37ba58d4e029bd8793b3 -F src/parse.y 9640f5b930b1d0bfd05d7428da6f762305567cbb +F src/parse.y a780b33ef45dd7b3272319cf91e609d6f109a31c F src/pragma.c cb1486e76dbcad757968afc4083d3472032e62b5 F src/prepare.c 5dd06102c4c538fcbb9c71d35e505abb9fcbd269 F src/printf.c 96c8d55315a13fc53cb3754cb15046f3ff891ea2 @@ -587,7 +587,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 75cb46f82a6a95dbe9e279dede299bafa2e91cae -R db6e8cd2b0253bfa9f1838461fb83598 -U danielk1977 -Z 8aaad7de19e849e912adf927a02f955d +P c91bc8d33306881cb2501070dccced92c82cf165 +R f495654da7f05f56c3843abadb2b39ff +U drh +Z 9ed8b035bc2cdc74a8bdbfe23b254bc4 diff --git a/manifest.uuid b/manifest.uuid index 5c0bb12018..4fc74a7ccf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c91bc8d33306881cb2501070dccced92c82cf165 \ No newline at end of file +b48a4bfd3288906dfb7659c37f76d345011c91a0 \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index 9b41a71660..723e7a1bc2 100644 --- a/src/parse.y +++ b/src/parse.y @@ -14,7 +14,7 @@ ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** -** @(#) $Id: parse.y,v 1.235 2007/11/12 09:50:26 danielk1977 Exp $ +** @(#) $Id: parse.y,v 1.236 2007/11/17 22:23:28 drh Exp $ */ // All token codes are small integers with #defines that begin with "TK_" @@ -649,7 +649,7 @@ expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). { Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); A = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); } -term(A) ::= INTEGER|FLOAT|BLOB(X). {A = sqlite3PExpr(pParse, @X, 0, 0, &X);} +term(A) ::= INTEGER|FLOAT|BLOB(X). {A = sqlite3PExpr(pParse, @X, 0, 0, &X);} term(A) ::= STRING(X). {A = sqlite3PExpr(pParse, @X, 0, 0, &X);} expr(A) ::= REGISTER(X). {A = sqlite3RegisterExpr(pParse, &X);} expr(A) ::= VARIABLE(X). { @@ -738,7 +738,11 @@ expr(A) ::= expr(X) IS NOT NULL(E). { A = sqlite3PExpr(pParse, TK_NOTNULL, X, 0, 0); sqlite3ExprSpan(A,&X->span,&E); } -expr(A) ::= NOT|BITNOT(B) expr(X). { +expr(A) ::= NOT(B) expr(X). { + A = sqlite3PExpr(pParse, @B, X, 0, 0); + sqlite3ExprSpan(A,&B,&X->span); +} +expr(A) ::= BITNOT(B) expr(X). { A = sqlite3PExpr(pParse, @B, X, 0, 0); sqlite3ExprSpan(A,&B,&X->span); } -- 2.47.3