Esempio n. 1
0
        public Completion Execute(ExecutionEnvironment enviroment)
        {
            DateTime startTime;
            DateTime finishTime;
            double   orgin_x;
            double   orgin_y;
            double   totalTime;

            if (X == null)
            {
                return(Completion.Void);
            }
            double x = 0;

            try
            {
                var c = X.Execute(enviroment);
                if (c.Type != CompletionType.Value)
                {
                    return(c);
                }
                x = TypeConverters.GetValue <double>(c.ReturnValue);
            }
            catch
            {
                return(Completion.Exception("Wrong number format", X));
            }
            if (Y == null)
            {
                return(Completion.Void);
            }
            double y = 0;

            try
            {
                var c = Y.Execute(enviroment);
                if (c.Type != CompletionType.Value)
                {
                    return(c);
                }
                y = TypeConverters.GetValue <double>(c.ReturnValue);
            }
            catch
            {
                return(Completion.Exception("Wrong number format", Y));
            }
            if (Time == null)
            {
                return(Completion.Void);
            }
            double time = 0;

            try
            {
                var c = Time.Execute(enviroment);
                if (c.Type != CompletionType.Value)
                {
                    return(c);
                }
                time = TypeConverters.GetValue <double>(c.ReturnValue);
            }
            catch
            {
                return(Completion.Exception("Wrong number format", Time));
            }

            Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite;

            if (x < 0)
            {
                x = 0;
            }
            if (x > CurrentEnviroment.ScreenWidth)
            {
                x = CurrentEnviroment.ScreenWidth;
            }
            if (y < 0)
            {
                y = 0;
            }
            if (y > CurrentEnviroment.ScreenHeight)
            {
                y = CurrentEnviroment.ScreenHeight;
            }
            orgin_x    = sp.X;
            orgin_y    = sp.Y;
            startTime  = DateTime.Now;
            finishTime = DateTime.Now.AddSeconds(time);
            totalTime  = (finishTime - startTime).TotalMilliseconds;

            while (true)
            {
                if (DateTime.Now > finishTime)
                {
                    break;
                }
                double duration = (DateTime.Now - startTime).TotalMilliseconds;

                sp.X = (int)(orgin_x + (x - orgin_x) * duration / totalTime);
                sp.Y = (int)(orgin_y + (y - orgin_y) * duration / totalTime);
                App.Current.Dispatcher.InvokeAsync(new Action(() =>
                {
                    (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript();
                }));
                Thread.Sleep(100);
            }

            sp.X = (int)x;
            sp.Y = (int)y;
            App.Current.Dispatcher.InvokeAsync(new Action(() =>
            {
                (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript();
            }));
            return(Completion.Void);
        }
Esempio n. 2
0
        protected override Completion ExecuteImpl(ExecutionEnvironment enviroment)
        {
            if (Left == null)
            {
                return(Completion.Exception(Properties.Language.NullException, this));
            }
            if (Right == null)
            {
                return(Completion.Exception(Properties.Language.NullException, this));
            }
            var left = Left.Execute(enviroment);

            if (left.Type != CompletionType.Value)
            {
                return(left);
            }
            var right = Right.Execute(enviroment);

            if (right.Type != CompletionType.Value)
            {
                return(right);
            }
            if (IsLogicalOperator(Operator))
            {
                return(ExecuteLogical(enviroment, left.ReturnValue, right.ReturnValue));
            }
            if (Operator == Operator.Add)
            {
                if ((left.ReturnValue is string) || right.ReturnValue is string)
                {
                    return(ExecuteStringAdd(enviroment, left.ReturnValue, right.ReturnValue));
                }
            }
            if (Operator == Operator.Equal)
            {
                if (left.ReturnValue is string)
                {
                    return(new Completion(left.ReturnValue is string && (left.ReturnValue as string).Equals(right.ReturnValue)));
                }
                if (right.ReturnValue is string)
                {
                    return(new Completion(right.ReturnValue is string && (right.ReturnValue as string).Equals(left.ReturnValue)));
                }
                if (left.ReturnValue is bool)
                {
                    return(new Completion(right.ReturnValue is bool && (bool)right.ReturnValue == (bool)left.ReturnValue));
                }
                if (right.ReturnValue is bool)
                {
                    return(new Completion(left.ReturnValue is bool && (bool)left.ReturnValue == (bool)right.ReturnValue));
                }
                if (left.ReturnValue == null)
                {
                    if (right.ReturnValue == null)
                    {
                        return(new Completion(true));
                    }
                    else
                    {
                        return(new Completion(false));
                    }
                }
                if (right.ReturnValue == null)
                {
                    if (left.ReturnValue == null)
                    {
                        return(new Completion(true));
                    }
                    return(new Completion(false));
                }
            }
            if (Operator == Operator.NotEqual)
            {
                if (left.ReturnValue is string)
                {
                    return(new Completion(!(left.ReturnValue as string).Equals(right.ReturnValue)));
                }
                if (right.ReturnValue is string)
                {
                    return(new Completion(!(right.ReturnValue as string).Equals(left.ReturnValue)));
                }
                if (left.ReturnValue is bool)
                {
                    return(new Completion(!(right.ReturnValue is bool) || (bool)right.ReturnValue != (bool)left.ReturnValue));
                }
                if (right.ReturnValue is bool)
                {
                    return(new Completion(!(left.ReturnValue is bool) || (bool)left.ReturnValue != (bool)right.ReturnValue));
                }
                if (left.ReturnValue == null)
                {
                    if (right.ReturnValue != null)
                    {
                        return(new Completion(true));
                    }
                    else
                    {
                        return(new Completion(false));
                    }
                }
                if (right.ReturnValue == null)
                {
                    if (left.ReturnValue != null)
                    {
                        return(new Completion(true));
                    }
                    return(new Completion(false));
                }
            }
            if (Operator == Operator.Add)
            {
                if ((left.ReturnValue is DateTime) && right.ReturnValue is DateTime)
                {
                    return(ExecuteStringAdd(enviroment, left.ReturnValue, right.ReturnValue));
                }
            }
            Type T = TypeConverters.GetMaxTypes(left.ReturnValue, right.ReturnValue);

            if (T == null)
            {
                return(Completion.Exception(Properties.Language.NotNumber, this));
            }
            if (Operator == Operator.Mod || Operator == Operator.BitAnd || Operator == Operator.BitOr ||
                Operator == Operator.BitLeftShift || Operator == Operator.BitRightShift || Operator == Operator.BitExclusiveOr)
            {
                T = typeof(int);
            }
            if (T.Equals(typeof(char)))
            {
                try
                {
                    var l = TypeConverters.GetValue <char>(left.ReturnValue);
                    var r = TypeConverters.GetValue <char>(right.ReturnValue);
                    switch (Operator)
                    {
                    case Operator.Add:
                        return(new Completion(l + r));

                    case Operator.Minus:
                        return(new Completion(l - r));

                    case Operator.Mulitiply:
                        return(new Completion(l * r));

                    case Operator.Divide:
                        return(new Completion(l / r));

                    case Operator.Mod:
                        return(new Completion(l % r));

                    case Operator.Great:
                        return(new Completion(l > r));

                    case Operator.GreatOrEqual:
                        return(new Completion(l >= r));

                    case Operator.Less:
                        return(new Completion(l < r));

                    case Operator.LessOrEqual:
                        return(new Completion(l <= r));

                    case Operator.Equal:
                        return(new Completion(l == r));

                    case Operator.NotEqual:
                        return(new Completion(l != r));

                    case Operator.BitAnd:
                        return(new Completion(l & r));

                    case Operator.BitOr:
                        return(new Completion(l | r));

                    case Operator.BitLeftShift:
                        return(new Completion(l << r));

                    case Operator.BitRightShift:
                        return(new Completion(l >> r));

                    case Operator.BitExclusiveOr:
                        return(new Completion(l ^ r));
                    }
                    return(Completion.Exception(Properties.Language.UnknowException, this));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                    return(Completion.Exception(e.Message, this));
                }
            }
            if (T.Equals(typeof(int)))
            {
                try
                {
                    var l = TypeConverters.GetValue <int>(left.ReturnValue);
                    var r = TypeConverters.GetValue <int>(right.ReturnValue);
                    switch (Operator)
                    {
                    case Operator.Add:
                        return(new Completion(l + r));

                    case Operator.Minus:
                        return(new Completion(l - r));

                    case Operator.Mulitiply:
                        return(new Completion(l * r));

                    case Operator.Divide:
                        return(new Completion(l / r));

                    case Operator.Mod:
                        return(new Completion(l % r));

                    case Operator.Great:
                        return(new Completion(l > r));

                    case Operator.GreatOrEqual:
                        return(new Completion(l >= r));

                    case Operator.Less:
                        return(new Completion(l < r));

                    case Operator.LessOrEqual:
                        return(new Completion(l <= r));

                    case Operator.Equal:
                        return(new Completion(l == r));

                    case Operator.NotEqual:
                        return(new Completion(l != r));

                    case Operator.BitAnd:
                        return(new Completion(l & r));

                    case Operator.BitOr:
                        return(new Completion(l | r));

                    case Operator.BitLeftShift:
                        return(new Completion(l << r));

                    case Operator.BitRightShift:
                        return(new Completion(l >> r));

                    case Operator.BitExclusiveOr:
                        return(new Completion(l ^ r));
                    }
                    return(Completion.Exception(Properties.Language.UnknowException, this));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                    return(Completion.Exception(e.Message, this));
                }
            }
            if (T.Equals(typeof(float)))
            {
                try
                {
                    var l = TypeConverters.GetValue <float>(left.ReturnValue);
                    var r = TypeConverters.GetValue <float>(right.ReturnValue);
                    switch (Operator)
                    {
                    case Operator.Add:
                        return(new Completion(l + r));

                    case Operator.Minus:
                        return(new Completion(l - r));

                    case Operator.Mulitiply:
                        return(new Completion(l * r));

                    case Operator.Divide:
                        return(new Completion(l / r));

                    case Operator.Great:
                        return(new Completion(l > r));

                    case Operator.GreatOrEqual:
                        return(new Completion(l >= r));

                    case Operator.Less:
                        return(new Completion(l < r));

                    case Operator.LessOrEqual:
                        return(new Completion(l <= r));

                    case Operator.Equal:
                        return(new Completion(l == r));

                    case Operator.NotEqual:
                        return(new Completion(l != r));
                    }
                    return(Completion.Exception(Properties.Language.UnknowException, this));
                }
                catch (Exception e)
                {
                    return(Completion.Exception(e.Message, this));
                }
            }
            if (T.Equals(typeof(long)))
            {
                try
                {
                    var l = TypeConverters.GetValue <long>(left.ReturnValue);
                    var r = TypeConverters.GetValue <long>(right.ReturnValue);
                    switch (Operator)
                    {
                    case Operator.Add:
                        return(new Completion(l + r));

                    case Operator.Minus:
                        return(new Completion(l - r));

                    case Operator.Mulitiply:
                        return(new Completion(l * r));

                    case Operator.Divide:
                        return(new Completion(l / r));

                    case Operator.Great:
                        return(new Completion(l > r));

                    case Operator.GreatOrEqual:
                        return(new Completion(l >= r));

                    case Operator.Less:
                        return(new Completion(l < r));

                    case Operator.LessOrEqual:
                        return(new Completion(l <= r));

                    case Operator.Equal:
                        return(new Completion(l == r));

                    case Operator.NotEqual:
                        return(new Completion(l != r));
                    }
                    return(Completion.Exception(Properties.Language.UnknowException, this));
                }
                catch (Exception e)
                {
                    return(Completion.Exception(e.Message, this));
                }
            }
            {
                try
                {
                    double l = TypeConverters.GetValue <double>(left.ReturnValue);
                    double r = TypeConverters.GetValue <double>(right.ReturnValue);
                    switch (Operator)
                    {
                    case Operator.Add:
                        return(new Completion(l + r));

                    case Operator.Minus:
                        return(new Completion(l - r));

                    case Operator.Mulitiply:
                        return(new Completion(l * r));

                    case Operator.Divide:
                        return(new Completion(l / r));

                    case Operator.Great:
                        return(new Completion(l > r));

                    case Operator.GreatOrEqual:
                        return(new Completion(l >= r));

                    case Operator.Less:
                        return(new Completion(l < r));

                    case Operator.LessOrEqual:
                        return(new Completion(l <= r));

                    case Operator.Equal:
                        return(new Completion(l == r));

                    case Operator.NotEqual:
                        return(new Completion(l != r));
                    }
                    return(Completion.Exception(Properties.Language.UnknowException, this));
                }
                catch (Exception e)
                {
                    return(Completion.Exception(e.Message, this));
                }
            }
        }
Esempio n. 3
0
        public Completion Assign(ExecutionEnvironment environment, object value)
        {
            if (string.IsNullOrEmpty(SetMemberFunction))
            {
                return(Completion.Exception("this is can not set", this));
            }
            if (Object == null)
            {
                return(Completion.Exception("object parameter can not be null", this));
            }
            var tc = Object.Execute(environment);

            if (!tc.IsValue)
            {
                return(tc);
            }
            object obj = tc.ReturnValue;

            if (obj == null)
            {
                return(Completion.Exception("object value can not be null", Object));
            }
            object m = null;

            if (IsMemberRequired)
            {
                if (Member == null)
                {
                    return(Completion.Exception("member parameter can not be null", this));
                }
                var mc = Member.Execute(environment);
                if (!mc.IsValue)
                {
                    return(mc);
                }
                m = mc.ReturnValue;
            }
            Type t = obj.GetType();

            try
            {
                if (MemberType == MemberType.Function)
                {
                    MethodInfo set = t.GetMethod(SetMemberFunction);
                    if (set == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    if (IsMemberRequired)
                    {
                        set.Invoke(obj, new object[] { m, value });
                    }
                    else
                    {
                        set.Invoke(obj, new object[] { value });
                    }
                    return(new Completion(value));
                }
                else if (MemberType == MemberType.Property)
                {
                    PropertyInfo set = t.GetProperty(SetMemberFunction);
                    if (set == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    set.SetValue(obj, value);
                    return(new Completion(value));
                }
                else
                {
                    FieldInfo set = t.GetField(SetMemberFunction);
                    if (set == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    set.SetValue(obj, value);
                    return(new Completion(value));
                }
            }catch (Exception e)
            {
                return(Completion.Exception(e.Message, this));
            }
        }
Esempio n. 4
0
        protected override Completion ExecuteImpl(ExecutionEnvironment environment)
        {
            if (Object == null)
            {
                return(Completion.Exception("object parameter can not be null", this));
            }
            var tc = Object.Execute(environment);

            if (!tc.IsValue)
            {
                return(tc);
            }
            object obj = tc.ReturnValue;

            if (obj == null)
            {
                return(Completion.Exception("object value can not be null", Object));
            }
            object m = null;

            if (IsMemberRequired)
            {
                if (Member == null)
                {
                    return(Completion.Exception("member parameter can not be null", this));
                }
                var mc = Member.Execute(environment);
                if (!mc.IsValue)
                {
                    return(mc);
                }
                m = mc.ReturnValue;
            }
            Type t = obj.GetType();

            try
            {
                if (MemberType == MemberType.Function)
                {
                    MethodInfo get = t.GetMethod(GetMemberFunction);
                    if (get == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    object value = null;
                    if (IsMemberRequired)
                    {
                        value = get.Invoke(obj, new object[] { m });
                    }
                    else
                    {
                        value = get.Invoke(obj, new object[] {  });
                    }
                    return(new Completion(value));
                }
                else if (MemberType == MemberType.Property)
                {
                    PropertyInfo get = t.GetProperty(GetMemberFunction);
                    if (get == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    object value = get.GetValue(obj);
                    return(new Completion(value));
                }
                else
                {
                    FieldInfo get = t.GetField(GetMemberFunction);
                    if (get == null)
                    {
                        return(Completion.Exception("No member function for " + obj.GetType(), Member));
                    }
                    object value = get.GetValue(obj);
                    return(new Completion(value));
                }
            }
            catch (Exception e)
            {
                return(Completion.Exception(e.Message, this));
            }
        }
Esempio n. 5
0
        public Completion Execute(Class m)
        {
            IsAborting  = false;
            IsCompleted = false;
            _current    = m;
            if (_current == null)
            {
                return(null);
            }
            Completion           c           = Completion.Void;
            ExecutionEnvironment baseEnv     = this.GetBaseEnvironment();
            ExecutionEnvironment classEnv    = new ExecutionEnvironment(baseEnv);
            ExecutionEnvironment instanceEnv = new ExecutionEnvironment(classEnv);

            foreach (var v in m.Variables)
            {
                instanceEnv.RegisterValue(v.Name, v.Value);
            }
            foreach (var func in _current.Functions)
            {
                if ("main".Equals(func.Name, StringComparison.OrdinalIgnoreCase))
                {
                    var parameter = func.Params;
                    ExecutionEnvironment functionEnv = new ExecutionEnvironment(instanceEnv);
                    ExecutionStarted?.Invoke(this, null);
                    foreach (var p in parameter)
                    {
                        functionEnv.RegisterValue(p.Name, null);
                    }
                    foreach (var block in m.BlockStatements)
                    {
                        foreach (var s in block.Body)
                        {
                            if (s is ExpressionStatement)
                            {
                                Expression exp = (s as ExpressionStatement).Expression;
                                if (exp is VariableDeclarationExpression)
                                {
                                    exp.Execute(instanceEnv);
                                }
                            }
                        }
                    }
                    try
                    {
                        IsCompleted = false;
                        c           = func.Execute(functionEnv);
                        break;
                    }catch (Exception e)
                    {
                        IsCompleted = true;
                        Console.WriteLine(e.Message);
                        Console.WriteLine(e.StackTrace);
                        ExecutionAborted?.Invoke(this, new Completion(e.Message, CompletionType.Exception));
                        return(Completion.Void);
                    }
                }
            }
            IsCompleted = true;
            if (c.Type == CompletionType.Value)
            {
                ExecutionCompleted?.Invoke(this, c);
            }
            else if (c.Type == CompletionType.Exception)
            {
                ExecutionAborted?.Invoke(this, c);
            }
            else
            {
                ExecutionAborted?.Invoke(this, Completion.Exception(Properties.Language.UnknowException, null));
            }
            return(c);
        }
        protected override Completion ExecuteImpl(ExecutionEnvironment enviroment)
        {
            if (Right == null)
            {
                return(Completion.Exception(Properties.Language.NoValueAssigned, this));
            }
            var right = Right.Execute(enviroment);

            if (right.Type != CompletionType.Value)
            {
                return(right);
            }
            if (Left == null)
            {
                return(right);
            }
            if (Left is IAssignment)
            {
                try
                {
                    if (Operator == AssignmentOperator.Equal)
                    {
                        return((Left as IAssignment).Assign(enviroment, right.ReturnValue));
                    }
                    var l = Left.Execute(enviroment);
                    if (!l.IsValue)
                    {
                        return(l);
                    }
                    if (l.ReturnValue == null)
                    {
                        return(Completion.Exception(Properties.Language.VariableNullException, Left));
                    }
                    Type lt = l.ReturnValue.GetType();

                    if (l.ReturnValue is string || right.ReturnValue is string)
                    {
                        if (Operator != AssignmentOperator.AddEqual)
                        {
                            return(Completion.Exception(Properties.Language.StringOnlySupport, this));
                        }
                        return((Left as IAssignment).Assign(enviroment, l.ReturnValue + "" + right.ReturnValue));
                    }
                    if (!TypeConverters.IsNumber(l.ReturnValue))
                    {
                        return(Completion.Exception(Properties.Language.NotNumber, Left));
                    }
                    if (!TypeConverters.IsNumber(right.ReturnValue))
                    {
                        return(Completion.Exception(Properties.Language.NotNumber, Right));
                    }
                    Type maxType = TypeConverters.GetMaxTypes(l.ReturnValue, right.ReturnValue);
                    Console.Write(maxType);
                    if (maxType.Equals(typeof(char)))
                    {
                        var lint = TypeConverters.GetValue <char>(l.ReturnValue);
                        var rint = TypeConverters.GetValue <char>(right.ReturnValue);
                        if (Operator == AssignmentOperator.AddEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint + rint));
                        }
                        if (Operator == AssignmentOperator.MinusEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint - rint));
                        }
                        if (Operator == AssignmentOperator.MulitiplyEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint * rint));
                        }
                        if (Operator == AssignmentOperator.DivideEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint / rint));
                        }
                        if (Operator == AssignmentOperator.ModEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint % rint));
                        }
                        if (Operator == AssignmentOperator.BitAndEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint & rint));
                        }
                        if (Operator == AssignmentOperator.BitExclusiveOrEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint ^ rint));
                        }
                        if (Operator == AssignmentOperator.BitLeftShiftEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint << rint));
                        }
                        if (Operator == AssignmentOperator.BitOrEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint | rint));
                        }
                        if (Operator == AssignmentOperator.BitRightShiftEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint >> rint));
                        }
                        return(Completion.Exception(Properties.Language.UnknowException, this));
                    }
                    if (Operator == AssignmentOperator.BitAndEqual || Operator == AssignmentOperator.BitExclusiveOrEqual || Operator == AssignmentOperator.BitLeftShiftEqual ||
                        Operator == AssignmentOperator.BitOrEqual || Operator == AssignmentOperator.BitRightShiftEqual)
                    {
                        int lint = TypeConverters.GetValue <int>(l.ReturnValue);
                        int rint = TypeConverters.GetValue <int>(right.ReturnValue);
                        if (Operator == AssignmentOperator.BitAndEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint & rint));
                        }
                        if (Operator == AssignmentOperator.BitExclusiveOrEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint ^ rint));
                        }
                        if (Operator == AssignmentOperator.BitLeftShiftEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint << rint));
                        }
                        if (Operator == AssignmentOperator.BitOrEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint | rint));
                        }
                        if (Operator == AssignmentOperator.BitRightShiftEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint >> rint));
                        }
                        return(Completion.Exception(Properties.Language.UnknowException, this));
                    }
                    if (maxType.Equals(typeof(int)))
                    {
                        int lint = TypeConverters.GetValue <int>(l.ReturnValue);
                        int rint = TypeConverters.GetValue <int>(right.ReturnValue);
                        if (Operator == AssignmentOperator.AddEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint + rint));
                        }
                        if (Operator == AssignmentOperator.MinusEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint - rint));
                        }
                        if (Operator == AssignmentOperator.MulitiplyEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint * rint));
                        }
                        if (Operator == AssignmentOperator.DivideEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint / rint));
                        }
                        if (Operator == AssignmentOperator.ModEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint % rint));
                        }
                        return(Completion.Exception(Properties.Language.UnknowException, this));
                    }
                    else if (maxType.Equals(typeof(float)))
                    {
                        float lint = TypeConverters.GetValue <float>(l.ReturnValue);
                        float rint = TypeConverters.GetValue <int>(right.ReturnValue);
                        if (Operator == AssignmentOperator.AddEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint + rint));
                        }
                        if (Operator == AssignmentOperator.MinusEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint - rint));
                        }
                        if (Operator == AssignmentOperator.MulitiplyEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint * rint));
                        }
                        if (Operator == AssignmentOperator.DivideEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint / rint));
                        }
                        if (Operator == AssignmentOperator.ModEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint % rint));
                        }
                        return(Completion.Exception(Properties.Language.UnknowException, this));
                    }
                    else
                    {
                        double lint = TypeConverters.GetValue <double>(l.ReturnValue);
                        double rint = TypeConverters.GetValue <double>(right.ReturnValue);
                        if (Operator == AssignmentOperator.AddEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint + rint));
                        }
                        if (Operator == AssignmentOperator.MinusEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint - rint));
                        }
                        if (Operator == AssignmentOperator.MulitiplyEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint * rint));
                        }
                        if (Operator == AssignmentOperator.DivideEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint / rint));
                        }
                        if (Operator == AssignmentOperator.ModEqual)
                        {
                            return((Left as IAssignment).Assign(enviroment, lint % rint));
                        }
                        return(Completion.Exception(Properties.Language.UnknowException, this));
                    }
                }catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                    return(Completion.Exception(e.Message, this));
                }
            }
            else
            {
                return(Completion.Exception(Properties.Language.InvalidBeforeEqual, Left));
            }
        }