0

Is it possible to parse functions with an e (as the euler function) in it? Such as:

x*e

I get undefined variable e with this:

var jexl = JexlBuilder().create()
var jexlEpxression = jexl.createExpression("x*e") //still works
var jexlContext = MapContext()
jexlContext.set("x",1.0)
jexlExpression.evaluate(jexlContext) // undefined variable e

Of course there could be this manual fix:

val containsE = "x*e".contains("e")
if(containsE)
   jexlContext.set("e",Math.E)
binaryBigInt
  • 1,526
  • 2
  • 18
  • 44

1 Answers1

0

Not sure what your question is. JEXL does not check variable existence at script creation time; with JEXL3, you can determine which variables are used in a script (JexlScript) by calling the 'getVariables()' method. More specifically, if 'e' is a variable that should always be accessible in your use case, I'd suggest systematically adding it to your context (or override context).

henrib
  • 187
  • 6