示例#1
0
        public override CompileResult Compile()
        {
            var prevIsAddress = Prev.GetType() == typeof(ExcelAddressExpression);
            var prevIsOffset  = Prev.GetType() == typeof(FunctionExpression) && ((FunctionExpression)Prev).ExpressionString.ToLower() == "offset";
            var nextIsAddress = Next.GetType() == typeof(ExcelAddressExpression);
            var nextIsOffset  = Next.GetType() == typeof(FunctionExpression) && ((FunctionExpression)Next).ExpressionString.ToLower() == "offset";

            if (!prevIsAddress && !prevIsOffset)
            {
                return(new CompileResult(eErrorType.Value));
            }
            if (!nextIsAddress && !nextIsOffset)
            {
                return(new CompileResult(eErrorType.Value));
            }

            if (prevIsAddress && nextIsOffset)
            {
                return(InternalCompile(Prev.Compile().Result.ToString(), Next.Compile().Result as ExcelDataProvider.IRangeInfo));
            }
            else if (prevIsOffset && nextIsAddress)
            {
                return(InternalCompile(Prev.Compile().Result as ExcelDataProvider.IRangeInfo, Next.Compile().Result.ToString()));
            }
            else if (prevIsOffset && nextIsOffset)
            {
                return(InternalCompile(Prev.Compile().Result as ExcelDataProvider.IRangeInfo, Next.Compile().Result as ExcelDataProvider.IRangeInfo));
            }

            return(new CompileResult(eErrorType.Value));
        }