public Rule_Assign_DLL_Statement(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Assign_DLL_Statement>  ::= ASSIGN <Qualified ID> '=' identifier'!'Identifier '(' <FunctionParameterList> ')'

            this.QualifiedId = this.GetCommandElement(pToken.Tokens, 1);
            this.ClassName   = this.GetCommandElement(pToken.Tokens, 3);
            this.MethodName  = this.GetCommandElement(pToken.Tokens, 5);

            //this.ParameterList = new Rule_FunctionParameterList(pContext, (NonterminalToken)pToken.Tokens[7]);
            this.ParameterList = EnterRule.GetFunctionParameters(pContext, (NonterminalToken)pToken.Tokens[7]);
            if (!this.Context.AssignVariableCheck.ContainsKey(this.QualifiedId.ToLower()))
            {
                this.Context.AssignVariableCheck.Add(this.QualifiedId.ToLower(), this.QualifiedId.ToLower());
            }
        }
示例#2
0
 public Rule_Second(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext, pToken, FunctionUtils.DateInterval.Year)
 {
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
     AddCommandVariableCheckValue(ParameterList, "second");
     //if (ParameterList.Count > 0)
     //{
     //    foreach (var item in ParameterList)
     //    {
     //        if (item is Rule_Value)
     //        {
     //            var id = ((Epi.Core.EnterInterpreter.Rules.Rule_Value)(item)).Id;
     //            if (!this.Context.CommandVariableCheck.ContainsKey(id.ToLowerInvariant()))
     //            {
     //                this.Context.CommandVariableCheck.Add(id.ToLowerInvariant(), "second");
     //            }
     //        }
     //    }
     //}
 }
        public Rule_Substring(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //SUBSTRING(fullString,startingIndex,length)
            this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
            AddCommandVariableCheckValue(ParameterList, "substring");
            //if (ParameterList.Count() > 0)
            //{

            //    foreach (var item in ParameterList)
            //    {
            //        if (item is Rule_Value)
            //        {
            //            if (!this.Context.CommandVariableCheck.ContainsKey(((Rule_Value)(item)).Id.ToLowerInvariant()))
            //            {
            //                this.Context.CommandVariableCheck.Add(((Rule_Value)(item)).Id, "substring");
            //            }
            //        }
            //    }
            //}
        }
示例#4
0
 public Rule_FindText(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //SUBSTRING(fullString,startingIndex,length)
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
     AddCommandVariableCheckValue(ParameterList, "findtext");
     //if (ParameterList.Count > 0)
     //{
     //    foreach (var item in ParameterList)
     //    {
     //        if (item is Rule_Value)
     //        {
     //            var id = ((Epi.Core.EnterInterpreter.Rules.Rule_Value)(item)).Id;
     //            if (!this.Context.CommandVariableCheck.ContainsKey(id.ToLowerInvariant()))
     //            {
     //                this.Context.CommandVariableCheck.Add(id.ToLowerInvariant(), "findtext");
     //            }
     //        }
     //    }
     //}
 }
示例#5
0
        /// <summary>
        /// Reduction to calculate the difference between two dates.
        /// </summary>
        /// <param name="pToken">The token to use to build the reduction.</param>
        /// <param name="interval">The date interval to use for calculating the difference (seconds, hours, days, months, years)</param>
        public Rule_DateDiff(Rule_Context pContext, NonterminalToken pToken, FunctionUtils.DateInterval interval)
            : base(pContext)
        {
            currentInterval    = interval;
            this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);

            /*
             * NonterminalToken T = (NonterminalToken)pToken.Tokens[0];
             * string type = pToken.Rule.Lhs.ToString();
             * switch (type)
             * {
             *  case "<FunctionParameterList>":
             *      this.ParamList = new Rule_FunctionParameterList(pContext, pToken);
             *      break;
             *  case "<FunctionCall>":
             *      this.functionCall = new Rule_FunctionCall(pContext, T);
             *      break;
             *  default:
             *      break;
             * }*/
        }
示例#6
0
 public Rule_Rnd(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
 }
 public Rule_Months(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext, pToken, FunctionUtils.DateInterval.Year)
 {
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
 }
 public Rule_Abs(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
     AddCommandVariableCheckValue(ParameterList, "abs");
 }
 public Rule_Days(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext, pToken, FunctionUtils.DateInterval.Minute)
 {
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
     AddCommandVariableCheckValue(ParameterList, "days");
 }
        /// <summary>
        /// Constructor for Rule_FunctionCall
        /// </summary>
        /// <param name="pToken">The token to build the reduction with.</param>
        public Rule_FunctionCall(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            /*
            <FunctionCall> ::= <FuncName1> '(' <FunctionParameterList> ')'
			    | <FuncName1> '(' <FunctionCall> ')' 
			    | <FuncName2>
             */
       
            NonterminalToken T;
            if (pToken.Tokens.Length == 1)
            {
                if (pToken.Rule.ToString().Equals("<FunctionCall>"))
                {
                    T = (NonterminalToken)pToken.Tokens[0];
                }
                else
                {
                    T = pToken;
                }
            }
            else
            {
                T = (NonterminalToken)pToken.Tokens[2];
            }


            string temp = null;
            string[] temp2 = null;

            if (pToken.Tokens[0] is NonterminalToken)
            {
                temp = this.ExtractTokens(((NonterminalToken)pToken.Tokens[0]).Tokens).Replace(" . ", ".");
                temp2 = temp.Split('.');

            }
            else
            {
                temp = ((TerminalToken)pToken.Tokens[0]).Text.Replace(" . ", ".");
            }

            if(temp2 != null && temp2.Length > 1)
            {
                this.ClassName = temp2[0].Trim();
                this.MethodName = temp2[1].Trim();

                this.ParameterList = EnterRule.GetFunctionParameters(pContext, (NonterminalToken)pToken.Tokens[2]);
            }
            else
            {
                functionName = this.GetCommandElement(pToken.Tokens, 0).ToString();

                switch (functionName.ToUpperInvariant())
                {
                    case "ABS":
                        functionCall = new Rule_Abs(pContext, T);
                        break;
                    case "COS":
                        functionCall = new Rule_Cos(pContext, T);
                        break;
                    case "CURRENTUSER":
                        functionCall = new Rule_CurrentUser(pContext, T);
                        break;
                    case "DAY":
                        functionCall = new Rule_Day(pContext, T);
                        break;
                    case "DAYS":
                        functionCall = new Rule_Days(pContext, T);
                        break;
                    case "FORMAT":
                        functionCall = new Rule_Format(pContext, T);
                        break;
                    case "HOUR":
                        functionCall = new Rule_Hour(pContext, T);
                        break;
                    case "HOURS":
                        functionCall = new Rule_Hours(pContext, T);
                        break;
                    case "ISUNIQUE":
                        functionCall = new Rule_IsUnique(pContext, T);
                        break;
                    case "LINEBREAK":
                        functionCall = new Rule_LineBreak(pContext, T);
                        break;
                    case "MINUTE":
                        functionCall = new Rule_Minute(pContext, T);
                        break;
                    case "MINUTES":
                        functionCall = new Rule_Minutes(pContext, T);
                        break;
                    case "MONTH":
                        functionCall = new Rule_Month(pContext, T);
                        break;
                    case "MONTHS":
                        functionCall = new Rule_Months(pContext, T);
                        break;
                    case "NUMTODATE":
                        functionCall = new Rule_NumToDate(pContext, T);
                        break;
                    case "NUMTOTIME":
                        functionCall = new Rule_NumToTime(pContext, T);
                        break;
                    case "RECORDCOUNT":
                        functionCall = new Rule_RecordCount(pContext, T);
                        break;
                    case "SECOND":
                        functionCall = new Rule_Second(pContext, T);
                        break;
                    case "SECONDS":
                        functionCall = new Rule_Seconds(pContext, T);
                        break;
                    case "SQRT":
                        functionCall = new Rule_SQRT_Func(pContext, T);
                        break;
                    case "SYSBARCODE":
                        functionCall = new Rule_SystemBarcode(pContext, T);
                        break;
                    case "SYSLATITUDE":
                        functionCall = new Rule_SystemLatitude(pContext, T);
                        break;
                    case "SYSLONGITUDE":
                        functionCall = new Rule_SystemLongitude(pContext, T);
                        break;
                    case "SYSALTITUDE":
                        functionCall = new Rule_SystemAltitude(pContext, T);
                        break;
                    case "SYSTEMDATE":
                        functionCall = new Rule_SystemDate(pContext, T);
                        break;
                    case "SYSTEMTIME":
                        functionCall = new Rule_SystemTime(pContext, T);
                        break;
                    case "TXTTODATE":
                        functionCall = new Rule_TxtToDate(pContext, T);
                        break;
                    case "TXTTONUM":
                        functionCall = new Rule_TxtToNum(pContext, T);
                        break;
                    case "YEAR":
                        functionCall = new Rule_Year(pContext, T);
                        break;
                    case "YEARS":
                        functionCall = new Rule_Years(pContext, T);
                        break;
                    case "SUBSTRING":
                        functionCall = new Rule_Substring(pContext, T);
                        break;
                    case "RND":
                        functionCall = new Rule_Rnd(pContext, T);
                        break;
                    case "EXP":
                        functionCall = new Rule_Exp_Func(pContext, T);
                        break;
                    case "LN":
                        functionCall = new Rule_LN_Func(pContext, T);
                        break;
                    case "ROUND":
                        functionCall = new Rule_Round(pContext, T);
                        break;
                    case "LOG":
                        functionCall = new Rule_LOG_Func(pContext, T);
                        break;
                    case "SIN":
                        functionCall = new Rule_Sin(pContext, T);
                        break;
                    case "TAN":
                        functionCall = new Rule_Tan(pContext, T);
                        break;
                    case "TRUNC":
                        functionCall = new Rule_TRUNC(pContext, T);
                        break;
                    case "STEP":
                        functionCall = new Rule_Step(pContext, T);
                        break;
                    case "UPPERCASE":
                        functionCall = new Rule_UpperCase(pContext, T);
                        break;
                    case "FINDTEXT":
                        functionCall = new Rule_FindText(pContext, T);
                        break;
                    case "ENVIRON":
                        functionCall = new Rule_FindText(pContext, T);
                        break;
                    case "EXISTS":
                        functionCall = new Rule_Exists(pContext, T);
                        break;
                    case "FILEDATE":
                        functionCall = new Rule_FileDate(pContext, T);
                        break;
                    case "ZSCORE":
                        functionCall = new Rule_ZSCORE(pContext, T);
                        break;
                    case "PFROMZ":
                        functionCall = new Rule_PFROMZ(pContext, T);
                        break;
                    case "EPIWEEK":
                        functionCall = new Rule_EPIWEEK(pContext, T);
                        break;
                    case "STRLEN":
                        functionCall = new Rule_STRLEN(pContext, T);
                        break;
                    case "GETCOORDINATES":
                        functionCall = new Rule_GetCoordinates(pContext, T);
                        break;
                    case "SENDSMS":
                        functionCall = new Rule_SendSMS(pContext, T);
                        break;
                    default:
                        throw new Exception("Function name " + functionName.ToUpperInvariant() + " is not a recognized function.");
                }
            }

        }
示例#11
0
 public Rule_Substring(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //SUBSTRING(fullString,startingIndex,length)
     this.ParameterList = EnterRule.GetFunctionParameters(pContext, pToken);
 }