Beispiel #1
0
        private void ExecuteArray()
        {
            IObject obj    = VariablesDictionary.GetObject(variable);
            IObject result = obj;

            GetIndexes();
            for (int i = 0; i < indexes.Count; ++i)
            {
                if (i == indexes.Count - 1)
                {
                    if (obj is ArrayIndex && indexes[i] is int)
                    {
                        ((ArrayIndex)obj)[(int)indexes[i]] = getObject();
                    }
                    else if (obj is ArrayObject && indexes[i] is string)
                    {
                        ((ArrayObject)obj)[(string)indexes[i]] = getObject();
                    }
                    else
                    {
                        throw new Exception("wrong index or type");
                    }
                    break;
                }
                if (obj is ArrayIndex && indexes[i] is int)
                {
                    obj = ((ArrayIndex)obj)[(int)indexes[i]];
                }
                else if (obj is ArrayObject && indexes[i] is string)
                {
                    obj = ((ArrayObject)obj)[(string)indexes[i]];
                }
                else
                {
                    throw new Exception("wrong index or type");
                }
            }
            VariablesDictionary.SetVariable(variable, result);
        }
        //default
        private IExpressionData DefaultEvaluate()
        {
            IObject data = VariablesDictionary.GetObject(name);

            return(getVariable(data));
        }