You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My idea seems pretty limited in scope, but based on this request it would be possible to add in a ParameterInterceptor style functionality. The end user would receive the ParameterExpression, its current value, and if we wanted they could return the value or a different value (this could give them the means to do some extra validation inline).
var expr = "x * y + 2";
var target = new Interpreter();
var updatedText = expr;
target.ParameterInterceptor += (Parameter expression, int? textIndex, object currentValue) =>
{
updatedText = updatedText.Replace(expression.Name, currentValue?.ToString());
return currentValue;
};
var parsedAmount = interpreter.Parse(expr, parameters);
parsedAmount.Invoke(parameters);
It's a pretty limited example that would need a LOT more code on the end user's side if parameter names were used multiple times, but it would give the flexibility needed to see exactly what is being ran.
Does there exist any intermediate option to resolve the variables by the given parameters brefore the final result?
For Example I have
And I would like to have the result before the final result returned. E.g.
My current workaround is to do a string replacement, like so:
The text was updated successfully, but these errors were encountered: