Code Monkey home page Code Monkey logo

flee's Introduction

Flee (Supports Net6.0, Net5.0, Netstandard2.1, Netstandard2.0)

Fast Lightweight Expression Evaluator. Convert this project vb.net to c#.

Project Description

Flee is an expression parser and evaluator for the .NET framework. It allows you to compute the value of string expressions such as sqrt(a^2 + b^2) at runtime. It uses a custom compiler, strongly-typed expression language, and lightweight codegen to compile expressions directly to IL. This means that expression evaluation is extremely fast and efficient.

Features

  • Fast and efficient expression evaluation
  • Small, lightweight library
  • Compiles expressions to IL using a custom compiler, lightweight codegen, and the DynamicMethod class
  • Expressions (and the IL generated for them) are garbage-collected when no longer used
  • Does not create any dynamic assemblies that stay in memory
  • Backed by a comprehensive suite of unit tests
  • Culture-sensitive decimal point
  • Fine-grained control of what types an expression can use
  • Supports all arithmetic operations including the power (^) operator
  • Supports string, char, boolean, and floating-point literals
  • Supports 32/64 bit, signed/unsigned, and hex integer literals
  • Features a true conditional operator
  • Supports short-circuited logical operations
  • Supports arithmetic, comparison, implicit, and explicit overloaded operators
  • Variables of any type can be dynamically defined and used in expressions
  • CalculationEngine: Reference other expressions in an expression and recalculate in natural order
  • Expressions can index arrays and collections, access fields and properties, and call functions on various types
  • Generated IL can be saved to an assembly and viewed with a disassembler

Installing Flee

You should install Flee with NuGet:

Install-Package Flee

Or via the .NET Core command line interface:

dotnet add package Flee

NuGet Packages

Name NuGet
Flee Flee

More information

  • Examples to learn how to create and evaluate expressions.

License

Flee is licensed under the LGPL. This means that as long as you dynamically link (ie: add a reference) to the officially released assemblies, you can use it in commercial and non-commercial applications.

flee's People

Contributors

andrzejrusztowicz avatar bcgrillo avatar bondjames12 avatar clarencegarcia avatar eskaufel avatar ggee-nortech avatar hunkydoryrepair avatar jnsv avatar mparlak avatar pekkave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flee's Issues

Variable name with Non Alpha-numeric

I have a scenario like.
var context = new ExpressionContext();
context.Variables["FieldSet1.Q1"] = 1;
context.Variables["FieldSet1.Q2"] = 2;
var expression = context.CompileDynamic("FieldSet1.Field1 + FieldSet1.Field2");

In this case. Is there an option to avoid parsing evaluation over the variables names because the expression is invalid and the message returned is:

IdentifierElement: Could not find a field/property/variable with the name 'FieldSet1'

Even the validation returned just a part of the variable: "FieldSet1"

Makes sense?

Flee fails to parse "if" formula

I was trying to evaluate following formula "if(13>24;5;0)" on Flee but it fails with error ExpressionCompileException

var expressioncontext = new ExpressionContext(); expressioncontext.Options.ParseCulture = new System.Globalization.CultureInfo("fi-FI"); expressioncontext.Options.EmitToAssembly = false; expressioncontext.Imports.AddType(typeof(System.Math));

var expr = expressioncontext.CompileGeneric(line);
var result = expr.Evaluate();

Flee.PublicTypes.ExpressionCompileException: FunctionCallElement: Could find not function 'if(Boolean; Int32; Int32)' at Flee.ExpressionElements.Base.ExpressionElement.ThrowCompileException(String messageKey, CompileExceptionReason reason, Object[] arguments) at Flee.ExpressionElements.Base.MemberElement.Resolve(IServiceProvider services) at Flee.ExpressionElements.MemberElements.InvocationListElement.Resolve(IList elements, IServiceProvider services) at Flee.ExpressionElements.MemberElements.InvocationListElement..ctor(IList elements, IServiceProvider services) at Flee.Parsing.FleeExpressionAnalyzer.ExitMemberExpression(Production node)

Calculation Engine fails with ANE

I'm getting a System.ArgumentNullException when trying to use the calculation engine. I've put the stack trace below. According to this page it should be as simple as:

// Add an expression to the calculation engine as "a"
engine.Add("a", "x * 2", context);

// Add an expression to the engine as "b"
engine.Add("b", "y + 100", context);

// Add an expression at "c" that uses the results of "a" and "b"
engine.Add("c", "a + b", context);`

I am adding many variables to the engine and then trying to use them in dynamically compiled expressions. Is this supported? I have also tried using the Engine to calculate values using my custom function, but it throws an exception. Are these things not allowed to mix?

stack trace.txt

Mixing decimal and double in calculations

if a decimal variable like
decimal vdec = 10 is used in a formula,
evaluating a formula like "vdec * 1.23"
throws an error : Flee.PublicTypes.ExpressionCompileException: 'ArithmeticElement: Operation 'Multiply' is not defined for types 'Decimal' and 'Double''
I found a workaround changing the formula to "vdec * 1.23M", but this is not very nice...
Is there any way to force flee to assume all constants are decimal?
Note that mixing decimal and int : "vdec * 2" is OK.

InvalidCastException when expression contains power with double exponent (x ^ 0,2)

Where I try evaluate a expression like "2 ^0,2", the program throws a InvalidCastException

System.InvalidCastException: Unable to cast object of type 'Flee.ExpressionElements.Literals.Real.DoubleLiteralElement' to type 'Flee.ExpressionElements.Literals.Integral.Int32LiteralElement'. at Flee.ExpressionElements.ArithmeticElement.get_IsOptimizablePower()

I could solve this changing the method "IsOptimizablePower" like this:
348cb51

Exception : Value was either too large or too small for an unsigned byte.

FleeTest.zip

Hi,

Attached is a zip file that contains a simple .NET Core console application. In it, there are 3 expressions that are executed using the latest .NET Core Flee library. All the 3 expressions fail with an exception "Value was either too large or too small for an unsigned byte."

Note that the expressions are similar with minor variations.

Seems like the issue is while determining a long branch.

If and cast not working or I don't know how to make them work

I follow blog on codeproject I also saw in code that there is IF Expression and Cast to type but seem parsing never got to them ever? Hope I'm wrong.

//Sample Scenario 1
ExpressionContext context = new ExpressionContext();
context.Imports.ImportBuiltinTypes();
context.Imports.AddType(typeof(Math));
VariableCollection variables = context.Variables;
variables.Add("a", 1);
variables.Add("b", 1);

        try
        {
            // IGenericExpression<bool> e = context.CompileGeneric<bool>("a=1 AND b=0");
            //IGenericExpression<bool> e = context.CompileGeneric<bool>("If(a = 1,a,b)");
            IGenericExpression<int> e = context.CompileGeneric<int>("if(a>b,a,b)");
            int result = e.Evaluate();

            System.Console.WriteLine(result);
        }catch(ExpressionCompileException ex){
            System.Console.WriteLine(ex.Message+" "+ex.Reason);
        }

GET FunctionCallElement: Could find not function 'if(Boolean, Int32, Int32)' UndefinedName
seem like Flee try to find function with name 'if'. Aren't suppose if to be keyword???
Really is hard to find any docs about how to use it.

If Conditional If(a > 100, "greater", "less")
Cast Cast and conversion cast(100.25, int)
[] Array index 1 + arr[i+1]

`
I tried first 2 not working? I'm afraid to check the rest https://www.codeproject.com/Articles/19768/Flee-Fast-Lightweight-Expression-Evaluator I know that is old version but really few pages are available and not on the topic.

Unable to cast object of type 'Flee.ExpressionElements.CompareElement' to type 'Flee.ExpressionElements.LogicalBitwise.AndOrElement'

I'm getting Unable to cast object of type 'Flee.ExpressionElements.CompareElement' to type 'Flee.ExpressionElements.LogicalBitwise.AndOrElement' error when executing the following simple code:

ExpressionContext context = new ExpressionContext();
VariableCollection variables = context.Variables;
variables["a"] = "foo";
variables["b"] = "bar";
string s = "a = \"foo\" AND (b = \"bar\" OR b = \"foo\")";
IGenericExpression<bool> exp = context.CompileGeneric<bool>(s);

But if I change the order of logical operators to the one below (move AND check to the end), it works!
string s = "(b = \"bar\" OR b = \"foo\") AND a = \"foo\"";

Thanks.

pass object to experssion

1.Its possible to pass object and call there methods ?

obj1 = new Circle(5,5);
fle.variables.add(obj1) 
fle.eval("obj1.SomeMethod()");

2.Supporting anonymous types ?

dynamic MyDynamic = new System.Dynamic.ExpandoObject();
MyDynamic.A = "A";
MyDynamic.B = "B";
MyDynamic.C = "C";
MyDynamic.Number = 12;
MyDynamic.MyMethod = new Func<int>(() => 
{ 
    return 55; 
});
Console.WriteLine(MyDynamic.MyMethod());

Substring usage

Hello Guys!

It is possible to use Substring function with flee??

Thanks

Decimal number literal

All real numbers in formula are cast to double I guess. So this:

var context = new ExpressionContext();
context.Variables.ResolveVariableType += Variables_ResolveVariableType;
context.CompileDynamic("0.1 + a");

void Variables_ResolveVariableType(object sender, ResolveVariableTypeEventArgs e)
{
    e.VariableType = typeof(decimal);
}

will cause an exception: "ArithmeticElement: Operation 'Add' is not defined for types 'Double' and 'Decimal'".

Is there any literal to force parser cast numeric values to decimals? If there is not, can you add it?

Expressions with sub expressions that need to resolved runtime

I'm not sure how to formulate this issue.

Right now I'm trying to create "dynamic" queries to a database, based on expressions.

An example would be:

CustomerRepository.Get(c => c.ParentKey == Key)

Now I just want it to ignore the "c" as it's part of the expression handled by the "Get" but I do however want this to be invoked dynamically as it's fully context dependent (the expression context is set to the owner of "CustomerRepository")

How would this work in Flee? If at all?
I'm trying to avoid splitting up the string as I'm building a framework for the company. I'm trying to create a delayed invocation of the expression. (basically it's based on: if the object is loaded, don't load the children, only do so when specifically requested, main use would be during serialization)

Caching of compiled rules.

Hi,
I am using Flee.Net45 library for evaluating expressions in my application.

As rule compilation is taking time, can we cache the compiled rules to bypass the rule compilation process?

Sample code :
_expressionContext.CompileDynamic("expression")

Appreciate your help.

Thanks,
Balaji.

Boolean predicate "x>0 OR y>0"

Boolean predicate "x>0 OR y>0"
Is it possible to evaluate only variable x if x > 0 ??

if (x>0 || y>0) ...
in C# if x>0, y>0 is not evaluated...

Same compiled expression evaluated on different objects in parallel

We have certain complicated expressions to be evaluated per object parallely. For the compiled expression the owner is within the expression. Hence when we by run the same expression in parallel on different objects multi threading issues occur and result of one gets attached to another. Can you provide an override for evaluate wherein the same compiled expression i can evaluate on multiple objects

ExpressionContext doesn't work

Just attempting to construct an ExpressionContext object throws an exception at Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.TokenRegExpParser. It is unable to parse the regular expression {1,3}. In fact it doesn't seem to recognise any quantifier at all (e.g. {2} where the preceding character has to match exactly twice).

When expression string is long CompileGeneric\Dynamic throws exception

When expression string is long CompileGeneric\Dynamic throws exception IndexOutOfRangeException. I think that exception was thrown when the length of the string was about 200 or more symbols. On lesser string it works fine. Strings are pretty long boolean expressions if that's of any help

Ambiguous error with overloaded methods

Initially I tried to create a method with multiple optional nullable params but that wouldn't work. I kept getting an error that no method could be found matching the signature, so I made overloaded methods and now I am getting an ambiguous method error.

The methods differ only in the number and type of arguments.

Do you have signed version of Flee ?

I am trying to use in Flee in application, where I have issue, I could not use it as it unsigned assembly and would require strongly-named assembly

Support Expressions that call Extension Methods.

I tried to evalauate expression that use extension method

         var context = new ExpressionContext();
        context.Imports.AddType(typeof(Extensions)); //Extension methods class 
        context.Variables["s"] = "this is a string";
        //expresion use extension method Quote()
        var expression = "s.Quote()"; //raise error: ExpressionCompileException
        //var expression = "Quote(\"abc\")"; //this is working
        var e = context.CompileDynamic(expression);
        var result = e.Evaluate();
        Console.WriteLine(result);
        
		
		//Extension methods  class 
	  public static class Extensions
		{
			public static string Quote(this string text)
			{
				return $"\"{text}\"";
			}
		}

I get Error Exception:

Flee.PublicTypes.ExpressionCompileException : FunctionCallElement: Could find not function 'Quote()' on type 'String'

Support Extension methods
or, what i missed to use extension methods?

Expressions as variables causes InvalidCastException

When attempting to follow the steps to use expressions as variables I am getting an InvalidCastException. I have tried using the example in the Wiki as well as using my own expressions as variables and received the same exception both times.

Here is the sample code from the wiki as a unit test:

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Flee.PublicTypes;

namespace ExpressionBuildingTest
{
    [TestClass]
    public class FleeTests
    {
        [TestMethod]
        public void FleeTest()
        {
            ExpressionContext context = new ExpressionContext();
            context.Imports.AddType(typeof(Math));
            context.Variables.Add("a", 3.14);
            IDynamicExpression e1 = context.CompileDynamic("cos(a) ^ 2");

            context = new ExpressionContext();
            context.Imports.AddType(typeof(Math));
            context.Variables.Add("a", 3.14);

            IDynamicExpression e2 = context.CompileDynamic("sin(a) ^ 2");

            // Use the two expressions as variables in another expression
            context = new ExpressionContext();
            context.Variables.Add("a", e1);
            context.Variables.Add("b", e2);
            IDynamicExpression e = context.CompileDynamic("a + b");

            Console.WriteLine(e.Evaluate());
        }
    }
}

List of built-in functions and operators

Is it possible to get a comprehensive list of the built-in functions and operators? I have seen from some of the answered questions that "if" is not available by default. It would be helpful to know what else would need to be implemented for our purposes.

Evaluate returns false and doesn't set property value

I'm trying to execute this:

IDynamicExpression eDynamic = engineContext.CompileDynamic("Object.Width = 0.20");
var res = eDynamic.Evaluate();
,

but for some reason, "res" is false and evaluation doesn't set anything.
Is setting variable property value allowed?

Exception thrown: 'Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RE.RegExpException' in Flee.NetStandard20.dll

I have a .net core 2.1 project doing the following

ExpressionContext context = new ExpressionContext();
		        context.Imports.AddType(typeof(DateTime), "DateTime");
		        VariableCollection variables = context.Variables;
		        variables.Add(varName, varVal);

		        IGenericExpression<object> e = context.CompileGeneric<object>(_expression);
		        object result = e.Evaluate();
		        LogHelper.Trace("Evaluating: object: " + varName + ", expression: " + _expression + ", result: " + result);
		        return result;

ExpressionContext context = new ExpressionContext(); allways throws this exception

Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RE.RegExpException

Any ideas?

Assemblie should be strong name signed

The assemblies built in this project are not strong-name signed. This makes them unconsumable on .NET Framework from signed projects. If you strong-name sign, your assemblies work everywhere. If you don't strong-name sign, your assemblies only work for folks who don't strong-name sign.

Overloading 'AND' and 'OR' Operator in C# gives an Exception

I treid to overload the 'And' Operator in MyClass (C#). Flee gives me the following Exception:

"AndOrElement: Operation 'And' is not defined for types 'MyClass' and 'MyClass'"

Overloading the '+' and'-' Operator works well.

how can I overload the 'AND' 'OR' Operators in an C# Class ?

class Program
{
    static void Main(string[] args)
    {
        ExpressionContext context = new ExpressionContext();
        VariableCollection variables = context.Variables;

        variables.Add("a", new MyClass("1"));
        variables.Add("b", new MyClass("2"));

        try
        {
            Console.WriteLine( context.CompileDynamic("a + b").Evaluate() ); // works well 
            Console.WriteLine( context.CompileDynamic("a - b").Evaluate() ); // this too

            // following gives me an exception:
            // "AndOrElement: Operation 'And' is not defined for types 'MyClass' and 'MyClass'" 
            Console.WriteLine(context.CompileDynamic("a and b").Evaluate()); 
            Console.WriteLine(context.CompileDynamic("a or b").Evaluate()  );
        }

        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }

    }
}

public class MyClass
{
    private string value;

    public MyClass(String v)
    {
        value = v;
    }

    public bool ToBool()
    {
        if (value == "0") return false;
        if (value == "") return false;
        return true;
    }

    public int ToInt()
    {
        return Convert.ToInt32(value);
    }

    public static bool operator &(MyClass c1, MyClass c2)
    {
        return c1.ToBool() && c2.ToBool();
    }

    public static bool operator |(MyClass c2, MyClass c1)
    {
        return c1.ToBool() || c2.ToBool();
    }

    public static int operator +(MyClass c2, MyClass c1)
    {
        return c1.ToInt() + c2.ToInt();
    }

    public static int operator -(MyClass c2, MyClass c1)
    {
        return c1.ToInt() - c2.ToInt();
    }
}

Inline IF Condition

Hey Guys!!

Is it possible to evaluate something like that?

('TEST'=='TEST' ? '1' : '2') and the result as a string??

Thanks!

[Question] parse an expression into a .NET delegate

Hi is it possible somehow to produce a delagate in order to use like

customers.Where(dynamicWhere)

I am building an asp.net core api i d like to create querable endpoints like
/api/customers?where=Age>5 AND Weight<7

then parse and compile it using Flee to delagate

[Question] ExpressionContext from inside custom function.

Hi,

I'm a relative novice when it comes to Flee. I started with the original CodePlex project, and then found yours, which is maintained.

I've created a helper function. Call it "lookupSeason(date)". The idea is - take a date, pass it to a function that queries a database and returns the proper season.

In my ideal world, I'd like the expression to read "lookupSeason(date)" - but what gets passed to the parser is "lookupSeason(date,customer)" - because different customers could define seasons differently.

The other option would be to somehow be able to access the ExpressionContext from inside the helper function.

Is there any way to do this?

Thanks!

Impossible to call an operator defined in a base class with derived classes instances

To illustrate the issue, let's imagine I have the following hierarchy:

public class Base 
{
  public double Value { get; set; }
  public static Base operator +(Base left, Base right)
  {
    return new Base { Value = left.Value + right.Value };
  }
}

public class Derived : Base
{
}

With the proper C# compiler, it's possible to add two Derived instance, because the operator Base.operator+ exists.

However, if I try to perform this operation with Flee, I get a ExpressionCompileException:

ArithmeticElement: Operation 'Add' is not defined for types 'Derived' and 'Derived'

Test case:

static void Main()
{
  var m1 = new Derived { Value = 2 };
  var m2 = new Derived { Value = 5 };
  
  // properly resolved by the C# compiler
  var res1 = m1 + m2;

  var context = new ExpressionContext();
  context.Variables.Add("m1", m1);
  context.Variables.Add("m2", m2);

  // --> this fails
  var e = context.CompileDynamic("m1 + m2");
  var result = (Base) e.Evaluate();
}

How to get Predicate<T> or Expression<Func<T,bool>>

I am trying to use Flee in application that need evaluate string expressions as a predicate and passed to other functions.
How to get Predicate or Expression<Func<T,bool>> from string expressions

Example:
Predicate GetPredicate ("Id == 5")
{
//Can Flee API support this
//how to use flee to convert the string expressions to Predicate
}

Error when using InElement on Lists when types are not Int

When using the 'in' operand on a list, it will onlyy work if the inlist is composed of Int Values (explicedly values that can be casted to Int32LiteralElement.
This seems to be because of a hard cast in method Flee.ExpressionElements.CompareElement.Initialize(ExpressionElement leftChild, ExpressionElement rightChild, LogicalCompareOperation op). Where the rightChild is casted to Int32LiteralElement. Removing the cast would resolve the issue in all cases we encounter, but I am not sure about some cases I am unable to see right now.

NuGet Package issue

Please, review your NuGet package 1.0.5, assembly for net45 probably is older version, because the issue #15 ("Unable to cast object of type 'Flee.ExpressionElements.CompareElement' to type 'Flee.ExpressionElements.LogicalBitwise.AndOrElement'") still presents. For net461 it's ok.

Changing type of variables without removing them

First of all thank you for this excellent library..
I'm not sure if this is a bug or intended behavior..

expressionContext.Variables["salary"] = "70000";
//do some business logic and determine the 'salary' is supposed to be numeric
expressionContext.Variables["salary"] = 70000;
//evaluate expression for "salary * 1.1" ==> this causes exception

Fix/workaround:
expressionContext.Variables["salary"] = "70000";
//do some business logic and determine the 'salary' is supposed to be numeric
expressionContext.Variables.Remove("salary");
expressionContext.Variables["salary"] = 70000;
//evaluate expression for "salary * 1.1" ==> this causes exception

Installing version newer than 1.05 stops unit tests

Installing the NuGet package for FLEE with a version above 1.05 makes my unit test to either give the result: Inconclusive, or the tests are not found at all in the project by ReSharper or Visual Studio test runners.
I narrowed this down to the version of System.Reflection. From 1.05 onwards version 4.1.2.0 is used and an assembly binding for this is added to each project that references the project FLEE is installed in.

This assembly binding caused my project to not find the unit tests with the error message:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

Downgrading to 1.05 and changing the assembly binding redirect to 4.0.0.0 fixed the issue for me

Using:
Visual Studio 2017 community edition
ASP.NET Framework 4.7.1
ReSharper 2018.2.2
Windows 10
MsTest V2 1.3.2

the function with several parameters can't be interpreted

The example mentioned on https://github.com/mparlak/Flee/wiki/Extending doesn't work.
I get an ExpressionCompileException: unexpected character ',', on line: 1 column: 10
Here is the exact code that returns me the exception (that is just a copy paste from the documentation):

using Flee.PublicTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            ExpressionContext context = new ExpressionContext();
            context.Imports.AddType(typeof(CustomFunctions));
            context.Variables.Add("a", 100);
            context.Variables.Add("b", 200);
            IDynamicExpression e = context.CompileDynamic("product(a,b) + sum(a,b)");
            int result = (int)e.Evaluate();
        }
    }
    public static class CustomFunctions
    {
        public static int Product(int a, int b)
        {
            return a * b;
        }

        public static int Sum(int a, int b)
        {
            return a + b;
        }
    }
}

The actual problem is that on my computer, the default separator seems to be ";". The problem is that if I try to redefine it using context.ParserOptions.FunctionArgumentSeparator = ',', it is not taken in consideration and still expects ";" as a function argument separator.

Is it possible to evaluate function entry and exit?

In this example, I have an ExpressionContext owner that has a concept of a DateTime as part of its instance data. I'm trying to write an expression such as:

metric(123) - yesterday(metric(123))

Where metric() is a function that performs a query, using the current date as an input. When the runtime hits the yesterday outer function, I'd like to modify the owner's instance data before the inner expression is evaluated, and then restore it when the inner expression is complete. (Basic push/pop behavior)

Does Flee support this kind of behavior?

Support for string, char, boolean, and floating-point literals

How to build an expression with string concatenation with string literal constant?
ExpressionContext context = new ExpressionContext();
VariableCollection variables = context.Variables;
variables.Add("a", "1");

        IGenericExpression<bool> e = context.CompileGeneric<bool>("a + 'xyz'");

*We do not want to declare variable with constant value 'xyz'
*For DateTime literals we use #12/01/2018# within an expression.
What is string Equivalent for same?
Thank you.

null check is broken

I am trying to do a null check for an object. My expression is "someType <> null". When I do a context.CompileDynamic("someType <> null") it throws ExpressionCompileExpression

An unhandled exception of type 'Flee.PublicTypes.ExpressionCompileException' occurred in Flee.dll
Additional information: IdentifierElement: Could not find a field/property/variable with the name 'null'

I pulled down the codeplex version of the same and it works fine with the above expression. Looks like it's broken while porting over

[Question] : How to create variable with nested variable like an object

How to create variable with nested variable like an object

VariableCollection variables = context.Variables;
variables.Add("a.f", 100);
variables.Add("b", 1);
variables.Add("c", 24);

        IGenericExpression<bool> e = context.CompileGeneric<bool>("(a.f == 100"); //a.f not working

Even tried nested varaible
ExpressionContext context = new ExpressionContext();
VariableCollection variables = context.Variables;

        //variables.Add("a", 100);
        variables.Add("b", 1);
        variables.Add("c", 24);
        ExpressionContext context1 = new ExpressionContext();
        VariableCollection variables1 = context1.Variables;
        variables1.Add("f", 100);
        variables.Add("a", variables1);

Any help or direction?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.