public Rule_CoxPH(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*
             * <Simple_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' DecLiteral ')' <CoxOptList>
             * <Boolean_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' Boolean ')' <CoxOptList>*/

            //!COXPH <time variable>= <covariate(s)>[: <time function>:]  *  <censor variable> (<value>) [TIMEUNIT="<time unit>"] [OUTTABLE=<tablename>] [GRAPHTYPE="<graph type>"] [WEIGHTVAR=<weight variable>] [STRATAVAR=<strata variable(s)>] [GRAPH=<graph variable(s)>]

            string[] saCensorArray;

            this.commandText   = this.ExtractTokens(pToken.Tokens);
            this.time_variable = this.GetCommandElement(pToken.Tokens, 1).Trim(new char[] { '[', ']' });

            saCensorArray        = GetUncensoredVarVal(this.GetCommandElement(pToken.Tokens, 5));
            this.censor_variable = saCensorArray[0].Trim(new char[] { '[', ']' });
            this.censor_value    = saCensorArray[1].Trim(new char[] { '[', ']' });

            this.SetTermList((NonterminalToken)pToken.Tokens[3]);

            if (pToken.Tokens.Length > 6)
            {
                this.SetOptionList((NonterminalToken)pToken.Tokens[6]);
            }
        }
예제 #2
0
        public Rule_CoxPH(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*
            <Simple_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' DecLiteral ')' <CoxOptList>
            <Boolean_Cox_Statement> ::= COXPH Identifier '=' <CoxTermList> '*' Identifier '(' Boolean ')' <CoxOptList>*/

            //!COXPH <time variable>= <covariate(s)>[: <time function>:]  *  <censor variable> (<value>) [TIMEUNIT="<time unit>"] [OUTTABLE=<tablename>] [GRAPHTYPE="<graph type>"] [WEIGHTVAR=<weight variable>] [STRATAVAR=<strata variable(s)>] [GRAPH=<graph variable(s)>]

            string[] saCensorArray;

            this.commandText = this.ExtractTokens(pToken.Tokens);
            this.time_variable = this.GetCommandElement(pToken.Tokens, 1).Trim(new char[] {'[',']'});

            saCensorArray = GetUncensoredVarVal(this.GetCommandElement(pToken.Tokens, 5));
            this.censor_variable = saCensorArray[0].Trim(new char[] { '[', ']' });
            this.censor_value = saCensorArray[1].Trim(new char[] { '[', ']' });

            this.SetTermList((NonterminalToken) pToken.Tokens[3]);

            if (pToken.Tokens.Length > 6)
            {
                this.SetOptionList((NonterminalToken)pToken.Tokens[6]);
            }
        }
        public Rule_Assign(Rule_Context pContext, NonterminalToken pTokens) : base(pContext)
        {
            //ASSIGN <Qualified ID> '=' <Expression>
            //<Let_Statement> ::= LET Identifier '=' <Expression>
            //<Simple_Assign_Statement> ::= Identifier '=' <Expression>

            switch (pTokens.Rule.Lhs.ToString())
            {
            case "<Assign_Statement>":
                //NonterminalToken T = (NonterminalToken)pTokens.Tokens[1];
                //this.QualifiedId = T.Tokens[0].ToString();
                this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);

                break;

            case "<Let_Statement>":
                //this.QualifiedId = pTokens.Tokens[1].ToString();
                this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);
                break;

            case "<Simple_Assign_Statement>":
                //Identifier '=' <Expression>
                //T = (NonterminalToken)pTokens.Tokens[1];
                //this.QualifiedId = this.GetCommandElement(pTokens.Tokens, 0);
                this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[0]);
                //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[2]);
                this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[2]);
                break;
            }
        }
예제 #4
0
        public Rule_IsUnique(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            if (pToken.Tokens.Length >= 1)
            {
                int    max          = pToken.Tokens.GetUpperBound(0);
                string tokensInTree = "";
                for (int i = pToken.Tokens.GetLowerBound(0); i <= max; i++)
                {
                    if (pToken.Tokens[i] is NonterminalToken)
                    {
                        tokensInTree += ExtractTokens(((NonterminalToken)pToken.Tokens[i]).Tokens).Trim();
                    }
                    else
                    {
                        tokensInTree += pToken.Tokens[i].ToString();
                    }
                }
                this.IdentifierList = tokensInTree.Split(',');
                //if (pContext.IsVariableValidationEnable)
                //{
                //    if (IdentifierList.Length > 0)
                //    {
                //        foreach (var item in IdentifierList)
                //        {

                //            if (!string.IsNullOrEmpty(item) && !this.Context.CommandVariableCheck.ContainsKey(item.ToLowerInvariant()))
                //            {
                //                this.Context.CommandVariableCheck.Add(item.ToLowerInvariant(), "isunique");
                //            }
                //        }
                //    }
                //}
            }
        }
예제 #5
0
        public Rule_Report(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Report_Display_Statement>   ::= REPORT File DISPLAY
            // <Report_File_Statement>      ::= REPORT File TO File
            // <Report_Print_Statement>     ::= REPORT File String

            epiReportExecutablePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            epiReportExecutablePath = Path.Combine(epiReportExecutablePath, "EpiReport.exe");

            templatePath = this.GetCommandElement(pToken.Tokens, 1);
            option = this.GetCommandElement(pToken.Tokens, 2);
            selectedPrinter = String.Empty;

            if (option.ToUpper() == CommandNames.TO.ToUpper())
            {
                reportHtmlPath = this.GetCommandElement(pToken.Tokens, 3);
            }
            else if (option.ToUpper() != CommandNames.DISPLAY.ToUpper())
            {
                selectedPrinter = this.GetCommandElement(pToken.Tokens, 2);
                option = "PRINT";
            }

            string commandLineArguments = string.Format(" /template:\"{0}\"", templatePath);
            commandlineString = epiReportExecutablePath + " " + commandLineArguments;
        }
예제 #6
0
 public Rule_Define_Group(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Define_Group_Statement> ::= DEFINE Identifier GROUPVAR <IdentifierList>
     this.Identifier = this.GetCommandElement(pToken.Tokens, 1);
     this.IdentifierList.AddRange(this.GetCommandElement(pToken.Tokens, 3).Split(' '));
 }
예제 #7
0
        public Rule_If_Then_Else_End(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*

            <If_Statement>                  ::=   IF <Expression> THEN  <Statements>  END-IF
                                                | IF <Expression> THEN  <Statements>  END
            <If_Else_Statement>              ::=  IF <Expression> THEN  <Statements> <Else_If_Statement>  END-IF
                                                | IF <Expression> THEN  <Statements>  <Else_If_Statement>  END
                                                    IF <Expression> THEN <Statements> ELSE  <Statements>  END-IF
                                                | IF <Expression> THEN <Statements> ELSE  <Statements>  END
             */

            IfClause = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            ThenClause = EnterRule.BuildStatments(pContext, pToken.Tokens[3]);
            if (this.GetCommandElement(pToken.Tokens, 4).Equals("Else", StringComparison.OrdinalIgnoreCase))
            {
                ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[5]);
            }
                /*
            else
            {
                ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[4]);
            }*/
        }
예제 #8
0
        public Rule_CompareExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            // <Concat Exp> LIKE String
            // <Concat Exp> '=' <Compare Exp>
            // <Concat Exp> '<>' <Compare Exp>
            // <Concat Exp> '>' <Compare Exp>
            // <Concat Exp> '>=' <Compare Exp>
            // <Concat Exp> '<' <Compare Exp>
            // <Concat Exp> '<=' <Compare Exp>
            // <Concat Exp>

            this.ConcatExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                op = pToken.Tokens[1].ToString().ToLower();

                if (pToken.Tokens[1].ToString() == "LIKE")
                {
                    this.STRING     = pToken.Tokens[2].ToString();
                    this.CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
                }
                else
                {
                    this.CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
                }
            }
        }
        /// <summary>
        /// Constructor for Rule_FunctionParameterList
        /// </summary>
        /// <param name="pToken">The token to build the reduction with.</param>
        public Rule_FunctionParameterList(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            //<FunctionParameterList> ::= <EmptyFunctionParameterList>
            //<FunctionParameterList> ::= <NonEmptyFunctionParameterList>

            NonterminalToken T = (NonterminalToken)pToken.Tokens[0];

            switch (T.Rule.Lhs.ToString())
            {
                case "<NonEmptyFunctionParameterList>":
                    this.paramList = new Stack<EnterRule>();

                    //this.paramList.Push(new Rule_NonEmptyFunctionParameterList(T, this.paramList));
                    new Rule_NonEmptyFunctionParameterList(pContext, T, this.paramList);
                    break;
                case "<SingleFunctionParameterList>":
                    this.paramList = new Stack<EnterRule>();
                    new Rule_SingleFunctionParameterList(pContext, T, this.paramList);
                    break;
                case "<EmptyFunctionParameterList>":
                    //this.paramList = new Rule_EmptyFunctionParameterList(T);
                    // do nothing the parameterlist is empty
                    break;
                case "<MultipleFunctionParameterList>":
                    this.paramList = new Stack<EnterRule>();
                    //this.MultipleParameterList = new Rule_MultipleFunctionParameterList(pToken);
                    new Rule_MultipleFunctionParameterList(pContext, T, this.paramList);
                    break;
            }
        }
 public Rule_Geocode(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     // Geocode address_field_name, latitude_field_name, longitude_field_name
     //<Geocode_Statement> ::= Geocode Identifier ',' Identifier ',' Identifier
     this.address_field_name   = this.GetCommandElement(pToken.Tokens, 1);
     this.latitude_field_name  = this.GetCommandElement(pToken.Tokens, 3);
     this.longitude_field_name = this.GetCommandElement(pToken.Tokens, 5);
     if (pContext.IsVariableValidationEnable)
     {
         if (!string.IsNullOrEmpty(address_field_name))
         {
             if (!this.Context.CommandVariableCheck.ContainsKey(address_field_name.ToLowerInvariant()))
             {
                 this.Context.CommandVariableCheck.Add(address_field_name, "Geocode");
             }
         }
         if (!string.IsNullOrEmpty(latitude_field_name))
         {
             if (!this.Context.CommandVariableCheck.ContainsKey(latitude_field_name.ToLowerInvariant()))
             {
                 this.Context.CommandVariableCheck.Add(latitude_field_name, "Geocode");
             }
         }
         if (!string.IsNullOrEmpty(longitude_field_name))
         {
             if (!this.Context.CommandVariableCheck.ContainsKey(longitude_field_name.ToLowerInvariant()))
             {
                 this.Context.CommandVariableCheck.Add(longitude_field_name, "Geocode");
             }
         }
     }
 }
        public Rule_NonEmptyFunctionParameterList(Rule_Context pContext, NonterminalToken pToken, Stack<EnterRule> pList) : base(pContext)
        {
            //<NonEmptyFunctionParameterList> ::= <MultipleFunctionParameterList>
            //<NonEmptyFunctionParameterList> ::= <SingleFunctionParameterList>
            NonterminalToken T = (NonterminalToken) pToken.Tokens[0];

            switch (T.Rule.Lhs.ToString())
            {
                case "<MultipleFunctionParameterList>":
                    new Rule_MultipleFunctionParameterList(pContext, T, pList);

                    break;
                case "<SingleFunctionParameterList>":
                    new Rule_SingleFunctionParameterList(pContext, T, pList);
                    break;
                default:

                    break;
            }

            if (pToken.Tokens.Length > 2)
            {
                Rule_Expression Expression = new Rule_Expression(pContext, (NonterminalToken)pToken.Tokens[2]);
                pList.Push(Expression);
            }
        }
예제 #12
0
 /// <summary>
 /// Gets a count of records in a column
 /// </summary>
 /// <param name="columnName">Name of the column</param>
 /// <returns>Number of records in a column</returns>
 public int GetRecordCount(Rule_Context pContext, string columnName)
 {
     #region Input Validation
     if (string.IsNullOrEmpty(columnName))
     {
         throw new ArgumentNullException("columnName");
     }
     #endregion Input Validation
     WordBuilder queryBuilder = new WordBuilder();
     queryBuilder.Append("select count" + Util.InsertInParantheses(columnName));
     queryBuilder.Append(GetSqlStatementPartFrom(pContext));
     if (Db.ColumnExists(PrimaryTable.TableName, ColumnNames.REC_STATUS))
     {
         string whereStatement = GetSqlStatementPartWhere();
         queryBuilder.Append(whereStatement);
     }
     else if (!string.IsNullOrEmpty(selectCriteria))
     {
         string whereClause = " where " + this.selectCriteria;
         queryBuilder.Append(whereClause);
     }
     Query query = Db.CreateQuery(queryBuilder.ToString());
     //recast to int before return to remove cast run time error
     int result = Int32.Parse((Db.ExecuteScalar(query)).ToString());
     return(result);
 }
예제 #13
0
 public Rule_Printout(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
 {
     if (pToken.Tokens.Length > 1)
     {
         file = this.GetCommandElement(pToken.Tokens, 1);
     }
 }
예제 #14
0
        public Rule_Statements(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Statements> ::= <Statements> <Statement> | <Statement>

               if (pToken.Tokens.Length > 1)
               {
               //NonterminalToken T;
               //T = (NonterminalToken)pToken.Tokens[0];
               //this.statements = new Rule_Statements(pContext, T);
               statements = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]);

               //T = ((NonterminalToken)pToken.Tokens[1]);
               //this.statement = new Rule_Statement(pContext, T);
               statement = AnalysisRule.BuildStatments(pContext, pToken.Tokens[1]);

               }
               else
               {
               //NonterminalToken T;
               //T = (NonterminalToken)pToken.Tokens[0];
               //this.statement = new Rule_Statement(pContext, T);
               statement = AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]);
               }
        }
        public Rule_Field_Checkcode_Statement(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Field_Checkcode_Statement> ::=  Field Identifier <Begin_Before_statement> <Begin_After_statement> <Begin_Click_statement>  End

            this.TextField = this.ExtractTokensWithFormat(pToken.Tokens);

            this.Identifier = this.GetCommandElement(pToken.Tokens, 1).Trim(new char[] { '[', ']' });
            for (int i = 2; i < pToken.Tokens.Length; i++)
            {
                if (pToken.Tokens[i] is NonterminalToken)
                {
                    NonterminalToken T = (NonterminalToken)pToken.Tokens[i];
                    switch (T.Symbol.ToString())
                    {
                    case "<Begin_Before_statement>":
                        this.BeginBefore = EnterRule.BuildStatments(pContext, T);
                        break;

                    case "<Begin_After_statement>":
                        this.BeginAfter = EnterRule.BuildStatments(pContext, T);
                        break;

                    case "<Begin_Click_statement>":
                        this.BeginClick = EnterRule.BuildStatments(pContext, T);
                        break;
                    }
                }
            }
        }
예제 #16
0
        public Rule_Report(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            // <Report_Display_Statement>   ::= REPORT File DISPLAY
            // <Report_File_Statement>      ::= REPORT File TO File
            // <Report_Print_Statement>     ::= REPORT File String

            epiReportExecutablePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            epiReportExecutablePath = Path.Combine(epiReportExecutablePath, "EpiReport.exe");

            templatePath    = this.GetCommandElement(pToken.Tokens, 1);
            option          = this.GetCommandElement(pToken.Tokens, 2);
            selectedPrinter = String.Empty;

            if (option.ToUpperInvariant() == CommandNames.TO.ToUpperInvariant())
            {
                reportHtmlPath = this.GetCommandElement(pToken.Tokens, 3);
            }
            else if (option.ToUpperInvariant() != CommandNames.DISPLAY.ToUpperInvariant())
            {
                selectedPrinter = this.GetCommandElement(pToken.Tokens, 2);
                option          = "PRINT";
            }

            string commandLineArguments = string.Format(" /template:\"{0}\"", templatePath);

            commandlineString = epiReportExecutablePath + " " + commandLineArguments;
        }
예제 #17
0
        public static bool AssignValue(Rule_Context pContext, string varName, object value)
        {
            EpiInfo.Plugin.IVariable var;
            string dataValue = string.Empty;
            var = pContext.CurrentScope.Resolve(varName);

            if (var != null)
            {
                if (var.VariableScope ==  EpiInfo.Plugin.VariableScope.DataSource)
                {
                    //var.Expression = value.ToString();
                    pContext.EnterCheckCodeInterface.Assign(varName, value);
                }
                else
                {
                    if (value != null)
                    {
                        var.Expression = value.ToString();
                    }
                    else
                    {
                        var.Expression = "Null";
                    }
                }
            }
            else
            {
                if (value != null)
                {
                    pContext.EnterCheckCodeInterface.Assign(varName, value);
                }
            }

            return false;
        }
예제 #18
0
        public Rule_Highlight(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<IdentifierList> ::= <IdentifierList> Identifier | Identifier

            if (pToken.Tokens.Length > 2)
            {
                //<Hide_Except_Statement> ::= HIDE '*' EXCEPT <IdentifierList>
                this.IsExceptList   = true;
                this.IdentifierList = this.GetCommandElement(pToken.Tokens, 3).ToString().Split(' ');
            }
            else
            {
                //<Hide_Some_Statement> ::= HIDE <IdentifierList>
                this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).ToString().Split(' ');
            }
            if (pContext.IsVariableValidationEnable)
            {
                if (IdentifierList.Length > 0)
                {
                    foreach (var item in IdentifierList)
                    {
                        if (!string.IsNullOrEmpty(item) && !this.Context.CommandVariableCheck.ContainsKey(item.ToLowerInvariant()))
                        {
                            this.Context.CommandVariableCheck.Add(item, "highlight");
                        }
                    }
                }
            }
        }
예제 #19
0
 public Rule_CheckCodeBlock(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     /* <CheckCodeBlock> ::=   <DefineVariables_Statement>
                         | <View_Checkcode_Statement>
                         | <Record_Checkcode_Statement>
             | <Page_Checkcode_Statement>
             | <Field_Checkcode_Statement>
             | <Subroutine_Statement>  */
     switch (pToken.Rule.Rhs[0].ToString())
     {
         case "<DefineVariables_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<View_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Record_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Page_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Field_Checkcode_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
         case "<Subroutine_Statement>":
             this.CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
             break;
     }
 }
예제 #20
0
        public Rule_CompareExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Concat Exp> LIKE String
            // <Concat Exp> '=' <Compare Exp>
            // <Concat Exp> '<>' <Compare Exp>
            // <Concat Exp> '>' <Compare Exp>
            // <Concat Exp> '>=' <Compare Exp>
            // <Concat Exp> '<' <Compare Exp>
            // <Concat Exp> '<=' <Compare Exp>
            // <Concat Exp>

            //this.ConcatExp = new Rule_ConcatExp(pContext, (NonterminalToken)pToken.Tokens[0]);
            this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]));
            if (pToken.Tokens.Length > 1)
            {
                op = pToken.Tokens[1].ToString();

                if (pToken.Tokens[1].ToString().Equals("LIKE", StringComparison.OrdinalIgnoreCase))
                {
                    this.STRING = pToken.Tokens[2].ToString().Trim(new char[] {'"'});
                }
                else
                {
                    //this.CompareExp = new Rule_CompareExp(pContext, (NonterminalToken)pToken.Tokens[2]);
                    this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]));
                }
            }
        }
예제 #21
0
        public Rule_If_Then_Else_End(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            /*
             *
             * <If_Statement>                  ::=   IF <Expression> THEN  <Statements>  END-IF
             | IF <Expression> THEN  <Statements>  END
             | <If_Else_Statement>              ::=  IF <Expression> THEN  <Statements> <Else_If_Statement>  END-IF
             | IF <Expression> THEN  <Statements>  <Else_If_Statement>  END
             |                                      IF <Expression> THEN <Statements> ELSE  <Statements>  END-IF
             | IF <Expression> THEN <Statements> ELSE  <Statements>  END
             */

            IfClause   = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            ThenClause = EnterRule.BuildStatments(pContext, pToken.Tokens[3]);
            if (this.GetCommandElement(pToken.Tokens, 4).Equals("Else", StringComparison.OrdinalIgnoreCase))
            {
                ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[5]);
            }

            /*
             * else
             * {
             * ElseClause = EnterRule.BuildStatments(pContext, pToken.Tokens[4]);
             * }*/
        }
        public Rule_CompareExp(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            // <Concat Exp> LIKE String
            // <Concat Exp> '=' <Compare Exp>
            // <Concat Exp> '<>' <Compare Exp>
            // <Concat Exp> '>' <Compare Exp>
            // <Concat Exp> '>=' <Compare Exp>
            // <Concat Exp> '<' <Compare Exp>
            // <Concat Exp> '<=' <Compare Exp>
            // <Concat Exp>

            this.ConcatExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                op = pToken.Tokens[1].ToString();

                if (pToken.Tokens[1].ToString().Equals("LIKE", StringComparison.OrdinalIgnoreCase))
                {
                    this.STRING = pToken.Tokens[2].ToString().Trim(new char[] { '"' });
                }
                else
                {
                    this.CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
                }
            }
        }
예제 #23
0
        public Rule_Assign(Rule_Context pContext, NonterminalToken pTokens)
            : base(pContext)
        {
            //ASSIGN <Qualified ID> '=' <Expression>
            //<Let_Statement> ::= LET Identifier '=' <Expression>
            //<Simple_Assign_Statement> ::= Identifier '=' <Expression>

            switch(pTokens.Rule.Lhs.ToString())
            {

                case "<Assign_Statement>":
                    //NonterminalToken T = (NonterminalToken)pTokens.Tokens[1];
                    //this.QualifiedId = T.Tokens[0].ToString();
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);

                    break;
                case "<Let_Statement>":
                    //this.QualifiedId = pTokens.Tokens[1].ToString();
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[1]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[3]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[3]);
                    break;
                case "<Simple_Assign_Statement>":
                    //Identifier '=' <Expression>
                    //T = (NonterminalToken)pTokens.Tokens[1];
                    //this.QualifiedId = this.GetCommandElement(pTokens.Tokens, 0);
                    this.QualifiedId = this.SetQualifiedId(pTokens.Tokens[0]);
                    //this.value = new Rule_Expression(pContext, (NonterminalToken)pTokens.Tokens[2]);
                    this.value = AnalysisRule.BuildStatments(pContext, pTokens.Tokens[2]);
                    break;
            }
        }
 public Rule_Recode_B(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //this.value1 = this.CreateNegateRecode(pToken.Tokens[0]);
     this.value1     = this.GetCommandElement(pToken.Tokens, 0).Replace("\"", "");
     this.equalValue = this.GetCommandElement(pToken.Tokens, 2).Replace("\"", "");
 }
예제 #25
0
 public Rule_Define_Group(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Define_Group_Statement> ::= DEFINE Identifier GROUPVAR <IdentifierList>
     this.Identifier = this.GetCommandElement(pToken.Tokens, 1);
     this.IdentifierList.AddRange(this.GetCommandElement(pToken.Tokens, 3).Split(' '));
 }
예제 #26
0
        public Rule_AutoSearch(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*<Auto_Search_Statement> ::= AUTOSEARCH <IdentifierList>
             |AUTOSEARCH <IdentifierList> Always
             |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList>
             |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList> Always*/


            this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).Split(' ');
            if (pToken.Tokens.Length > 2)
            {
                if (pToken.Tokens[2].ToString().Equals("Always", StringComparison.OrdinalIgnoreCase))
                {
                    this.AlwaysShow = true;
                }
                else
                {
                    this.DisplayList = this.GetCommandElement(pToken.Tokens, 2).Split(' ');
                }
            }


            if (pToken.Tokens.Length == 5)
            {
                this.AlwaysShow = true;
            }
        }
 public Rule_Recode_M(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //this.value1 = this.GetCommandElement(pToken.Tokens, 0);
     //this.value2 = this.GetCommandElement(pToken.Tokens, 2);
     this.equalValue = this.GetCommandElement(pToken.Tokens, 4).Replace("\"", "");
 }
        public Rule_Autosearch_Function(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*<Auto_Search_Statement> ::= AUTOSEARCH <IdentifierList>
                                          |AUTOSEARCH <IdentifierList> Always
                                          |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList>
                                          |AUTOSEARCH <IdentifierList> DisplayList <IdentifierList> Always*/

            this.IdentifierList = this.GetCommandElement(pToken.Tokens, 1).Split(' ');
            if (pToken.Tokens.Length > 2)
            {

                if (pToken.Tokens[2].ToString().Equals("Always",StringComparison.OrdinalIgnoreCase))
                {
                    this.AlwaysShow = true;
                }
                else
                {
                    this.DisplayList = this.GetCommandElement(pToken.Tokens, 3).Split(' ');
                }
            }

            if (pToken.Tokens.Length == 5)
            {
                this.AlwaysShow = true;
            }
        }
예제 #29
0
 public Rule_Dialog_Date_Statement(Rule_Context pContext, NonterminalToken token)
     : base(pContext, token)
 {
     //<Dialog_Date_Statement> ::= DIALOG String Identifier DATEFORMAT <TitleOpt>
     Prompt    = this.GetCommandElement(token.Tokens, 1);
     TitleText = this.GetCommandElement(token.Tokens, 4);
 }
예제 #30
0
        /// <summary>
        /// Get Data of a single column and all strata
        /// </summary>
        /// <remarks>
        /// If the variable is a defined variable, use the expression
        /// </remarks>
        /// <param name="var"></param>
        /// <param name="strata"></param>
        /// <returns></returns>
        public DataTable GetData(Rule_Context pContext, IVariable var, string[] strata)
        {
            #region Preconditions
            if (strata == null)
            {
                return(GetData(pContext, var));
            }
            #endregion

            StringBuilder sql = new StringBuilder("select ");
            if (var.VarType == VariableType.DataSource)
            {
                sql.Append("[").Append(var.Name).Append("]");
            }
            else
            {
                sql.Append(var.Expression);
            }
            if (strata.GetLength(0) > 0)
            {
                int count = strata.GetLength(0);
                for (int i = 0; i < count; i++)
                {
                    sql.Append(", [").Append(strata[i].ToString()).Append("]");
                }
            }
            sql.Append(this.GetSqlStatementPartFrom(pContext));
            sql.Append(this.GetSqlStatementPartWhere());
            sql.Append(this.GetSqlStatementPartSortBy());
            Query query = Db.CreateQuery(sql.ToString());
            return(Db.Select(query));
        }
        public Rule_Define(Rule_Context pContext, NonterminalToken pToken) : base(pContext)
        {
            //DEFINE Identifier <Variable_Scope> <VariableTypeIndicator> <Define_Prompt>
            //DEFINE Identifier '=' <Expression>

            Identifier = GetCommandElement(pToken.Tokens, 1);
            if (pContext.IsVariableValidationEnable)
            {
                if (!string.IsNullOrEmpty(Identifier))
                {
                    if (!this.Context.CommandVariableCheck.ContainsKey(Identifier.ToLowerInvariant()))
                    {
                        this.Context.CommandVariableCheck.Add(Identifier, "define");
                    }
                }
            }
            if (GetCommandElement(pToken.Tokens, 2) == "=")
            {
                this.Expression = EnterRule.BuildStatments(pContext, pToken.Tokens[3]);
                // set some defaults
                Variable_Scope        = "STANDARD";
                VariableTypeIndicator = "";
                Define_Prompt         = "";
            }
            else
            {
                Variable_Scope = GetCommandElement(pToken.Tokens, 2);//STANDARD | GLOBAL | PERMANENT |!NULL

                VariableTypeIndicator = GetCommandElement(pToken.Tokens, 3);
                Define_Prompt         = GetCommandElement(pToken.Tokens, 4);
            }
        }
예제 #32
0
        /// <summary>
        /// Method for Select/If commands
        /// </summary>
        /// <param name="command">Enum for SelectIfCommands</param>
        private void DesignSelectIfCommand(SelectIfCommands command)
        {
            try
            {
                Rule_Context Context = this.mainForm.EpiInterpreter.Context;
                switch (command)
                {
                case SelectIfCommands.CancelSelect:
                    //Fix defect 225
                    if (Context.CurrentRead != null)
                    {
                        DesignAndProcessCommand(new CancelSelect(mainForm));
                    }
                    else
                    {
                        DisplayNoDataSourceMessage();
                    }
                    break;

                case SelectIfCommands.CancelSort:
                    DesignAndProcessCommand(new CancelSort(mainForm));
                    break;

                case SelectIfCommands.If:
                    //dpb DisplayFeatureNotImplementedMessage();
                    DesignAndProcessCommand(new IfDialog(mainForm));
                    break;

                case SelectIfCommands.Select:
                    if (Context.CurrentRead != null)
                    {
                        DesignAndProcessCommand(new SelectDialog(mainForm));
                    }
                    else
                    {
                        DisplayNoDataSourceMessage();
                    }
                    break;

                case SelectIfCommands.Sort:
                    if (Context.CurrentRead != null)
                    {
                        DesignAndProcessCommand(new SortDialog(mainForm));
                    }
                    else
                    {
                        DisplayNoDataSourceMessage();
                    }
                    break;

                default:
                    break;
                } //switch
            }     //try
            finally
            {
                //programEditor.SavePGM(Files.LastPgm);
            }//finally
        }
예제 #33
0
        public static string RenderHtml(Rule_Context pContext, string commandName, string fileName, string tableName, int rowCount)
        {
            StringBuilder sb = new StringBuilder();

            Epi.DataSets.Config.SettingsRow settings = Configuration.GetNewInstance().Settings;
            sb.Append(HTML.Italics(SharedStrings.CURRENT_VIEW + ":&nbsp;"));
            sb.Append(HTML.Bold(String.Format("{0}:{1}", fileName.Trim(new char[] { '\'' }), tableName)));
            if (pContext.CurrentRead.RelatedTables != null)
            {
                foreach (string table in pContext.CurrentRead.RelatedTables)
                {
                    sb.Append(HTML.Tag("br"));
                    sb.Append(HTML.Italics("&nbsp&nbsp&nbsp&nbspRelate:&nbsp;"));
                    sb.Append(HTML.Bold(table));
                }
            }
            if (pContext.DataInfo.SelectCriteria != String.Empty)
            {
                sb.Append(HTML.Tag("br"));
                sb.Append(HTML.Italics("Selection:&nbsp;&nbsp;"));
                sb.Append("&nbsp;");
                sb.Append(HTML.Bold(EpiExpression(pContext, pContext.DataInfo.SelectCriteria)));
            }
            if (pContext.DataInfo.GetSqlStatementPartSortBy() != String.Empty)
            {
                sb.Append(HTML.Tag("br"));
                sb.Append(HTML.Italics("Sort By:&nbsp;&nbsp;"));
                sb.Append(HTML.Bold(EpiExpression(pContext, pContext.DataInfo.GetSqlStatementPartSortBy())));
            }
            sb.Append(HTML.Tag("br"));
            sb.Append(HTML.Italics(SharedStrings.RECORD_COUNT + ":&nbsp;&nbsp;"));
            sb.Append(HTML.Bold(rowCount.ToString()));
            string scope = string.Empty;

            switch (settings.RecordProcessingScope)
            {
            case 1:
                scope = SharedStrings.DELETED_RECORDS_EXCLUDED;
                break;

            case 2:
                scope = SharedStrings.DELETED_RECORDS_ONLY;
                break;

            default:
                scope = SharedStrings.DELETED_RECORDS_INCLUDED;
                break;
            }
            sb.Append("&nbsp;");
            sb.Append(HTML.Italics("(" + scope + ")&nbsp;&nbsp;&nbsp;"));
            sb.Append(HTML.Italics("Date:"));
            sb.Append("&nbsp;&nbsp;");
            sb.Append(HTML.Bold(DateTime.Now.ToString()));
            sb.Append(HTML.Tag("br"));
            sb.Append(HTML.Tag("br"));


            return(sb.ToString());
        }
예제 #34
0
        //<Dialog_Write_Filter_Statement> ::= DIALOG String Identifier WRITE String <TitleOpt>

        public Rule_Dialog_Write_Filter_Statement(Rule_Context pContext, NonterminalToken token)
            : base(pContext, token)
        {
            Filter     = this.GetCommandElement(token.Tokens, 1);
            Identifier = this.GetCommandElement(token.Tokens, 2);
            Modifier   = this.GetCommandElement(token.Tokens, 3);
            TitleText  = this.GetCommandElement(token.Tokens, 5);
        }
예제 #35
0
 public Rule_YN_Dialog_Statement(Rule_Context pContext, NonterminalToken token)
     : base(pContext, token)
 {
     //<YN_Dialog_Statement>	::= DIALOG String Identifier YN <TitleOpt>
     this.Prompt     = this.GetCommandElement(token.Tokens, 1);
     this.Identifier = this.GetCommandElement(token.Tokens, 2);
     this.TitleText  = this.GetCommandElement(token.Tokens, 4);
 }
예제 #36
0
        //<Multiple_Choice_Dialog_Statement> ::= DIALOG String Identifier <StringList> <TitleOpt>

        public Rule_Multiple_Choice_Dialog_Statement(Rule_Context pContext, NonterminalToken token)
            : base(pContext, token)
        {
            this.Prompt     = this.GetCommandElement(token.Tokens, 1);
            this.Identifier = this.GetCommandElement(token.Tokens, 2);
            this.StringList = this.GetCommandElement(token.Tokens, 3);
            this.TitleText  = this.GetCommandElement(token.Tokens, 4);
        }
예제 #37
0
 public Rule_Printout(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     if (pToken.Tokens.Length > 1)
     {
         file = this.GetCommandElement(pToken.Tokens, 1);
     }
 }
예제 #38
0
 public Rule_Numeric_Dialog_Implicit_Statement(Rule_Context pContext, NonterminalToken token)
     : base(pContext, token)
 {
     //<Numeric_Dialog_Implicit_Statement> ::= DIALOG String Identifier <TitleOpt>
     Prompt     = this.GetCommandElement(token.Tokens, 1);
     Identifier = this.GetCommandElement(token.Tokens, 2);
     TitleText  = this.GetCommandElement(token.Tokens, 3);
 }
        public Rule_Recode_D(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            NonterminalToken T = (NonterminalToken)pToken.Tokens[0];

            //this.value2 = this.CreateNegateRecode(T.Tokens[2]);
            this.value2     = this.GetCommandElement(T.Tokens, 2);
            this.equalValue = this.GetCommandElement(pToken.Tokens, 4).Replace("\"", "");
        }
예제 #40
0
 public Rule_Geocode(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     // Geocode address_field_name, latitude_field_name, longitude_field_name
     //<Geocode_Statement> ::= Geocode Identifier ',' Identifier ',' Identifier
     this.address_field_name = this.GetCommandElement(pToken.Tokens, 1);
     this.latitude_field_name = this.GetCommandElement(pToken.Tokens, 3);
     this.longitude_field_name = this.GetCommandElement(pToken.Tokens, 5);
 }
예제 #41
0
 public Rule_Program(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Program> ::= <CheckCodeBlocks> | !Eof
     if (pToken.Tokens.Length > 0)
     {
         CheckCodeBlocks = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
 }
예제 #42
0
 public Rule_Db_Variables_Dialog_Statement(Rule_Context pContext, NonterminalToken token)
     : base(pContext, token)
 {
     //<Db_Variables_Dialog_Statement> ::= DIALOG String Identifier DBVARIABLES <TitleOpt>
     Prompt     = GetElement(token, 1);
     Identifier = GetElement(token, 2);
     Modifier   = GetElement(token, 3);
     TitleText  = GetElement(token, 4);
 }
예제 #43
0
 public Rule_Geocode(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     // Geocode address_field_name, latitude_field_name, longitude_field_name
     //<Geocode_Statement> ::= Geocode Identifier ',' Identifier ',' Identifier
     this.address_field_name   = this.GetCommandElement(pToken.Tokens, 1);
     this.latitude_field_name  = this.GetCommandElement(pToken.Tokens, 3);
     this.longitude_field_name = this.GetCommandElement(pToken.Tokens, 5);
 }
예제 #44
0
        public Rule_Help(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Help_Statement> ::= HELP file String
            // file = filepath
            // String = Anchor

            this.FileName = this.GetCommandElement(pToken.Tokens,1);
            this.AnchorString = this.GetCommandElement(pToken.Tokens, 2);
        }
 public Rule_Subroutine_Statement(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Subroutine_Statement> ::= Sub Identifier <Statements> End | Sub Identifier End
     this.Identifier = this.GetCommandElement(pToken.Tokens, 1);
     if (pToken.Tokens.Length > 3)
     {
         this.Statements = AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]);
     }
 }
예제 #46
0
        public static string RenderHtml(Rule_Context pContext, string commandName, string fileName, string tableName, int rowCount)
        {
            StringBuilder sb = new StringBuilder();
            Epi.DataSets.Config.SettingsRow settings = Configuration.GetNewInstance().Settings;
            sb.Append(HTML.Italics(SharedStrings.CURRENT_VIEW + ":&nbsp;"));
            sb.Append(HTML.Bold(String.Format("{0}:{1}", fileName.Trim(new char[] { '\'' }), tableName)));
            if (pContext.CurrentRead.RelatedTables != null)
            {
                foreach (string table in pContext.CurrentRead.RelatedTables)
                {
                    sb.Append(HTML.Tag("br"));
                    sb.Append(HTML.Italics("&nbsp&nbsp&nbsp&nbspRelate:&nbsp;"));
                    sb.Append(HTML.Bold(table));
                }
            }
            if (pContext.DataInfo.SelectCriteria != String.Empty)
            {
                sb.Append(HTML.Tag("br"));
                sb.Append(HTML.Italics("Selection:&nbsp;&nbsp;"));
                sb.Append("&nbsp;");
                sb.Append(HTML.Bold(EpiExpression(pContext, pContext.DataInfo.SelectCriteria)));
            }
            if (pContext.DataInfo.GetSqlStatementPartSortBy() != String.Empty)
            {
                sb.Append(HTML.Tag("br"));
                sb.Append(HTML.Italics("Sort By:&nbsp;&nbsp;"));
                sb.Append(HTML.Bold(EpiExpression(pContext, pContext.DataInfo.GetSqlStatementPartSortBy())));
            }
            sb.Append(HTML.Tag("br"));
            sb.Append(HTML.Italics(SharedStrings.RECORD_COUNT + ":&nbsp;&nbsp;"));
            sb.Append(HTML.Bold(rowCount.ToString()));
            string scope = string.Empty;
            switch (settings.RecordProcessingScope)
            {
                case 1:
                    scope = SharedStrings.DELETED_RECORDS_EXCLUDED;
                    break;
                case 2:
                    scope = SharedStrings.DELETED_RECORDS_ONLY;
                    break;
                default:
                    scope = SharedStrings.DELETED_RECORDS_INCLUDED;
                    break;
            }
            sb.Append("&nbsp;");
            sb.Append(HTML.Italics("(" + scope + ")&nbsp;&nbsp;&nbsp;"));
            sb.Append(HTML.Italics("Date:"));
            sb.Append("&nbsp;&nbsp;");
            sb.Append(HTML.Bold(DateTime.Now.ToString()));
            sb.Append(HTML.Tag("br"));
            sb.Append(HTML.Tag("br"));

            return sb.ToString();
        }
예제 #47
0
 public Rule_Delete_File(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext, pToken)
 {
     string trimChars = "'";
     filePath = GetCommandElement(pToken.Tokens, 1).Trim(trimChars.ToCharArray());
     if (pToken.Tokens.Length > 2)
     {
         deleteOptions.AddRange(GetCommandElement(pToken.Tokens, 2).ToUpper().Split(StringLiterals.SPACE.ToCharArray()));
         runSilent = deleteOptions.Contains("RUNSILENT");
     }
 }
예제 #48
0
        public Rule_PowExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /* 	::= <Negate Exp> '^' <Negate Exp>  | <Negate Exp> */

            this.NegateExp1 = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.NegateExp2 = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
 public Rule_Begin_Before_Statement(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Begin_Before_statement> ::= Begin-Before <Statements> End | Begin-Before End |!Null
     if (pToken.Tokens.Length > 2)
     {
         //NonterminalToken T = (NonterminalToken)pToken.Tokens[1];
         //this.Statements = new Rule_Statements(pContext, T);
         this.Statements = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
     }
 }
        public Rule_DefineVariables_Statement(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            this.TextField = this.ExtractTokensWithFormat(pToken.Tokens);

            //<DefineVariables_Statement> ::= DefineVariables <Define_Statement_Group> End-DefineVariables
            if (pToken.Tokens.Length > 2)
            {
                //define_Statements_Group = new Rule_Define_Statement_Group(pContext, (NonterminalToken)pToken.Tokens[1]);
                define_Statements_Group = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            }
        }
예제 #51
0
        public Rule_Read(Rule_Context context, NonterminalToken nonterminal)
            : base(context)
        {
            switch (nonterminal.Rule.Lhs.ToString())
            {
                case "<Simple_Read_Statement>":
                    _isSimpleRead = true;
                    _readOptions = GetCommandElement(nonterminal.Tokens, 1);
                    if (nonterminal.Tokens[2] is NonterminalToken)
                    {
                        Identifier = SetQualifiedId(nonterminal.Tokens[2]);
                    }
                    else
                    {
                        Identifier = GetCommandElement(nonterminal.Tokens, 2).Trim(new char[] { '[', ']' });
                    }
                    break;
                case "<Read_Sql_Statement>":
                    if (nonterminal.Tokens.Length > 4)
                    {
                        File = GetCommandElement(nonterminal.Tokens, 2).Trim('"');
                        Identifier = SetQualifiedId(nonterminal.Tokens[4]);
                    }
                    else
                    {   File = GetCommandElement(nonterminal.Tokens, 1).Trim(new char[] { '{', '}' });

                        if (nonterminal.Tokens[3] is NonterminalToken)
                        {
                            Identifier = SetQualifiedId(nonterminal.Tokens[3]);
                        }
                        else
                        {
                            Identifier = GetCommandElement(nonterminal.Tokens, 3).Trim(new char[] { '[', ']' });
                        }
                    }
                    break;
                default:
                    File = GetCommandElement(nonterminal.Tokens, 1);
                    if (nonterminal.Tokens[3] is NonterminalToken)
                    {
                        Identifier = SetQualifiedId(nonterminal.Tokens[3]);
                    }
                    else
                    {
                        Identifier = GetCommandElement(nonterminal.Tokens, 3).Trim(new char[] { '[', ']' });
                    }
                    if (nonterminal.Tokens.Length > 4)
                    {
                        _linkName = GetCommandElement(nonterminal.Tokens, 4);
                    }
                    break;
            }
        }
        public Rule_Define_Statement_Group(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            //<Define_Statement_Group> ::= <Define_Statement_Type> <Define_Statement_Group> | <Define_Statement_Type>

            Define_Statement_Type = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);

            if (pToken.Tokens.Length > 1)
            {
                Define_Statement_Group = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
            }
        }
예제 #53
0
        public Rule_ExprList(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*::= <Expression> ',' <Expr List> | <Expression> */

            this.Expression = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);

            if (pToken.Tokens.Length > 1)
            {
                this.ExprList = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
예제 #54
0
        public Rule_AndExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            // <Not Exp> AND <And Exp>
            // <Not Exp>

            this.NotExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.AndExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }
예제 #55
0
 public Rule_CheckCodeBlocks(Rule_Context pContext, NonterminalToken pToken)
 {
     //<CheckCodeBlocks> ::= <CheckCodeBlock> <CheckCodeBlocks> | <CheckCodeBlock>
     if (pToken.Tokens.Length > 1)
     {
         CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
         CheckCodeBlocks = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
     }
     else
     {
         CheckCodeBlock = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
 }
예제 #56
0
        public Rule_PowExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /* 	::= <Negate Exp> '^' <Negate Exp>  | <Negate Exp> */

            //this.ParameterList[0] = new Rule_NegateExp(pContext, (NonterminalToken)pToken.Tokens[0]);
            this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[0]));
            if (pToken.Tokens.Length > 1)
            {
                //this.ParameterList[1] = new Rule_NegateExp(pContext, (NonterminalToken)pToken.Tokens[2]);
                this.ParameterList.Add(AnalysisRule.BuildStatments(pContext, pToken.Tokens[2]));
            }
        }
예제 #57
0
        public Rule_ConcatExp(Rule_Context context, NonterminalToken token)
            : base(context)
        {
            //  ::= <Add Exp> '&' <Concat Exp> | <Add Exp>

            parameterList.Add(AnalysisRule.BuildStatments(context, token.Tokens[0]));

            if (token.Tokens.Length > 1)
            {
                operand = token.Tokens[1].ToString();
                parameterList.Add(AnalysisRule.BuildStatments(context, token.Tokens[2]));
            }
        }
예제 #58
0
        /// <summary>
        /// Constructor - Rule_Display
        /// </summary>
        /// <param name="pToken">The token to be parsed.</param>
        /// <returns>void</returns>
        public Rule_Display(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            this.commandText = this.ExtractTokens(pToken.Tokens);

            // <Variables_Display_Statement>    ::= DISPLAY DBVARIABLES <DbVariablesOpt> <DisplayOpt>
            // <Views_Display_Statement> 		::= DISPLAY DBVIEWS <DbViewsOpt> <DisplayOpt>
            // <Tables_Display_Statement> 		::= DISPLAY TABLES <DbViewsOpt> <DisplayOpt>

            // <DbVariablesOpt> ::= DEFINE | FIELDVAR | LIST <IdentifierList> | <IdentifierList> | !Null
            // <DisplayOpt> ::= <DefaultDisplayOpt> | !Null
            // <DefaultDisplayOpt> ::= OUTTABLE '=' Identifier
            // <DbViewsOpt> ::= <DefaultDbViewsOpt> | !Null
            // <DefaultDbViewsOpt> ::= File

            this.displayType = this.GetCommandElement(pToken.Tokens, 1);

            switch (pToken.Rule.Lhs.ToString())
            {
                case "<Variables_Display_Statement>":
                    if (pToken.Tokens.Length > 2)
                    {
                        dbVariablesOpt = this.GetCommandElement(pToken.Tokens, 2).Trim(new char[] { '"' }).ToUpper();
                        if (dbVariablesOpt.ToUpper().StartsWith(CommandNames.LIST))
                        {
                            identifierList = dbVariablesOpt.Substring(4).Trim();
                        }
                    }
                    break;
                case "<Views_Display_Statement>":
                case "<Tables_Display_Statement>":
                    if (pToken.Tokens.Length > 2)
                    {
                        dbViewsOpt = this.GetCommandElement(pToken.Tokens, 2);
                    }
                    break;
            }

            if (pToken.Tokens.Length > 3)
            {
                if (!string.IsNullOrEmpty(this.GetCommandElement(pToken.Tokens, 3)))
                {
                    string tokenFour = this.GetCommandElement(pToken.Tokens, 3);
                    if (tokenFour.ToUpper().Contains("OUTTABLE"))
                    {
                        outTable = this.GetCommandElement(pToken.Tokens, 3);
                        outTable = outTable.Substring(outTable.LastIndexOf('=') + 1).Trim();
                    }
                }
            }
        }
예제 #59
0
 public Rule_NotExp(Rule_Context pContext, NonterminalToken pToken)
     : base(pContext)
 {
     //<Not Exp> ::= NOT <Compare Exp> | <Compare Exp>
     if (pToken.Tokens.Length == 1)
     {
         CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
     }
     else
     {
         CompareExp = EnterRule.BuildStatments(pContext, pToken.Tokens[1]);
         this.isNotStatement = true;
     }
 }
예제 #60
0
        public Rule_ConcatExp(Rule_Context pContext, NonterminalToken pToken)
            : base(pContext)
        {
            /*::= <Add Exp> '&' <Concat Exp>
               						| <Add Exp>*/

            this.AddExp = EnterRule.BuildStatments(pContext, pToken.Tokens[0]);
            if (pToken.Tokens.Length > 1)
            {
                this.op = pToken.Tokens[1].ToString();

                this.ConcatExp = EnterRule.BuildStatments(pContext, pToken.Tokens[2]);
            }
        }