Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread bayareagreg
Thank you. I will try this -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread MG
I use Groovy as a programming, not as a script langage, so I have not done something like this myself, but something along the line of http://groovyconsole.appspot.com/script/112001 should work. On 26.11.2017 19:26, bayareagreg wrote: All right, let me explain why I need this. In my product, we

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread MG
After the clarification I would also recommend and approach along the line of waiting until the binding actually tries to access an unbound variable and evaluate its value then (since the name of the variables is not actually needed for anything else)... On 26.11.2017 19:47, Marcin Erdmann wro

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread Marcin Erdmann
Wouldn't it be easier for you then to implement a class which extends groovy.lang.Binding which lazy evaluates your default variables and use that as your script binding instead? On Sun, Nov 26, 2017 at 6:26 PM, bayareagreg wrote: > All right, let me explain why I need this. > In my product, we

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread bayareagreg
All right, let me explain why I need this. In my product, we let our users evaluate "custom" groovy expressions they construct. This is done in Java via groovy Script object. There are half a dozen "standard" product variables users can refer to in those expressions. The values of these variables a

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread mg
Betreff: Re: How to find out the names of variables used in a groovy expression HI Greg, Note: This list is primarily for developers and maintainers of the Groovy project, not for how to use Groovy. You could try us...@groovy.apache.org instead. As for your question, which is admittedly borderline:1

Re: How to find out the names of variables used in a groovy expression

2017-11-26 Thread Jesper Steen Møller
HI Greg, Note: This list is primarily for developers and maintainers of the Groovy project, not for how to use Groovy. You could try us...@groovy.apache.org instead. As for your question, which is admittedly borderline: 1) At compile time (i.e. in a macro or AST transformer), this should be doab

How to find out the names of variables used in a groovy expression

2017-11-26 Thread bayareagreg
Hello, I need to programmatically find out the names of variables used in a "simple" groovy expression that reads a value from one or more variables. One can assume the expression is read-only, that is no modifications of any state will be used. E.g. in an expression like this "${foo}", it should