Update RScript
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
alwaysApply: false
|
alwaysApply: true
|
||||||
---
|
---
|
||||||
## RIPER-5 + O1 思维 + 代理执行协议
|
## RIPER-5 + O1 思维 + 代理执行协议
|
||||||
|
|
||||||
|
|||||||
Submodule Convention/[FLEE] updated: 47b12f4bc0...5c561fc69c
Submodule Convention/[RScript] updated: 971baf8c9e...29dd4f5d96
@@ -1,62 +1,39 @@
|
|||||||
using Convention;
|
using Convention;
|
||||||
using Convention.EasySave;
|
using Convention.EasySave;
|
||||||
using Convention.RScript;
|
using Convention.RScript;
|
||||||
|
using Convention.RScript.Variable;
|
||||||
|
using Convention.RScript.Variable.Attr;
|
||||||
|
using Convention.RScript.Variable.CStyle;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
static class Test
|
[Description(@"
|
||||||
|
测试注释1
|
||||||
|
测试注释二
|
||||||
|
")]
|
||||||
|
[Default(@"
|
||||||
|
this.Log(1);
|
||||||
|
")]
|
||||||
|
public class Test
|
||||||
{
|
{
|
||||||
public static object Func(object x)
|
[Method]
|
||||||
|
public void Log(object o)
|
||||||
{
|
{
|
||||||
Console.WriteLine(x);
|
Console.WriteLine(o);
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
RScriptEngine engine = new();
|
var engine = new RScriptEngine();
|
||||||
RScriptImportClass import = new()
|
var testClass = new CScriptRScriptVariableGenerater(typeof(Test), () => new Test(), null, nameof(Test));
|
||||||
{
|
testClass.Register();
|
||||||
typeof(Math),
|
engine.Run(@"
|
||||||
typeof(ExpressionMath),
|
var t = New(Test);
|
||||||
typeof(Test)
|
t.Log(114514);
|
||||||
};
|
");
|
||||||
|
Console.WriteLine(testClass.scriptIndicator);
|
||||||
|
|
||||||
var result = engine.Compile(@"
|
|
||||||
int i= 2;
|
|
||||||
int count = 0;
|
|
||||||
label(test);
|
|
||||||
goto(true,func1);
|
|
||||||
Func(i);
|
|
||||||
goto(100>i,test);
|
|
||||||
|
|
||||||
goto(context.ExistNamespace(""x""),end);
|
|
||||||
namespace(x)
|
|
||||||
{
|
|
||||||
Func(""xxx"");
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace(func1)
|
|
||||||
{
|
|
||||||
i = Pow(i,2);
|
|
||||||
count = count + 1;
|
|
||||||
Func(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
label(end);
|
|
||||||
", import);
|
|
||||||
var data = RScriptSerializer.SerializeClass(result);
|
|
||||||
var file = new ToolFile("F:\\test_after_run.dat");
|
|
||||||
file.SaveAsBinary(data);
|
|
||||||
data = file.LoadAsBinary();
|
|
||||||
engine.Run(RScriptSerializer.DeserializeClass(data), import);
|
|
||||||
return;
|
|
||||||
var data2 = RScriptSerializer.SerializeClass(engine.GetCompileResultFromCurrent());
|
|
||||||
var file2 = new ToolFile("F:\\test_after_run.dat");
|
|
||||||
file2.SaveAsBinary(data2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user