[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql f9820deed7 056/427: Add unary operators.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql f9820deed7 056/427: Add unary operators. |
Date: |
Tue, 13 Dec 2022 02:59:27 -0500 (EST) |
branch: elpa/emacsql
commit f9820deed75c6a9afbb4310bd5e08cbe96e72b68
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add unary operators.
---
emacsql.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index 17ff1231b4..6b89a35bc4 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -398,6 +398,7 @@ definitions for return from a `emacsql-defexpander'."
(cl-destructuring-bind (op . args) expr
(cl-flet ((recur (n) (combine (emacsql--expr (nth n args)))))
(cl-ecase op
+ ;; Trinary/binary
((<= >=)
(cl-ecase (length args)
(2 (format "%s %s %s" (recur 0) op (recur 1)))
@@ -405,13 +406,24 @@ definitions for return from a `emacsql-defexpander'."
(recur 1)
(recur (if (eq op '>=) 2 0))
(recur (if (eq op '>=) 0 2))))))
- ((< > = != like glob is and or * / % << >> + - & |)
+ ;; Binary
+ ((< > = != like glob is and or * / % << >> + & |)
(if (= 2 (length args))
(format "%s %s %s"
(recur 0)
(if (eq op '%) '%% (upcase (symbol-name op)))
(recur 1))
- (error "Wrong number of operands for %s" op)))))))))
+ (error "Wrong number of operands for %s" op)))
+ ;; Unary
+ ((not)
+ (if (= 1 (length args))
+ (format "%s %s" (upcase (symbol-name op)) (recur 0))
+ (error "Wrong number of operands for %s" op)))
+ ;; Unary/Binary
+ ((-)
+ (cl-ecase (length args)
+ (1 (format "-(%s)" (recur 0)))
+ (2 (format "%s - %s" (recur 0) (recur 1)))))))))))
;; SQL Expansion Functions:
- [nongnu] elpa/emacsql 7cfed08ab8 099/427: Add docstring to emacsql--log., (continued)
- [nongnu] elpa/emacsql 7cfed08ab8 099/427: Add docstring to emacsql--log., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql da9797e948 098/427: Add a system-level test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bd6e02db55 104/427: Be much more strict with identifiers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 682c1816fb 111/427: Add optional font-locking., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3eb06cdd73 114/427: Add GROUP BY expander., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e08094c78f 058/427: More precise parsing., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b9599f1f41 066/427: Spelling error., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f410b5d663 068/427: Fix spelling error., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql b3110c9fa9 018/427: Rename .sqlite to .db., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 031ec59f18 048/427: Add combine function to with-vars macro., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f9820deed7 056/427: Add unary operators.,
ELPA Syncer <=
- [nongnu] elpa/emacsql f9c562b0a4 069/427: Add SQLite link., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 43ecb5a252 071/427: Tweak README names., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 58e31aa3a9 079/427: Add :update and :set expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c9aab20d47 082/427: Add in operator (special case operator)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 25f9817064 094/427: Add work-in-progress note back., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 03295cba37 119/427: Add ORDER BY expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d1c0904564 120/427: Fix missing quotes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4718ff4e89 122/427: Simplify all the expanders with new local functions., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 54247e4b5e 127/427: Add another insertion unit test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql aa9283ca0a 132/427: Allow sub-selects with :from., ELPA Syncer, 2022/12/13