pvginkel / expressions Goto Github PK
View Code? Open in Web Editor NEWExpression parser for C#, Flee and Visual Basic
License: GNU Lesser General Public License v3.0
Expression parser for C#, Flee and Visual Basic
License: GNU Lesser General Public License v3.0
Flee has support for importing methods and on demand methods. This feature has not yet been implemented.
Flee has support for automatically treating integers as doubles.
Add support for generic methods. The idea is that e.g. the following method would be supported:
T First<T>(IEnumerable<T> collection) { }
Support for this helps e.g. with working with collections that don't implement IList and adds support for functionality similar to extension methods.
Flee has support for providing type descriptors.
Use ILMerge to integrate ANTLR in final binary.
I'm stuck with an issue with a test expression that I'm writing:
string translatedString = "uppercase("hello")";
var expr = new DynamicExpression(translatedString, ExpressionLanguage.Csharp);
var context = new ExpressionContext(null, new CustomOwner(), true);
var boundExpression = expr.Bind(context);
object res = boundExpression.Invoke();
At Invoke time, I get a NullRef exception without any useful debug info.
My CustomOwner is as simple as this:
public class CustomOwner
{
public string uppercase(string str)
{
return str.ToUpperInvariant();
}
}
can you please tell me what I am doing wrong?
thanks
VB.NET has special support for comparisons. Verify that custom operators take precedence over this mechanism.
Flee has support for providing a StringComparison which is used to perform string comparisons in the expression.
Hi,
Suppose I have expression like this A.B.Value.
Result of Value property depended to B type and some logic.
Is there a way to get the B object from GetVariableType/GetVariableValue functions.
Singature of these functions has variable name only.
Thanks
Add support for constant folding. When an expression is completely constant, it shouldn't be compiled at all but the constant result should be returned instead.
Flee supports adding multiple imports with the same namespace.
Thrown exceptions must be cleaned up. The InvalidExpressions unit test does not get checked for the type of exception thrown yet. Also, exceptions probably could get a context (position/line number) from ANTLR.
Is there any way to have multiline expressions evaluated? I'd like the user to be able to declare a few simple variables inline so their final formula isn't so complicated. Those variables could be dependent on previous variables...
a = 1.5;
b = 5.6;
c = a * b / 1000;
a + b * c / a + b;
Flee has the RealLiteralDataType setting which specifies the actual type to be used for real data types.
expression = "p1"; //<--- the entire equation is just a variable called 'p1'
context.Variables["p1"] = 100;
result should be 100 but an exception is thrown instead
VB.NET has support for only providing the time part of a date literal.
There is a failing unit test which pertains to overload resolution. The following case fails to find the correct overload:
void Method(float a) { }
void Method(double a) { }
Method(1)
The problem here is that integer can be implicitly casted to both float and double, and the overload resolution mechanism currently doesn't score overloads which are matched through implicit casts. C# b.t.w. calls the method with the float argument.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.