Пример #1
0
        public override void Execute(EpsInterpreter interpreter)
        {
            if (!interpreter.IsInStoppedContext)
            {
                interpreter.QuitExecution();
            }

            interpreter.StopProcedure();
        }
Пример #2
0
        /// <summary>
        /// Execute the operand
        /// </summary>
        public override void Execute(EpsInterpreter interpreter)
        {
            if (interpreter.BreakCurrentLoop)
            {
                return;
            }

            if (BoundOperand != null)
            {
                interpreter.Execute(BoundOperand);
            }
            else
            {
                var name = new NameOperand {
                    Value = this.Name
                };
                var op = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name);

                if (op != null)
                {
                    interpreter.Execute(op);
                }
                else
                {
                    // Throwing an exception when the interpreter is within a stopped context
                    // would also be ok and is the prefered behavior. We test for the stopped
                    // context here to make debugging a bit easier. So that the debugger
                    // doesn't stop when the "exception" is handled in the postscript script,
                    // e.g. when tests are made if a command is available.

                    if (!interpreter.IsInStoppedContext)
                    {
                        throw new Exception($"unknown command \"{Name}\"");
                    }

                    interpreter.StopProcedure();
                }
            }
        }