Beispiel #1
0
        public override XTFormulaToken Parse(XTFormulaParser parser, HashSet <string> argNames)
        {
            if (parser.CurrChar() != '(')
            {
                return(null);
            }
            parser.NextChar();
            XTFormula formula = parser.InnerParse(argNames);
            int       end     = parser.NextChar();

            if (end != ')')
            {
                parser.RaiseFormulaException();
            }
            return(new XTScopeToken(formula));
        }
Beispiel #2
0
        private XTFormulaToken CreateToken(XTFormulaParser parser, HashSet <string> argNames, BaseFuncInfo funcInfo)
        {
            // 函数开始
            if (parser.NextRegx(funcInfo.ReStart) == null)
            {
                return(null);
            }

            // 函数参数
            XTFormula formula;

            XTFormula[] formulas = new XTFormula[funcInfo.ArgCount];
            for (int i = 0; i < funcInfo.ArgCount; ++i)
            {
                if (i > 0)
                {
                    if (parser.NextRegx(sm_reSplit) == null)
                    {
                        parser.RaiseFormulaException();
                    }
                }
                formula = parser.InnerParse(argNames);
                if (formula == null)
                {
                    parser.RaiseFormulaException();
                }
                formulas[i] = formula;
            }

            // 函数结束
            if (parser.NextRegx(sm_reEnd) == null)
            {
                parser.RaiseFormulaException();
            }
            return(funcInfo.CreateToken(formulas));
        }