Coder Social home page Coder Social logo

deniszykov / csharp-eval-unity3d Goto Github PK

View Code? Open in Web Editor NEW
195.0 195.0 24.0 2.1 MB

C# Expression Parser for Unity3D

License: Other

C# 99.03% TypeScript 0.97%
ast eval expression-evaluator expression-parser unity unity-asset unity-scripts unity3d unity3d-plugin

csharp-eval-unity3d's Issues

error when export variable name start with "as" or "is"

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".

MethodCallSignature hash code issues

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

CSharpExpression.Execute doesn't recognize passed-in known types

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.

Exception

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.

Allow for more than 4 arguments?

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.

return void, set field value

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

Matching functionality with Linq Eval

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.

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.