using System.Collections.Generic;
using CodingSeb.ExpressionEvaluator;
public static void Main()
ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.OptionsSyntaxRules.MandatoryLastStatementTerminalPunctuator = false;
evaluator.OptionsSyntaxRules.IsNewKeywordForAnonymousExpandoObjectOptional = true;
evaluator.OptionsSyntaxRules.InitializerPropertyValueSeparators = new[] { "=", ":" };
evaluator.OptionsSyntaxRules.InitializerAllowStringForProperties = true;
evaluator.OptionsSyntaxRules.AllowSimplifiedCollectionSyntax = true;
evaluator.OptionsSyntaxRules.SimplifiedCollectionMode = SimplifiedCollectionMode.List;
List<string> expressions = new List<string>()
"var person = { LastName: \"Smith\", FirstName: \"John\" }; $\"Hello {person.FirstName} {person.LastName}\"",
"{ \"TestProperty\": [3.3, 4.5] }.TestProperty.Cast<double>().Sum()",
"string.Join(\"\\r\\n\", [ { LastName: \"Smith\", FirstName: \"John\" }, { LastName: \"Gate\", FirstName: \"Bill\" }, { LastName: \"Musk\", FirstName: \"Elon\" } ].Select(person => $\"Hello {person.FirstName} {person.LastName}\").ToArray())"
expressions.ForEach(expression =>
Console.WriteLine(expression);
Console.WriteLine(evaluator.ScriptEvaluate(expression));
Console.WriteLine(string.Empty);
catch(Exception exception)
Console.WriteLine(exception);
Console.WriteLine(string.Empty);