Jexl icon indicating copy to clipboard operation
Jexl copied to clipboard

Minus is not interpreted properly...

Open OlivierB-OB opened this issue 4 years ago • 4 comments

Hi @TomFrost

Minus is not interpreted properly...

[1, 2, 3] => OK https://czosel.github.io/jexl-playground/#/?input=%5B1%2C%202%2C%203%5D

[-1, 2, 3] => OK https://czosel.github.io/jexl-playground/#/?input=%5B-1%2C%202%2C%203%5D

[-1, -2, 3] => Error: Token - (binaryOp) unexpected in expression: [-1, - https://czosel.github.io/jexl-playground/#/?input=%5B-1%2C%20-2%2C%203%5D

Same issue with functions like: min(1, -2, 3)

OlivierB-OB avatar Dec 11 '20 16:12 OlivierB-OB

Hi @TomFrost

If I'm not mistaken in the file /lib/Lexer.js

The variable minusNegatesAfter should also contains 'comma'... const minusNegatesAfter = [ 'binaryOp', 'unaryOp', 'openParen', 'openBracket', 'question', 'colon' ]

OlivierB-OB avatar Dec 15 '20 08:12 OlivierB-OB

Hi @TomFrost

Do you have any update on this issue, please?

prafullkulkarni avatar Oct 08 '21 09:10 prafullkulkarni

Hi, sorry for the late response on this! Spot-on diagnosis -- I'll look to include this in the next release.

TomFrost avatar Nov 12 '21 16:11 TomFrost

@TomFrost Opened a pull request (https://github.com/TomFrost/Jexl/pull/122) with the suggested change from @OlivierB-OB

Dossar avatar Jun 09 '22 20:06 Dossar