解离出Runner

This commit is contained in:
2025-10-16 15:20:53 +08:00
parent e2ab2a1077
commit 15bdb6f8db
9 changed files with 301 additions and 237 deletions

View File

@@ -0,0 +1,26 @@
using Convention.RScript.Parser;
using System.Diagnostics.CodeAnalysis;
namespace Convention.RScript.Runner
{
public class BackpointRunner : JumpRuntimePointerRunner
{
[return: MaybeNull]
public override object Run(ExpressionParser parser, RScriptSentence sentence, RScriptContext context)
{
// 检查并跳转到上次跳转的位置
if (parser.Evaluate<bool>(sentence.content))
{
if (context.GotoPointerStack.Count == 0)
{
throw new RScriptRuntimeException($"No position to back.", context.CurrentRuntimePointer);
}
else
{
DoJumpRuntimePointer(parser, context.GotoPointerStack.Pop(), context);
}
}
return null;
}
}
}