public override void Visit(Identifier parameter) { Result.Append("[").Append(parameter.Name).Append("] "); }
public override void Visit(Identifier parameter) { if (Parameters.ContainsKey(parameter.Name)) { // The parameter is defined in the hashtable if (Parameters[parameter.Name] is Expression) { // The parameter is itself another Expression var expression = (Expression)Parameters[parameter.Name]; // Overloads parameters foreach (var p in Parameters) { expression.Parameters[p.Key] = p.Value; } expression.EvaluateFunction += EvaluateFunction; expression.EvaluateParameter += EvaluateParameter; Result = ((Expression)Parameters[parameter.Name]).Evaluate(); } else Result = Parameters[parameter.Name]; } else if (parameter.Name.Contains(":")) { var parts = parameter.Name.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var part1 = parts[0]; var part2 = parts[1]; var list = GetValue(new Identifier(part1)) as ICollection; if (list == null) throw new Exception("Cannot enumerate " + part1 + " because it is not a collection"); var res = new List<object>(); foreach (var item in list) { var itemInfo = item as Dictionary<string, object>; if (itemInfo != null) { var expression = new Expression(part2) { Parameters = itemInfo }; res.Add(expression.Evaluate()); } } Result = res.ToArray(); } else { // The parameter should be defined in a call back method Result = GetValue(parameter); } }
private object GetValue(Identifier parameter) { var args = new ParameterArgs(); // Calls external implementation OnEvaluateParameter(parameter.Name, args); if (!args.HasResult) throw new ArgumentException("Parameter was not defined", parameter.Name); return args.Result; }
public override void Visit(Identifier parameter) { var parts = parameter.Name.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (parts.Length <= 1) { Result.Append("##" + parameter.Name + "##"); //if (Values.ContainsKey(parameter.Name)) //Result.Append(Values[parameter.Name]); } else { //if (Values.ContainsKey(parameter.Name)) //Result.AppendFormat("GetContextResult({0} as List<object>, \"{1}\").ToArray()", parts[0], parts[1]); } }
public override void Visit(Identifier parameter) { if (Parameters.ContainsKey(parameter.Name)) { // The parameter is defined in the hashtable if (Parameters[parameter.Name] is Expression) { // The parameter is itself another Expression var expression = (Expression)Parameters[parameter.Name]; // Overloads parameters foreach (var p in Parameters) { expression.Parameters[p.Key] = p.Value; } expression.EvaluateFunction += EvaluateFunction; expression.EvaluateParameter += EvaluateParameter; Result = ((Expression)Parameters[parameter.Name]).Evaluate(); } else Result = Parameters[parameter.Name]; } else { // The parameter should be defined in a call back method var args = new ParameterArgs(); // Calls external implementation OnEvaluateParameter(parameter.Name, args); if (!args.HasResult) throw new ArgumentException("Parameter was not defined", parameter.Name); Result = args.Result; } }
public override void Visit(Identifier function) { _result = L.Expression.PropertyOrField(_parameter, function.Name); }
public override void Visit(NCalc.Domain.Identifier function) { //Parameter - add to list Parameters.Add(function.Name); }
public override void Visit(Identifier parameter) { var parts = parameter.Name.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (parts.Length <= 1) { Result.Append(parameter.Name); } else { Result.AppendFormat("GetInput(\"{0}\")", string.Join("\", \"", parts)); } }
public override void Visit(Identifier function) { //Parameter - add to list Parameters.Add(function.Name); }
public override void Visit(NCalc.Domain.Identifier function) { ComplexExpression = true; }
public override void Visit(Identifier function) { Variables.Add(function.Name.Split(":".ToCharArray())[0]); }
public abstract Task VisitAsync(Identifier function);
public abstract void Visit(Identifier function);