Inheritance: kOS.ExecutionContext
Example #1
0
        public override void Evaluate()
        {
            targetVariable = ParentContext.FindOrCreateVariable(RegexMatch.Groups[1].Value);
            targetCommand = Command.Get(RegexMatch.Groups[2].Value, ParentContext);

            if (!objToBool(targetVariable.Value, out originalValue))
            {
                throw new Exception("Value type error");
            }

            ParentContext.Lock(this);

            State = ExecutionState.DONE;
        }
Example #2
0
        public override void Evaluate()
        {
            targetExpression = new Expression(RegexMatch.Groups[1].Value, ParentContext);
            targetCommand = Command.Get(RegexMatch.Groups[2].Value, ParentContext);

            if (!objToBool(targetExpression.GetValue(), out originalValue))
            {
                throw new kOSException("Value type error");
            }

            ParentContext.Lock(this);

            State = ExecutionState.DONE;
        }
Example #3
0
 public virtual void Unlock(Command command)
 {
     CommandLocks.Remove(command);
     if (ParentContext != null) ParentContext.Unlock(command);
 }
Example #4
0
 public virtual void Lock(Command command)
 {
     CommandLocks.Add(command);
 }
Example #5
0
        public override void Evaluate()
        {
            waitExpression = new Expression(RegexMatch.Groups[1].Value, ParentContext);

            var numLinesChild = Utils.NewLineCount(Input.Substring(0, RegexMatch.Groups[2].Index));
            targetCommand = Get(RegexMatch.Groups[2].Value, this, Line + numLinesChild);

            //commandString = RegexMatch.Groups[2].Value;

            State = ExecutionState.WAIT;
        }
Example #6
0
        public override void Evaluate()
        {
            expression = new Expression(RegexMatch.Groups[1].Value, ParentContext);

            int numLinesChild = Utils.NewLineCount(Input.Substring(0, RegexMatch.Groups[2].Index));
            targetCommand = Get(RegexMatch.Groups[2].Value, this, Line + numLinesChild);

            if (expression.IsTrue())
            {
                targetCommand.Evaluate();
                Push(targetCommand);
                State = ExecutionState.WAIT;
            }
            else
            {
                State = ExecutionState.DONE;
            }
        }
Example #7
0
        public override void Evaluate()
        {
            var listName = RegexMatch.Groups[2].Value;
            iteratorString = RegexMatch.Groups[1].Value;

            var expression = new Expression(listName, ParentContext).GetValue();
            var list = expression as ListValue;
            iterator = list.GetSuffix("ITERATOR") as Enumerator;

            int numLinesChild = Utils.NewLineCount(Input.Substring(0, RegexMatch.Groups[2].Index));
            targetCommand = Get(RegexMatch.Groups[3].Value, this, Line + numLinesChild);

            State = ExecutionState.WAIT;
        }
Example #8
0
        public override void Evaluate()
        {
            expression = new Expression(RegexMatch.Groups[1].Value, ParentContext);
            targetCommand = Command.Get(RegexMatch.Groups[2].Value, ParentContext);

            ParentContext.Lock(this);

            State = ExecutionState.DONE;
        }
Example #9
0
 public override void Unlock(Command command)
 {
     if (ParentContext != null) ParentContext.Unlock(command);
 }
Example #10
0
        public override void Evaluate()
        {
            expression = new Expression(RegexMatch.Groups[1].Value, ParentContext);
            targetCommand = Command.Get(RegexMatch.Groups[2].Value, this);

            if (expression.IsTrue())
            {
                targetCommand.Evaluate();
                Push(targetCommand);
                State = ExecutionState.WAIT;
            }
            else
            {
                State = ExecutionState.DONE;
            }
        }