ExpressionEvaluator
ExpressionEvaluator copied to clipboard
A Simple Math and Pseudo C# Expression Evaluator in One C# File. Can also execute small C# like scripts
&& || operator not short-circuit as C# did
x = 100; if( false && (x=50) > 100 ) return 0; return x; // --------------------------// x = 100; if( true || (x=50) < 0 ) return x; return 0;...
`OptionForceIntegerNumbersEvaluationsAsDoubleByDefault` leads to not recognising three parameter version of Math.Round
The code ``` var evaluator = new ExpressionEvaluator() { OptionForceIntegerNumbersEvaluationsAsDoubleByDefault = true }; string expression = "Math.Round(1,0,MidpointRounding.AwayFromZero)"; Console.WriteLine(expression); Console.WriteLine(evaluator.Evaluate(expression)); ``` gives the error > [System.Math] object has no Method named...
[suggestion] anonymous array declaration, relax object syntax (JS/Json syntax)
Currently EE can evaluate anonymous object declarations: ```csharp x = new {a = 10, b = 20, c = 30} ``` `property = value` is enforced in method `InitSimpleObjet` (we...
[suggestion] Implement async / await
~~Currently this is not included in todo / roadmap document here~~ - [https://github.com/codingseb/ExpressionEvaluator/wiki/ExpressionEvaluator-Todo-List](https://github.com/codingseb/ExpressionEvaluator/wiki/ExpressionEvaluator-Todo-List) Implementing `async` / `await` (with priority on `await`) would greatly increase flexibility of EE. C# is becoming...
Named arguments support
Hello, Couldn't find anything about this - but is there a support for named optional arguments in function calls? Here is something I'm trying to do: ``` public class Program...
[suggestion] allow remapping of "new"
This is a followup suggestion for #73. Now to instantiate, only standard c# syntax can be used (on right hand of expression): ```csharp myList = new List(); ``` Keyword `new`...
[suggestion] return instead of throw
Now when invalid token / expression is encountered during evaluation `throw` statement is used to notify user something went wrong. In scenarios where EE is "proxied" behind some interface (for...
[question] Declare methods in scripts
Hi, I'm not quite sure if I missed this in the docs, but is something like this possible? ```csharp [void] myMethod([int] a) { } myMethod(1); ``` running the above from...
[suggestion] Allow bracketless version of if/while/for/foreach
Instead of mandatory `()` around an expression in listed keywords an option would exist to parse them without brackets. Now: ```csharp if (expr) { } ``` With suggestion option toggled...
Escaping variable names
Hi Seb! First of all I'd like to say this library is quite a marvel compared to the alternatives we have in the dotnet world!. Keep up the good work!!...