Пример #1
0
        public void AddToken(FormulaTokenCode code, object[] data)
        {
            FormulaToken token = FormulaTokensFactory.CreateFromCode(this.worksheet, code);

            this.tokens.Add(token);
            token.DelayInitialize(data);
        }
Пример #2
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));
     }
 }
Пример #3
0
        private void AddFunctionToken(string functionValue)
        {
            this.isFunctionArgumentsProcessed = true;
            this.lastFunctionInfo             = FormulaFunctionsTable.Instance[functionValue];
            byte argumentsCount = this.ArgumentList();

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

            if (num2 != 255)
            {
                string str = (num2 == 1) ? " argument." : " arguments.";
                if (argumentsCount != num2)
                {
                    this.NotifyError(string.Concat(new object[] { "Function: ", FormulaFunctionsTable.Instance[info.Code].Name, " expects ", num2, str }));
                }
            }
            this.AddToken(FormulaTokensFactory.CreateFunctionFromName(functionValue, this.lastFunctionInfo.ReturnCode, argumentsCount));
        }
Пример #4
0
        private bool TokenBytesToString(Stack operandsStack)
        {
            byte[] destinationArray = new byte[this.RpnBytes.Length];
            Array.Copy(this.RpnBytes, 0, destinationArray, 0, this.RpnBytes.Length);
            int  startIndex = 0;
            bool flag       = false;
            bool flag2      = false;

            while (startIndex < this.RpnBytes.Length)
            {
                FormulaToken token = FormulaTokensFactory.CreateFrom(this.sheet, destinationArray, startIndex);
                if (token.Type.IsControl)
                {
                    flag2 = true;
                }
                else
                {
                    flag = true;
                }
                ProcessToken(token, operandsStack);
                startIndex += token.Size;
            }
            return(!flag && flag2);
        }
Пример #5
0
 public void AddToken(FormulaTokenCode code)
 {
     this.tokens.Add(FormulaTokensFactory.CreateFromCode(this.worksheet, code));
 }