using System; using System.Collections.Generic; using System.Text; using Sunweaver.Commands.Attributes; using Sunweaver.VM; namespace Sunweaver.Commands { [Punctuation(@"Perform a ""loop"" operation with the given codule slot.")] public class ExplicitLoop : Commands.Label { public ExplicitLoop(string name, Int16 number) : base(name, number) { } public override void Implementation(VirtualMachine VM) { if (VM.Stack.Count == 0) { // Abort return; } loop.LoopOperation(VM, VM.Stack.Pop(), this.number); } public override string ToString() { if (Name != string.Empty) return "#" + Name; else return "#" + number.ToString(); } } }