Bepis vor 6 Jahren
Ursprung
Commit
7024a84aeb
1 geänderte Dateien mit 13 neuen und 0 gelöschten Zeilen
  1. 13 0
      NTERA.Engine/Runtime/Base/Keywords.cs

+ 13 - 0
NTERA.Engine/Runtime/Base/Keywords.cs

@@ -58,6 +58,19 @@ namespace NTERA.Engine.Runtime.Base
 			runtime.Call(runtime.ExecutionProvider.DefinedProcedures.First(x => x.Name == "SYSTEM_TITLE"));
 		}
 
+		[Keyword("GOTO", true)]
+		public static void Goto(EraRuntime runtime, StackFrame context, ExecutionNode node)
+		{
+			string target = runtime.ComputeExpression(context, node[0]).String;
+
+			var nodeTarget = context.ExecutionNodes.FirstOrDefault(x => x.Anchor == target);
+
+			if (nodeTarget == null)
+				throw new EraRuntimeException($"Could not find GOTO anchor '{target}'");
+
+			context.ExecutionIndex = context.ExecutionNodes.IndexOf(nodeTarget);
+		}
+
 		[Keyword("INPUT")]
 		public static void Input(EraRuntime runtime, StackFrame context, ExecutionNode node)
 		{