public EvaluatorResult Evaluate(string input)
        {
            var result = _evaluator.Evaluate(input);

            _logStorage.Log(new EvaluatorLog()
            {
                Input  = input,
                Output = result
            });
            return(result);
        }
Exemple #2
0
 private void EvaluateString(string input)
 {
     try
     {
         var result = _stringEvaluator.Evaluate(input);
         if (result.IsSuccessful)
         {
             Console.WriteLine($"{result.Result}");
         }
         else
         {
             FormatError(input, result.Diagnostics.First());
         }
     }
     catch (Exception e)
     {
         using (new ConsoleColorRegion(ConsoleColor.Red))
         {
             Console.WriteLine(e);
         }
     }
 }
 public EvaluatorOutputViewModel Evaluate([FromBody] EvaluatorInputViewModel evaluatorInputView)
 {
     return(EvaluatorOutputViewModel.FromModel(_evaluator.Evaluate(evaluatorInputView.Expression)));
 }