EP RScript 完成控制流, 基本完成

This commit is contained in:
2025-10-10 11:04:43 +08:00
parent f8d81d9198
commit c07c64be1e
4 changed files with 145 additions and 104 deletions

View File

@@ -7,22 +7,20 @@ public class Program
static void Main(string[] args)
{
RScriptEngine engine = new();
RScriptImportClass import = new();
import.Add(typeof(Math));
RScriptImportClass import = new()
{
typeof(Math)
};
var result = engine.Run(@"
double x;
double y;
double z;
double result;
bool stats;
stats = true;
x = 10.0;
y = 20.0;
z = x + y;
// This is a comment;
# This is another comment;
result = z * 2;
result = Pow(result,2.0);
double i;
i = 2.0;
{
label(test);
i = Pow(i,2.0);
goto(100,i,test);
}
string result;
result = i.ToString()+i.ToString();
", import);
Console.WriteLine($"Script executed successfully. Result: {result["result"].data}");
}