diff options
Diffstat (limited to 'users/wpcarro/slx.js')
-rw-r--r-- | users/wpcarro/slx.js/index.js | 6 |
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; |