[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 5f30787890 375/427: Add precedence handling for "b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 5f30787890 375/427: Add precedence handling for "between" syntax |
Date: |
Tue, 13 Dec 2022 03:00:12 -0500 (EST) |
branch: elpa/emacsql
commit 5f30787890441bb8cce25ad9953fa503bf14fd93
Author: Ákos Kiss <ak@coram.pub>
Commit: Ákos Kiss <ak@coram.pub>
Add precedence handling for "between" syntax
---
emacsql-compiler.el | 5 ++++-
tests/emacsql-compiler-tests.el | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/emacsql-compiler.el b/emacsql-compiler.el
index b1aae9ce63..8c9bdbc2d8 100644
--- a/emacsql-compiler.el
+++ b/emacsql-compiler.el
@@ -360,7 +360,10 @@ Only use within `emacsql-with-params'!"
((<= >=)
(cl-case (length args)
(2 (format format-string (recur 0) (recur 1)))
- (3 (format "%s BETWEEN %s AND %s"
+ (3 (format (if (>= (or parent-precedence-value 0)
+ precedence-value)
+ "(%s BETWEEN %s AND %s)"
+ "%s BETWEEN %s AND %s")
(recur 1)
(recur (if (eq op '>=) 2 0))
(recur (if (eq op '>=) 0 2))))
diff --git a/tests/emacsql-compiler-tests.el b/tests/emacsql-compiler-tests.el
index 79ec6b41e6..aad9b53fcd 100644
--- a/tests/emacsql-compiler-tests.el
+++ b/tests/emacsql-compiler-tests.el
@@ -242,7 +242,9 @@
([:select (funcall length (|| (* x x) (* y y) (* z z)))] '()
"SELECT length((x * x) || (y * y) || (z * z));")
([:select (and (+ (<= x y) 1) (>= y x))] '()
- "SELECT (x <= y) + 1 AND y >= x;")))
+ "SELECT (x <= y) + 1 AND y >= x;")
+ ([:select (or (& (<= x (+ y 1) (- z)) 1) (>= x z y))] '()
+ "SELECT (y + 1 BETWEEN x AND -z) & 1 OR z BETWEEN y AND x;")))
(provide 'emacsql-compiler-tests)
- [nongnu] elpa/emacsql 8c46fb2c1e 286/427: Drop argument count check since it's wrong., (continued)
- [nongnu] elpa/emacsql 8c46fb2c1e 286/427: Drop argument count check since it's wrong., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 641338533c 331/427: Just build SQLite on first connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 56a2882936 333/427: Update README for Melpa changes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1b37570bf5 352/427: Fix up the Makefile., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2e9e2d6ba1 390/427: Fix SQL truncated when print-level or print-length are changed, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 50b139443b 414/427: make: Fix compiling and cleaning tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4fe4413994 420/427: Re-indent some data so that machine and human can agree, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 62d3915737 363/427: Update to SQLite 3.22.0 and remove download system (#40), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a164ecd9d3 374/427: Implement operator precedence handling, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 214b46f547 372/427: Update documentation for building SQLite backend (#46), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5f30787890 375/427: Add precedence handling for "between" syntax,
ELPA Syncer <=
- [nongnu] elpa/emacsql 60b99760c5 371/427: Extend the compiler search to a configurable list (#45), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 373975cbcc 387/427: Remove types from cl-defgeneric arguments, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9dca599616 383/427: Fix whitespace, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2fa32d2ab7 395/427: Create new log buffer if existing one isn't live anymore, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 374726060d 385/427: Fix buffer struct allocation size (fixes #91), ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d5c37d905d 379/427: Put emacs-version in path for out-of-package binary, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1ce92a6f4a 397/427: No longer require emacsql-psql in emacsql-pg, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d03c1a606f 392/427: Include optional .config.mk in Makefile, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6622516e15 393/427: Update library headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b405d99aed 408/427: make: Don't use LDFLAGS to set Emacs load-path, ELPA Syncer, 2022/12/13