[jexl] - Jexl parser tree - retrieve variables from expression

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jexl] - Jexl parser tree - retrieve variables from expression

David S Taylor
JEXL question:

Is there a way to take an expression such as “(x + y) / z)”  and get a parser tree or even just a list of the variables in the expression?

I would like to know what variables are in my expression, in the example above, I would want a list of x,y,z

Is that possible?

Thanks,


David




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jexl] - Jexl parser tree - retrieve variables from expression

henrib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jexl] - Jexl parser tree - retrieve variables from expression

David S Taylor
Thanks Henri that was exactly what I needed!


> On Jun 20, 2017, at 1:51 AM, henrib <[hidden email]> wrote:
>
> Hi David;
> Yes you can if you create a script.
> Have a look at
> http://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/JexlScript.html#getVariables
> .
> Many examples in
> https://github.com/apache/commons-jexl/blob/trunk/src/test/java/org/apache/commons/jexl3/VarTest.java
> Cheers.
>
>
>
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/jexl-Jexl-parser-tree-retrieve-variables-from-expression-tp4700492p4700496.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...