コード例 #1
0
ファイル: Parser.cs プロジェクト: presscad/BaseLayer
        public IBxUnitConvert Parse(IBxUnitConvert left, IFEBinary mid, ref int pos)
        {
            IBxUnitConvert param = ParseOneParam(ref pos);

            if (param == null)
            {
                if (mid != null)
                {
                    throw new Exception("操作符后未发现公式元素!");
                }
                else
                {
                    return(left);
                }
            }
            else
            {
                IFEBinary curOperator = ParseOneBinary(ref pos);
                if (curOperator == null) /*|| (curOperator.ElementType == EFormulaElementType.rightBrace)*/
                {
                    if (mid == null)
                    {
                        return(param);
                    }
                    else
                    {
                        return(new BUParsedItem(left, mid, param));
                    }
                }
                else
                {
                    if (mid == null)
                    {
                        return(Parse(param, curOperator, ref pos));
                    }
                    else
                    {
                        if (mid.Grade >= curOperator.Grade)
                        {
                            return(Parse(new BUParsedItem(left, mid, param), curOperator, ref pos));
                        }
                        else
                        {
                            IBxUnitConvert right = Parse(param, curOperator, ref pos);
                            if (right == null)
                            {
                                throw new Exception(string.Format("符号{0}之后的部分错误!", mid.ToString()));
                            }
                            return(new BUParsedItem(left, mid, right));
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Parser.cs プロジェクト: presscad/BaseLayer
        static BUOperators()
        {
            s_binarys    = new IFEBinary[4];
            s_binarys[0] = s_binaryAdd;
            s_binarys[1] = s_binarySubtract;
            s_binarys[2] = s_binaryMultiply;
            s_binarys[3] = s_binaryDivide;

            s_braces    = new IFormulaElement[2];
            s_braces[0] = s_leftBrace;
            s_braces[1] = s_rightBrace;
        }
コード例 #3
0
 public BUParsedItem(IBxUnitConvert leftParam, IFEBinary midOperater, IBxUnitConvert rightParam)
 {
     left  = leftParam;
     mid   = midOperater;
     right = rightParam;
 }
コード例 #4
0
 static IBxUnitConvert Contact(IBxUnitConvert left, IFEBinary mid, IBxUnitConvert right)
 {
     return(new BUParsedItem(left, mid, right));
 }