about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2023-01-20T18·29-0800
committerclbot <clbot@tvl.fyi>2023-01-20T18·34+0000
commitf91785bcc2efea5a560acddcbf4ce0d91c27e850 (patch)
treec6262e9d5367efefbe763afd6fbeec558a2ab96b /users
parent9df188ad0320fac33c57065eb1d166e8c7713158 (diff)
feat(wpcarro/slx): Support EQ operator r/5711
Naturally...

Change-Id: I9802a12db65eb07ed820e6ec1b56a9528001d0b8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7879
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'users')
-rw-r--r--users/wpcarro/slx.js/index.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/users/wpcarro/slx.js/index.js b/users/wpcarro/slx.js/index.js
index 44f2f3643f8c..0f980c8d5a97 100644
--- a/users/wpcarro/slx.js/index.js
+++ b/users/wpcarro/slx.js/index.js
@@ -53,6 +53,7 @@ function compile(ast, config) {
         const f = compile(ast.val, config);
 
         let compare = null;
+        if (ast.operator === 'EQ') { compare = (x, y) => x === y; }
         if (ast.operator === 'LT') { compare = (x, y) => x < y; }
         if (ast.operator === 'GT') { compare = (x, y) => x > y; }
         if (ast.operator === 'LTE') { compare = (x, y) => x <= y; }
@@ -150,6 +151,11 @@ function tokenize(x) {
             result.push(['ATOM', curr]);
             continue;
         }
+        if (x[i] === '=') {
+            result.push(['COMPARE', 'EQ']);
+            i += 1;
+            continue;
+        }
         if (x[i] === '<' && i + 1 < x.length && x[i + 1] === '=') {
             result.push(['COMPARE', 'LTE']);
             i += 1;