Files
Convention-CSharp/[Test]/Program.cs

49 lines
848 B
C#
Raw Normal View History

using Convention.RScript;
using System;
2025-06-13 10:52:21 +08:00
public class Program
{
2025-10-16 11:29:50 +08:00
static class Test
{
public static object Func(object x)
{
Console.WriteLine(x);
return x;
}
}
2025-06-13 10:52:21 +08:00
static void Main(string[] args)
{
RScriptEngine engine = new();
RScriptImportClass import = new()
{
2025-10-16 10:25:31 +08:00
typeof(Math),
2025-10-16 11:29:50 +08:00
typeof(ExpressionMath),
typeof(Test)
};
var result = engine.Run(@"
2025-10-16 11:58:47 +08:00
int i= 2;
2025-10-16 17:24:06 +08:00
int count = 0;
label(test);
2025-10-16 00:39:45 +08:00
goto(true,func1);
2025-10-16 17:24:06 +08:00
Func(i);
2025-10-16 00:39:45 +08:00
goto(100>i,test);
2025-10-10 18:01:38 +08:00
2025-10-16 20:15:59 +08:00
goto(context.ExistNamespace(""x""),end);
namespace(x)
{
Func(""xxx"");
}
2025-10-16 00:39:45 +08:00
namespace(func1)
2025-10-10 18:01:38 +08:00
{
2025-10-16 11:29:50 +08:00
i = Pow(i,2);
2025-10-16 17:24:06 +08:00
count = count + 1;
Func(count);
}
2025-10-16 20:15:59 +08:00
label(end);
", import);
2025-10-16 00:39:45 +08:00
Console.WriteLine($"Script executed successfully. Result: {result["i"].data}");
2025-06-13 10:52:21 +08:00
}
}