Пример #1
0
        static public 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
        static public AnalysisRule BuildStatments(Rule_Context context, Token token)
        {
            AnalysisRule result = null;

            if (token is NonterminalToken)
            {
                NonterminalToken nonterminal = (NonterminalToken)token;
                switch (nonterminal.Symbol.ToString())
                {
                case "<Statements>":
                    result = new Rule_Statements(context, nonterminal);
                    break;

                case "<Statement>":
                    result = new Rule_Statement(context, nonterminal);
                    break;

                case "<Always_Statement>":
                    result = new Rule_Always(context, nonterminal);
                    break;

                case "<Simple_Assign_Statement>":
                case "<Let_Statement>":
                case "<Assign_Statement>":
                    result = new Rule_Assign(context, nonterminal);
                    break;

                case "<Assign_DLL_Statement>":
                    result = new Rule_Assign_DLL_Statement(context, nonterminal);
                    break;

                case "<If_Statement>":
                case "<If_Else_Statement>":
                    result = new Rule_If_Then_Else_End(context, nonterminal);
                    break;

                case "<Define_Variable_Statement>":
                    result = new Rule_Define(context, nonterminal);
                    break;

                case "<FuncName2>":
                case "<FunctionCall>":
                    result = new Rule_FunctionCall(context, nonterminal);
                    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_Date_Mask_Statement>":
                    result = new Rule_Dialog(context, nonterminal);
                    break;

                case "<Read_Epi_Statement>":
                case "<Simple_Read_Statement>":
                case "<Read_Epi_File_Spec_Statement>":
                case "<Read_Sql_Statement>":
                case "<Read_Excel_File_Statement>":
                case "<Read_Db_Table_Statement>":
                    result = new Rule_Read(context, nonterminal);
                    break;

                case "<Merge_Table_Statement>":
                case "<Merge_Db_Table_Statement>":
                case "<Merge_File_Statement>":
                case "<Merge_Excel_File_Statement>":
                    result = new Rule_Merge(context, nonterminal);
                    break;

                case "<Write_All_Statement>":
                case "<Write_Some_Statement>":
                case "<Write_Except_Statement>":
                    result = new Rule_Write(context, nonterminal);
                    break;

                case "<Select_Statement>":
                case "<Cancel_Select_By_Selecting_Statement>":
                case "<Cancel_Select_Statement>":
                    result = new Rule_Select(context, nonterminal);
                    break;

                case "<Recode_Statement>":
                    result = new Rule_Recode(context, nonterminal);
                    break;

                case "<Comment_Line>":
                    result = new Rule_CommentLine(context, nonterminal);
                    break;

                case "<Execute_Statement>":
                    result = new Rule_Execute(context, nonterminal);
                    break;

                case "<Report_Display_Statement>":
                case "<Report_File_Statement>":
                case "<Report_Print_Statement>":
                    result = new Rule_Report(context, nonterminal);
                    break;

                case "<List_Statement>":
                    result = new Rule_List(context, nonterminal);
                    break;

                case "<Simple_Tables_Statement>":
                case "<Tables_One_Variable_Statement>":
                case "<Row_All_Tables_Statement>":
                case "<Row_Except_Tables_Statement>":
                case "<Column_All_Tables_Statement>":
                case "<Column_Except_Tables_Statement>":
                case "<Row_Column_Tables_Statement>":
                    result = new Rule_Tables(context, nonterminal);
                    break;

                case "<Freq_All_Statement>":
                case "<Freq_Columns_Statement>":
                case "<Freq_All_Except_Statement>":
                    result = new Rule_Freq(context, nonterminal);
                    break;

                case "<Cancel_Sort_By_Sorting_Statement>":
                case "<Cancel_Sort_Statement>":
                case "<Sort_Statement>":
                    result = new Rule_Sort(context, nonterminal);
                    break;

                case "<Means_Statement>":
                    result = new Rule_Means(context, nonterminal);
                    break;

                case "<Relate_Epi_Table_Statement>":
                case "<Relate_Table_Statement>":
                case "<Relate_Db_Table_With_Identifier_Statement>":
                case "<Relate_Db_Table_Statement>":
                case "<Relate_File_Statement>":
                case "<Relate_Excel_File_Statement>":
                    result = new Rule_Relate(context, nonterminal);
                    break;

                case "<Beep_Statement>":
                    result = new Rule_Beep(context, nonterminal);
                    break;

                case "<Quit_Statement>":
                    result = new Rule_Quit(context, nonterminal);
                    break;

                case "<Delete_Table_Long_Statement>":
                    result = new Rule_Delete_Table_Long(context, nonterminal);
                    break;

                case "<Delete_File_Statement>":
                    result = new Rule_Delete_File(context, nonterminal);
                    break;

                case "<Delete_Table_Statement>":
                    result = new Rule_Delete_Table(context, nonterminal);
                    break;

                case "<Type_Out_String_Statement>":
                case "<Type_Out_File_Statement>":
                case "<Type_Out_String_With_Font_Statement>":
                case "<Type_Out_File_With_Font_Statement>":
                    result = new Rule_Typeout(context, nonterminal);
                    break;

                case "<Simple_Routeout_Statement>":
                case "<Replace_Routeout_Statement>":
                case "<Append_Routeout_Statement>":
                    result = new Rule_RouteOut(context, nonterminal);
                    break;

                case "<Close_Out_Statement>":
                    result = new Rule_CloseOut(context, nonterminal);
                    break;

                case "<Variables_Display_Statement>":
                case "<Views_Display_Statement>":
                case "<Tables_Display_Statement>":
                    result = new Rule_Display(context, nonterminal);
                    break;

                case "<Header_Title_String_Statement>":
                case "<Header_Title_Font_Statement>":
                case "<Header_Title_String_And_Font_Statement>":
                    result = new Rule_Header(context, nonterminal);
                    break;

                case "<Simple_Undefine_Statement>":
                    result = new Rule_Undefine(context, nonterminal);
                    break;

                case "<Run_File_PGM_Statement>":
                    result = new Rule_Run_File_PGM_Statement(context, nonterminal);
                    break;

                case "<Run_String_Statement>":
                    result = new Rule_Run_String_Statement(context, nonterminal);
                    break;

                case "<Run_PGM_In_Db_Statement>":
                    result = new Rule_Run_PGM_In_Db_Statement(context, nonterminal);
                    break;

                case "<Delete_Records_All_Statement>":
                    result = new Rule_Delete_Records_All_Statement(context, nonterminal);
                    break;

                case "<Delete_Records_Selected_Statement>":
                    result = new Rule_Delete_Records_Selected_Statement(context, nonterminal);
                    break;

                case "<Simple_Print_Out_Statement>":
                case "<File_Print_Out_Statement>":
                    result = new Rule_Printout(context, nonterminal);
                    break;

                case "<SQL_Execute_Command>":
                    result = new Rule_SQLExec(context, nonterminal);
                    break;

                case "<RecordSet_Command>":
                    result = new Rule_RecordSet(context, nonterminal);
                    break;

                case "<Define_Connection_Command>":
                    result = new Rule_Define_Connection(context, nonterminal);
                    break;

                case "<Regress_Statement>":
                    result = new Rule_LinearRegression(context, nonterminal);
                    break;

                case "<Logistic_Statement>":
                    result = new Rule_LogisticRegression(context, nonterminal);
                    break;

                case "<CoxPH_Statement>":
                    result = new Rule_CoxPH(context, nonterminal);
                    break;

                case "<KM_Survival_Statement>":
                    result = new Rule_KMSurvival(context, nonterminal);
                    break;

                case "<Define_Dll_Statement>":
                    result = new Rule_DLL_Statement(context, nonterminal);
                    break;

                case "<Define_Group_Statement>":
                    result = new Rule_Define_Group(context, nonterminal);
                    break;

                case "<Summarize_Statement>":
                    result = new Rule_Summarize(context, nonterminal);
                    break;

                case "<Set_Statement>":
                    result = new Rule_Set(context, nonterminal);
                    break;

                case "<Match_Row_All_Statement>":
                case "<Match_Row_Except_Statement>":
                case "<Match_Column_All_Statement>":
                case "<Match_Column_Except_Statement>":
                case "<Match_Row_Column_Statement>":
                    result = new Rule_Match(context, nonterminal);
                    break;

                case "<Graph_Statement>":
                case "<Simple_Graph_Statement>":
                case "<Strata_Var_Graph_Statement>":
                case "<Weight_Var_Graph_Statement>":
                case "<Stra_Wei_Var_Graph_Statement>":
                case "<Graph_Opt_1_Statement>":
                case "<Graph_Opt_2_Statement>":
                case "<Graph_Opt_3_Statement>":
                case "<Graph_Opt_4_Statement>":
                case "<Graph_Opt_5_Statement>":
                case "<Graph_Generic_Opt_Statement>":
                    result = new Rule_Graph(context, nonterminal);
                    break;

                case "<Expr List>":
                    result = new Rule_ExprList(context, nonterminal);
                    break;

                case "<Expression>":
                    result = new Rule_Expression(context, nonterminal);
                    break;

                case "<And Exp>":
                    result = new Rule_AndExp(context, nonterminal);
                    break;

                case "<Not Exp>":
                    result = new Rule_NotExp(context, nonterminal);
                    break;

                case "<Compare Exp>":
                    result = new Rule_CompareExp(context, nonterminal);
                    break;

                case "<Concat Exp>":
                    result = new Rule_ConcatExp(context, nonterminal);
                    break;

                case "<Add Exp>":
                    result = new Rule_AddExp(context, nonterminal);
                    break;

                case "<Mult Exp>":
                    result = new Rule_MultExp(context, nonterminal);
                    break;

                case "<Pow Exp>":
                    result = new Rule_PowExp(context, nonterminal);
                    break;

                case "<Negate Exp>":
                    result = new Rule_NegateExp(context, nonterminal);
                    break;

                default:
                case "<Value>":
                    result = new Rule_Value(context, nonterminal);
                    break;

                case "<Undelete_All_Statement>":
                    result = new Rule_UnDelete(context, nonterminal);
                    break;

                case "<QualifiedIdList>":
                    result = new Rule_QualifiedIdList(context, nonterminal);
                    break;

                case "<Subroutine_Statement>":
                    result = new Rule_Subroutine_Statement(context, nonterminal);
                    break;

                case "<Call_Statement>":
                    result = new Rule_Call(context, nonterminal);
                    break;
                //**these are not yet implemented; move up when completed
                //**these are not yet implemented; move up when completed
                //**these are not yet implemented; move up when completed
                //**these are not yet implemented; move up when completed
                //**these are not yet implemented; move up when completed

                case "<Simple_Run_Statement>":
                case "<About_Statement>":
                case "<Browser_Statement>":
                case "<Browser_Size_Statement>":
                case "<Button_Offset_Size_1_Statement>":
                case "<Button_Offset_Size_2_Statement>":
                case "<Button_Offset_1_Statement>":
                case "<Button_Offset_2_Statement>":
                case "<Simple_CMD_Statement>":
                case "<CMD_Line_Statement>":
                case "<Delete_Table_Short_Statement>":
                case "<Exit_Statement>":
                case "<File_Dialog_Statement>":
                case "<Get_Path_Statement>":
                case "<Help_File_Statement>":
                case "<Simple_Help_Statement>":
                case "<Link_Statement>":
                case "<Link_Remove_Statement>":
                case "<Map_AVG_Statement>":
                case "<Map_Case_Statement>":
                case "<Map_Sum_Statement>":
                case "<Map_Count_Statement>":
                case "<Map_Min_Statement>":
                case "<Map_Max_Statement>":
                case "<Map_Opt_1_Statement>":
                case "<Map_Opt_2_Statement>":
                case "<Map_Opt_3_Statement>":
                case "<Map_Opt_4_Statement>":
                case "<Map_Opt_5_Statement>":
                case "<Menu_Statement>":
                case "<Menu_Command_Statement>":
                case "<Menu_Dialog_Statement>":
                case "<Menu_Execute_Statement>":
                case "<Menu_Item_Block_Name_Statement>":
                case "<Menu_Item_Separator_Statement>":
                case "<Menu_Replace_Statement>":
                case "<Move_Buttons_Statement>":
                case "<New_Page_Statement>":
                case "<On_Browser_Exit_Block>":
                case "<Picture_Statement>":
                case "<Picture_Size_Statement>":
                case "<Popup_Statement>":
                case "<Repeat_Statement>":
                case "<Screen_Text_Statement>":
                case "<Set_Buttons_Statement>":
                case "<Set_DB_Version_Statement>":
                case "<Set_DOS_Win_Statement>":
                case "<Set_Import_Year_Statement>":
                case "<Set_Ini_Dir_Statement>":
                case "<Set_Language_Statement>":
                case "<Set_Picture_Statement>":
                case "<Set_Work_Dir_Statement>":
                case "<ShutDown_Block>":
                case "<Startup_Block>":
                case "<Sys_Info_Statement>":
                case "<All_Standard_Undefine_Statement>":
                case "<All_Global_Undefine_Statement>":
                case "<Wait_For_Statement>":
                case "<Wait_For_Exit_Statement>":
                case "<Wait_For_File_Exists_Statement>":
                case "<Command_Block>":
                case "<On_Browser_Exit_Empty_Block>":
                case "<Startup_Empty_Block>":
                case "<ShutDown_Empty_Block>":
                case "<Menu_Empty_Block>":
                case "<Popup_Empty_Block>":
                case "<Empty_Command_Block>":
                    break;
                }
            }
            else // terminal token
            {
                TerminalToken terminal = (TerminalToken)token;

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

            return(result);
        }