Пример #1
0
 private Operation AddArray(TVariableType type, bool assign)
 {
     Operation b = opstack.Pop();
     Operation a = opstack.Pop();
     Operation result = new Operation(a.Human + "[" + b.Human + "]");
     if (assign)
     {
         result.AssignedVariable = a.AssignedVariable;
         result.AssignIsGlobal = a.AssignIsGlobal;
     }
     return result;
 }
Пример #2
0
        private Operation AddArithmetic(TVariableType type, string opt)
        {
            Operation b = opstack.Pop();
            Operation a = opstack.Pop();
            Operation result = new Operation(String.Format("{0} {1} {2}", a.Human, opt, b.Human));

            int assign = a.AssignedVariable;
            if (assign >= 0)
            {
                // Тут мы нашли тип..
                if (a.AssignIsGlobal)
                    scriptContainer.Functions[1].Variables[assign].Type = type;
                else
                    function.Variables[assign].Type = type;
            }
            return result;
        }
Пример #3
0
        private Operation AddFetch(TVariableType type, bool assign)
        {
            Operation result = new Operation("");
            int varSrc = br.ReadInt32(); // 0 = current fn, 1 = GLOBAL fn
            if (varSrc > 1) Error("varSrc > 1 this is possible?");
            int varn = br.ReadInt32();
            if ((varSrc == 1))
            {
                result.Human = scriptContainer.Functions[1].Variables[varn].Name;
                result.AssignIsGlobal = true;
            }
            else
            {
                result.Human = function.Variables[varn].Name;
            }
            // Mark as assignment for future use in type detection routine
            if (assign) result.AssignedVariable = varn;

            return result;
        }
Пример #4
0
 private Operation AddImmediate(TVariableType type)
 {
     Operation result = null;
     switch (type)
     {
         case TVariableType.INTEGER:
             result = new Operation(br.ReadInt32().ToString());
             break;
         case TVariableType.FLOAT:
             result = new Operation(br.ReadSingle().ToString(floatFormat));
             break;
         case TVariableType.STRING:
             result = new Operation(String.Format("\"{0}\"", scriptContainer.ScriptStringTable[br.ReadInt32()]));
             break;
     }
     return result;
 }
Пример #5
0
 public FunctionInfo(string name, TVarType returnType, params TVarType[] arguments)
 {
     Name = name;
     Arguments = arguments;
     ReturnType = returnType;
 }