Пример #1
0
        public static EnterRule BuildStatments(Rule_Context pContext, Token pToken)
        {
            EnterRule result = null;
            if (pToken is NonterminalToken)
            {
                NonterminalToken NT = (NonterminalToken)pToken;

                switch (NT.Symbol.ToString())
                {
                    // H1N1
                    case "<Program>":
                        result = new Rule_Program(pContext, NT);
                        break;
                    case "<Always_Statement>":
                        result  = new Rule_Always(pContext, NT);
                        break;

                    case "<Simple_Assign_Statement>":
                    case "<Let_Statement>":
                    case "<Assign_Statement>":
                        result  = new Rule_Assign(pContext, NT);
                        break;
                    case "<Assign_DLL_Statement>":
                        result  = new Rule_Assign_DLL_Statement(pContext, NT);
                        break;
                    case "<If_Statement>":
                    case "<If_Else_Statement>":
                        result  = new Rule_If_Then_Else_End(pContext, NT);
                        break;
                    case "<Else_If_Statement>":
                        result = new Rule_Else_If_Statement(pContext, NT);
                        break;
                    case "<Define_Variable_Statement>":
                        result  = new Rule_Define(pContext, NT);
                        break;
                    case "<Define_Dll_Statement>":
                        result = new Rule_DLL_Statement(pContext, NT);
                        break;
                    case "<FuncName2>":
                    case "<FunctionCall>":
                        result = new Rule_FunctionCall(pContext, NT);
                        break;

                    case "<Hide_Some_Statement>":
                    case "<Hide_Except_Statement>":
                        result  = new Rule_Hide(pContext, NT);
                        break;

                    case "<Unhide_Some_Statement>":
                    case "<Unhide_Except_Statement>":
                        result  = new Rule_UnHide(pContext, NT);
                        break;

                    case "<Go_To_Variable_Statement>":
                    case "<Go_To_Page_Statement>":
                    case "<Go_To_Form_Statement>":
                        result  = new Rule_GoTo(pContext, NT);
                        break;

                    case "<Simple_Dialog_Statement>":
                    case "<Numeric_Dialog_Implicit_Statement>":
                    case "<Numeric_Dialog_Explicit_Statement>":
                    case "<TextBox_Dialog_Statement>":
                    case "<Db_Values_Dialog_Statement>":
                    case "<YN_Dialog_Statement>":
                    case "<Db_Views_Dialog_Statement>":
                    case "<Databases_Dialog_Statement>":
                    case "<Db_Variables_Dialog_Statement>":
                    case "<Multiple_Choice_Dialog_Statement>":
                    case "<Dialog_Read_Statement>":
                    case "<Dialog_Write_Statement>":
                    case "<Dialog_Read_Filter_Statement>":
                    case "<Dialog_Write_Filter_Statement>":
                    case "<Dialog_Date_Statement>":
                    case "<Dialog_Time_Statement>":
                    case "<Dialog_DateTime_Statement>":
                    case "<Dialog_Date_Mask_Statement>":
                        result  = new Rule_Dialog(pContext, NT);
                        break;

                    case "<Comment_Line>":
                        result  = new Rule_CommentLine(pContext, NT);
                        break;

                    case "<Simple_Execute_Statement>":
                    case "<Execute_File_Statement>":
                    case "<Execute_Url_Statement>":
                    case "<Execute_Wait_For_Exit_File_Statement>":
                    case "<Execute_Wait_For_Exit_String_Statement>":
                    case "<Execute_Wait_For_Exit_Url_Statement>":
                    case "<Execute_No_Wait_For_Exit_File_Statement>":
                    case "<Execute_No_Wait_For_Exit_String_Statement>":
                    case "<Execute_No_Wait_For_Exit_Url_Statement>":
                        result  = new Rule_Execute(pContext, NT);
                        break;
                    case "<Beep_Statement>":
                        result  = new Rule_Beep(pContext, NT);
                        break;
                    case "<Auto_Search_Statement>":
                        result  = new Rule_AutoSearch(pContext, NT);
                        break;
                    case "<Quit_Statement>":
                        result  = new Rule_Quit(pContext);
                        break;
                    case "<Clear_Statement>":
                        result  = new Rule_Clear(pContext, NT);
                        break;
                    case "<New_Record_Statement>":
                        result  = new Rule_NewRecord(pContext, NT);
                        break;
                    case "<Save_Record_Statement>":
                        result = new Rule_SaveRecord(pContext, NT);
                        break;
                    case "<Simple_Undefine_Statement>":
                        result  = new Rule_Undefine(pContext, NT);
                        break;
                    case "<Geocode_Statement>":
                        result  = new Rule_Geocode(pContext, NT);
                        break;
                    case "<DefineVariables_Statement>":
                        result  = new Rule_DefineVariables_Statement(pContext, NT);
                        break;
                    case "<Field_Checkcode_Statement>":
                        result  = new Rule_Field_Checkcode_Statement(pContext, NT);
                        break;
                    case "<View_Checkcode_Statement>":
                        result  = new Rule_View_Checkcode_Statement(pContext, NT);
                        break;
                    case "<Record_Checkcode_Statement>":
                        result  = new Rule_Record_Checkcode_Statement(pContext, NT);
                        break;
                    case "<Page_Checkcode_Statement>":
                        result  = new Rule_Page_Checkcode_Statement(pContext, NT);
                        break;
                    case "<Subroutine_Statement>":
                        result  = new Rule_Subroutine_Statement(pContext, NT);
                        break;
                    case "<Call_Statement>":
                        result  = new Rule_Call(pContext, NT);
                        break;
                    case "<Expr List>":
                        result = new Rule_ExprList(pContext, NT);
                        break;
                    case "<Expression>":
                        result = new Rule_Expression(pContext, NT);
                        break;
                    case "<And Exp>":
                        result = new Rule_AndExp(pContext, NT);
                        break;
                    case "<Not Exp>":
                        result = new Rule_NotExp(pContext, NT);
                        break;
                    case "<Compare Exp>":
                        result = new Rule_CompareExp(pContext, NT);
                        break;
                    case "<Concat Exp>":
                        result = new Rule_ConcatExp(pContext, NT);
                        break;
                    case "<Add Exp>":
                        result = new Rule_AddExp(pContext, NT);
                        break;
                    case "<Mult Exp>":
                        result = new Rule_MultExp(pContext, NT);
                        break;
                    case "<Pow Exp>":
                        result = new Rule_PowExp(pContext, NT);
                        break;
                    case "<Negate Exp>":
                        result = new Rule_NegateExp(pContext, NT);
                        break;
                    case "<Begin_Before_statement>":
                        result = new Rule_Begin_Before_Statement(pContext, NT);
                        break;
                    case "<Begin_After_statement>":
                        result = new Rule_Begin_After_Statement(pContext, NT);
                        break;
                    case "<Begin_Click_statement>":
                        result = new Rule_Begin_Click_Statement(pContext, NT);
                        break;
                    case "<CheckCodeBlock>":
                        result = new Rule_CheckCodeBlock(pContext, NT);
                        break;
                    case "<CheckCodeBlocks>":
                        result = new Rule_CheckCodeBlocks(pContext, NT);
                        break;
                    case "<Simple_Run_Statement>":
                        break;
                    case "<Statements>":
                        result = new Rule_Statements(pContext, NT);
                        break;
                    case "<Statement>":
                        result = new Rule_Statement(pContext, NT);
                        break;
                    case "<Define_Statement_Group>":
                        result = new Rule_Define_Statement_Group(pContext, NT);
                        break;
                    case "<Define_Statement_Type>":
                        result = new Rule_Define_Statement_Type(pContext, NT);
                        break;
                    case "<Highlight_Statement>":
                        result = new Rule_Highlight(pContext, NT);
                        break;
                    case "<UnHighlight_Statement>":
                        result = new Rule_UnHighlight(pContext, NT);
                        break;
                    case "<Enable_Statement>":
                        result = new Rule_Enable(pContext, NT);
                        break;
                    case "<Disable_Statement>":
                        result = new Rule_Disable(pContext, NT);
                        break;
                    case "<Set_Required_Statement>":
                        result = new Rule_SetRequired(pContext, NT);
                        break;
                    case "<Set_Not_Required_Statement>":
                        result = new Rule_SetNOTRequired(pContext, NT);
                        break;
                    case "<Value>":
                    default:
                        result = new Rule_Value(pContext, NT);
                        break;

                        //result = new Rule_Value(pContext, NT);
                        //throw new Exception("Missing rule in EnterRule.BuildStatments " + NT.Symbol.ToString());

                }

            }
            else // terminal token
            {
                TerminalToken TT = (TerminalToken)pToken;

                switch (TT.Symbol.ToString())
                {
                    case "<Value>":
                    default:
                        result = new Rule_Value(pContext, TT);
                        break;
                }
            }

            return result;
        }
Пример #2
0
        /// <summary>
        /// creates a negateexp from a token
        /// </summary>
        /// <returns>Rule_NegateExp</returns>
        public string CreateNegateRecode(Token pToken)
        {
            NonterminalToken T = (NonterminalToken)((NonterminalToken)pToken).Tokens[0];
            Rule_NegateExp result = new Rule_NegateExp(this.Context, T);

            return result.Execute().ToString();
        }