public void PreStackObjectAccess(BaseInterpreterStack stack, int objectsRequested) { if (stack.Size < objectsRequested) Enumerable.Repeat(new CanonicalNumber(), objectsRequested - stack.Size).ToList().ForEach(obj => stack.Push(obj)); }
internal override void Execute(InterpreterState state, SourceCode code, BaseInterpreterStack stack) { var obj = stack.Pop(); stack.Pop(); stack.Push(obj); }
internal override void Execute(InterpreterState state, SourceCode code, BaseInterpreterStack stack) { var obj = stack.Pop<WARPObject>(); PropertyBasedExecutionEnvironment env = Environment(state); if (!env.HasScratchPadEntry(Constants.KeyWords.Comparison)) { stack.Push(obj); PropertyBasedExecutionEnvironment.ScratchPad[Constants.KeyWords.Comparison] = String.Empty; } else { var lhs = stack.Pop<WARPObject>(); PropertyBasedExecutionEnvironment.ScratchPad.Remove(Constants.KeyWords.Comparison); var bothNumeric = lhs.IsNumeric && obj.IsNumeric; Func<int> cmp = () => { var f = lhs.AsNumeric(); var s = obj.AsNumeric(); return (f < s ? -1 : (f > s ? 1 : 0)); }; stack.Push(new WARPObject(bothNumeric ? cmp() : string.Compare(lhs.AsString(), obj.AsString()))); } }
internal override void Execute(InterpreterState state, SourceCode code, BaseInterpreterStack stack) { var style = stack.Pop<WARPObject>().AsString(); ExecutionSupport.Assert(Options.Contains(style), string.Concat("Invalid argument for ',' - ", style)); stack.Push(style == "l" ? new WARPObject(InteractionWrapper.ReadString("0").Result) : new WARPObject(Convert.ToChar(InteractionWrapper.ReadCharacter().Result))); }