Exemplo n.º 1
0
        public void AddToken(FormulaTokenCode code, object[] data)
        {
            FormulaToken token1 = FormulaTokensFactory.CreateFromCode(code);

            this.tokens.Add(token1);
            token1.DelayInitialize(data);
        }
Exemplo n.º 2
0
        private bool TokenBytesToString(Stack operandsStack)
        {
            byte[] buffer1 = new byte[this.RpnBytes.Length];
            Array.Copy(this.RpnBytes, 0, buffer1, 0, this.RpnBytes.Length);
            int  num1  = 0;
            bool flag1 = false;
            bool flag2 = false;

            while (num1 < this.RpnBytes.Length)
            {
                FormulaToken token1 = FormulaTokensFactory.CreateFrom(buffer1, num1);
                if (token1.Type.IsControl)
                {
                    flag2 = true;
                }
                else
                {
                    flag1 = true;
                }
                CellFormula.ProcessToken(token1, operandsStack);
                num1 += token1.Size;
            }
            if (!flag1)
            {
                return(flag2);
            }
            return(false);
        }
Exemplo n.º 3
0
        ///<summary>
        ///Creates formula token from rpn bytes and the code read from that bytes.
        ///</summary>
        ///<param name="rpnBytes">The RPN bytes.</param>
        ///<param name="startIndex">The start index to read code from the RPN bytes.</param>
        ///<returns>created formula token</returns>
        public static FormulaToken CreateFrom(byte[] rpnBytes, int startIndex)
        {
            byte         num1   = rpnBytes[startIndex];
            FormulaToken token1 = FormulaTokensFactory.CreateFromCode(num1);

            token1.Read(rpnBytes, startIndex + 1);
            return(token1);
        }
Exemplo n.º 4
0
 private void AddBoolToken(string boolValue)
 {
     if (this.GetNextOnDemand('('))
     {
         this.Match(')');
         this.AddToken(FormulaTokensFactory.CreateFunctionFromName(boolValue, FormulaTokenClass.Reference, 0));
     }
     else
     {
         this.AddToken(FormulaTokenCode.Bool, bool.Parse(boolValue));
     }
 }
Exemplo n.º 5
0
        private void AddFunctionToken(string functionValue)
        {
            this.isFunctionArgumentsProcessed = true;
            byte num1 = this.ArgumentList();

            this.isFunctionArgumentsProcessed = false;
            this.GetNextOnDemand(')');
            FormulaFunctionInfo info1 = FormulaFunctionsTable.Instance[functionValue];
            byte num2 = info1.ArgumentsCount;

            if (num2 != 0xff)
            {
                string text1 = (num2 == 1) ? " argument." : " arguments.";
                if (num1 != num2)
                {
                    object[] objArray1 = new object[] { "Function: ", FormulaFunctionsTable.Instance[info1.Code].Name, " expects ", num2, text1 };
                    this.NotifyError(string.Concat(objArray1));
                }
            }
            this.AddToken(FormulaTokensFactory.CreateFunctionFromName(functionValue, FormulaTokenClass.Variable, num1));
        }
Exemplo n.º 6
0
 public void AddToken(FormulaTokenCode code)
 {
     this.tokens.Add(FormulaTokensFactory.CreateFromCode(code));
 }
Exemplo n.º 7
0
 ///<summary>
 ///Creates formula token from byte code.
 ///</summary>
 ///<param name="code">The byte code.</param>
 ///<returns>created formula token</returns>
 public static FormulaToken CreateFromCode(byte code)
 {
     return(FormulaTokensFactory.CreateFromCode((FormulaTokenCode)code));
 }