expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

Add operator renaming

Open SHND opened this issue 6 years ago • 3 comments

I really like this package but the only thing that kind of bothers me is lengthy operators: and, or, ... .

I'm using this package to to write conditional expressions in my routing strings.

It would be awesome if there was a configuration to rename for example and to &.

SHND avatar Oct 12 '19 02:10 SHND

From a brief look at the code, you should be able to alter parser.binaryOps just like you can alter parser.functions even though it's not in the documentation.

I think this would solve your issue.

Telokis avatar Oct 14 '19 13:10 Telokis

@Telokis That won't quite work, because that only comes into play after the expression is parsed. You would also need to modify the parser to recognize the & and | symbols.

I have some ideas on how we could do this, but I'll need to give it some more thought.

silentmatt avatar Oct 14 '19 22:10 silentmatt

@silentmatt Ok, my bad, I suppose I looked too quickly before answering! Thanks for clarifying!

Telokis avatar Oct 15 '19 15:10 Telokis