deniszykov / csharp-eval-unity3d Goto Github PK
View Code? Open in Web Editor NEWC# Expression Parser for Unity3D
License: Other
C# Expression Parser for Unity3D
License: Other
I use KnownTypeResolver for export variable to Expression.
When the export variable name start with "as" or "is" such as "S.aso"
I will throw exception "ExpressionParserException: A 'Resolve' operator requires a second operand."
Wrong:
S.aso
S.asp
S.iso
S.isp
Right
S.oas
S.ois
Maybe some error occur when parse key word "is" and "as".
Visual Studio Community 2017.
I try run test. cannt discovery test.
help..
does it support multiline? when i write ; it throws error
public MethodCallSignature(Type parameter1Type, string parameter1Name, Type returnType)
: this(returnType)
etc...
due to the order of the constructor call, the same hash code will be calculated
Now I have created a custom class with a public static method:
using UnityEngine;
public class GFunc
{
public static void Foo()
{
Debug.Log("Foo!");
}
}
And I have already passed the type of GFunc
through the typeResolve
parameter to CSharpExpression.Execute
:
KnownTypeResolver typeResolver = new KnownTypeResolver(typeof(GFunc));
CSharpExpression.Execute("GFunc.Foo()", typeResolver);
However, CSharpExpression.Execute
still doesn't recognize GFunc
and therefore generates a parser exception:
ExpressionParserException: Unable to resolve 'Random'. There is no formal parameter with this name.
Of course, currently I can work around it by making Foo()
return an int
, and then using CSharpExpression.Evaluate
instead of Execute
.
Catched exception on the first call CSharpExpression.Evaluate
NotSupportedException: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection.Emit/DynamicMethod.cpp(24) : Unsupported internal call for IL2CPP:DynamicMethod::destroy_dynamic_method - System.Reflection.Emit is not supported.
Hello, I was wondering if there are any plans/if it is possible to parse functions with more than 4 arguments or, even better, for a generic number of arguments.
does it support any those?
var typeResolver = new KnownTypeResolver(typeof(Test), typeof(Console));
var test = new Test();
var exprTree = CSharpExpression.Evaluate<Test,int>("test.te=23", test,typeResolver:typeResolver);
throws error Unexpected symbol '='
var exprTree = CSharpExpression.Evaluate<System.void>("Console.Write(123)",typeResolver:typeResolver);
will not work because cannot use System.void
Hey, was really hoping you could help. I picked up this plugin to try and match functionality we had in place before moving over to the IL2CPP scripting backend.
The function I'm trying to replicate is as below.
LambdaParser.Linq.LambdaParse.Eval(string expr, IDictionary<string,object> vars) T Output = Assets.Scripts.SysExtensions.Extensions.TryCast<T>(res);
Using the above function with correct fed variables was matching my needed functionality perfectly. How would I go about achieving this in this plugin?
Thanks,
Ezzuna.
The expression is:
1 == 2 ? Random.Range(0, 1) : 3
The following exception is reported:
ExpressionParserException: A colon ':' symbol is expected in conditional '?' expression.
Changing Random.Range(0, 1)
to Random.value
makes the exception disappear.
However, 1 == 2 ? 3 : Random.Range(0, 1)
can be correctly parsed.
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.