From c186a26bc470dce16d2184b24f8322640f03077f Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sat, 30 Aug 2014 12:55:31 +0100 Subject: [PATCH] Remove IronPython addin. --- .../Python/PyWalker/AssemblyInfo.cs | 49 - .../Python/PyWalker/CodeDomVisitor.cs | 441 ---- .../Python/PyWalker/Indentation.cs | 46 - .../Python/PyWalker/MainForm.Designer.cs | 210 -- .../Python/PyWalker/MainForm.cs | 157 -- .../Python/PyWalker/MainForm.resx | 123 - .../Python/PyWalker/NRefactoryAstVisitor.cs | 678 ------ .../Python/PyWalker/Program.cs | 41 - .../Python/PyWalker/PyWalker.csproj | 84 - .../Python/PyWalker/ResolveWalker.cs | 237 -- .../Project/Configuration/AssemblyInfo.cs | 31 - .../Project/Python.Build.Tasks.csproj | 79 - .../Project/SharpDevelop.Build.Python.targets | 105 - .../Project/Src/IPythonCompiler.cs | 83 - .../Project/Src/PythonCompiler.cs | 282 --- .../Project/Src/PythonCompilerException.cs | 29 - .../Project/Src/PythonCompilerTask.cs | 313 --- .../Project/Src/ResourceFile.cs | 58 - .../Project/Src/Resources.cs | 36 - .../Python.Build.Tasks/Test/AssemblyInfo.cs | 49 - .../Test/CompileResourcesTestFixture.cs | 90 - .../CompileSingleSourceFileTestFixture.cs | 120 - .../Test/DifferentTargetTypesTestFixture.cs | 84 - .../Test/DummyPythonCompilerTask.cs | 109 - .../Test/IOErrorTestFixture.cs | 72 - .../Test/IncludeDebugInfoTestFixture.cs | 77 - .../Test/LogicalResourceNamesTests.cs | 59 - .../Test/MainEntryPointTestFixture.cs | 72 - .../Test/MissingMainEntryPointTestFixture.cs | 67 - .../Test/MockPythonCompiler.cs | 160 -- .../Test/PlatformTestFixture.cs | 116 - .../Test/Python.Build.Tasks.Tests.csproj | 90 - .../Test/PythonCompilerTests.cs | 57 - .../Test/RelativeReferenceTestFixture.cs | 69 - .../Test/RelativeResourceFileTestFixture.cs | 69 - ...ntaxErrorFileNameWithDotCharTestFixture.cs | 79 - .../SyntaxErrorNullFileNameTestFixture.cs | 71 - .../Test/SyntaxErrorTestFixture.cs | 119 - .../SyntaxErrorUnknownFileNameTestFixture.cs | 78 - .../BackendBindings/Python/PythonBinding.sln | 206 -- .../Project/Configuration/AssemblyInfo.cs | 31 - .../PythonBinding/Project/Lib/__future__.py | 25 - .../Python/PythonBinding/Project/Lib/runpy.py | 31 - .../Python/PythonBinding/Project/Lib/site.py | 14 - .../PythonBinding/Project/PythonBinding.addin | 227 -- .../Project/PythonBinding.csproj | 319 --- .../Resources/ApplicationSettingsPanel.xfrm | 138 -- .../Resources/CompilingOptionsPanel.xfrm | 71 - .../Project/Resources/Python.xshd | 135 -- .../PythonBinding/Project/Src/AddInOptions.cs | 100 - .../Project/Src/ApplicationSettingsPanel.cs | 154 -- .../Project/Src/CompilingOptionsPanel.cs | 108 - .../Project/Src/ConstructorInfo.cs | 68 - .../ConvertProjectToPythonProjectCommand.cs | 170 -- .../Project/Src/ConvertToPythonMenuCommand.cs | 66 - .../Project/Src/IPythonResolver.cs | 28 - .../PythonBinding/Project/Src/MemberName.cs | 90 - .../Src/NRefactoryToPythonConverter.cs | 2074 ----------------- .../Project/Src/PythonAstWalker.cs | 159 -- .../Src/PythonBuiltInModuleMemberName.cs | 37 - .../PythonBinding/Project/Src/PythonClass.cs | 106 - .../Project/Src/PythonClassFields.cs | 79 - .../Project/Src/PythonClassMembers.cs | 54 - .../Project/Src/PythonClassResolver.cs | 119 - .../Project/Src/PythonCodeBuilder.cs | 56 - .../Src/PythonCodeCompletionBinding.cs | 69 - .../Src/PythonCodeCompletionItemProvider.cs | 31 - .../Project/Src/PythonCodeDeserializer.cs | 253 -- .../Project/Src/PythonCodeDomSerializer.cs | 388 --- .../Project/Src/PythonCompilationUnit.cs | 33 - .../Project/Src/PythonCompilerError.cs | 52 - .../Project/Src/PythonCompilerSink.cs | 59 - .../Project/Src/PythonCompletionItemList.cs | 39 - .../Project/Src/PythonComponentWalker.cs | 417 ---- .../Src/PythonComponentWalkerException.cs | 32 - .../Project/Src/PythonConsole.cs | 86 - .../Project/Src/PythonConsoleApplication.cs | 46 - .../Project/Src/PythonConsoleHost.cs | 103 - .../Project/Src/PythonConsolePad.cs | 36 - .../Project/Src/PythonConstructor.cs | 32 - .../Src/PythonControlFieldExpression.cs | 533 ----- .../Project/Src/PythonDesignerGenerator.cs | 103 - .../Project/Src/PythonDesignerLoader.cs | 43 - .../Src/PythonDesignerLoaderProvider.cs | 37 - .../Project/Src/PythonExpression.cs | 91 - .../Project/Src/PythonExpressionFinder.cs | 208 -- .../Project/Src/PythonFormattingStrategy.cs | 36 - .../Src/PythonFormsDesignerDisplayBinding.cs | 104 - .../Project/Src/PythonFromImport.cs | 84 - .../PythonBinding/Project/Src/PythonImport.cs | 66 - .../Project/Src/PythonImportCompletion.cs | 86 - .../Project/Src/PythonImportExpression.cs | 190 -- .../Src/PythonImportExpressionContext.cs | 60 - .../Src/PythonImportModuleResolveResult.cs | 58 - .../Project/Src/PythonImportResolver.cs | 43 - .../Project/Src/PythonInsightWindowHandler.cs | 92 - .../Project/Src/PythonLanguageBinding.cs | 36 - .../Project/Src/PythonLanguageProperties.cs | 46 - .../Project/Src/PythonLineIndenter.cs | 61 - .../Src/PythonLocalVariableAssignment.cs | 89 - .../Src/PythonLocalVariableResolver.cs | 141 -- .../Project/Src/PythonMemberResolver.cs | 145 -- .../PythonBinding/Project/Src/PythonMethod.cs | 113 - .../Project/Src/PythonMethodDefinition.cs | 48 - .../Src/PythonMethodGroupResolveResult.cs | 31 - .../Src/PythonMethodOrClassBodyRegion.cs | 63 - .../Src/PythonMethodReturnValueResolver.cs | 61 - .../PythonBinding/Project/Src/PythonModule.cs | 32 - .../Src/PythonModuleCompletionItems.cs | 171 -- .../Src/PythonModuleCompletionItemsFactory.cs | 39 - .../Project/Src/PythonNamespaceResolver.cs | 84 - .../Project/Src/PythonOptionsPanel.xaml | 44 - .../Project/Src/PythonOptionsPanel.xaml.cs | 79 - .../PythonBinding/Project/Src/PythonParser.cs | 150 -- .../Project/Src/PythonProject.cs | 100 - .../Project/Src/PythonProjectBinding.cs | 56 - .../Project/Src/PythonProperty.cs | 41 - .../Project/Src/PythonPropertyAssignment.cs | 69 - .../Src/PythonPropertyValueAssignment.cs | 152 -- .../Project/Src/PythonResolver.cs | 112 - .../Project/Src/PythonResolverContext.cs | 328 --- .../Project/Src/PythonSelfResolver.cs | 61 - .../Project/Src/PythonStandardLibraryPath.cs | 88 - ...PythonStandardModuleMethodResolveResult.cs | 49 - .../Src/PythonStandardModuleMethodResolver.cs | 95 - .../Src/PythonStandardModuleResolveResult.cs | 43 - .../Src/PythonStandardModuleResolver.cs | 57 - .../Project/Src/PythonStandardModuleType.cs | 42 - .../Project/Src/PythonStandardModules.cs | 75 - .../Project/Src/PythonTestDebugger.cs | 85 - .../Project/Src/PythonTestFramework.cs | 86 - .../Project/Src/PythonTestResult.cs | 77 - .../Project/Src/PythonTestRunner.cs | 79 - .../Src/PythonTestRunnerApplication.cs | 122 - .../Project/Src/PythonTestRunnerContext.cs | 66 - .../Src/PythonTestRunnerResponseFile.cs | 133 -- .../Project/Src/PythonUsingScope.cs | 33 - .../Project/Src/PythonWorkbench.cs | 31 - .../Project/Src/RunDebugPythonCommand.cs | 38 - .../Project/Src/RunPythonCommand.cs | 41 - .../Src/SendLineToPythonConsoleCommand.cs | 32 - .../SendSelectedTextToPythonConsoleCommand.cs | 31 - .../Project/Src/StringTextContentProvider.cs | 44 - .../Project/Src/SysModuleCompletionItems.cs | 64 - .../Project/Templates/ConsoleProject.xpt | 54 - .../PythonBinding/Project/Templates/Empty.xft | 15 - .../Project/Templates/EmptyClass.xft | 18 - .../Project/Templates/EmptyForm.xft | 29 - .../Project/Templates/EmptyUserControl.xft | 28 - .../Project/Templates/FormsProject.xpt | 83 - .../Project/Templates/LibraryProject.xpt | 43 - .../Templates/SilverlightApplication.xpt | 73 - .../Project/Templates/WPFApplication.xpt | 102 - .../Project/Templates/WPFWindow.xft | 27 - .../Project/TestRunner/sdtest.py | 95 - .../Project/TestRunner/sdtestrunner.py | 106 - .../Python/PythonBinding/Test/AssemblyInfo.cs | 54 - ...pletionBindingFromImportCompletionTests.cs | 85 - ...eCompletionBindingImportCompletionTests.cs | 116 - ...FromDateTimeImportCompletionTestFixture.cs | 55 - ...romImportDotNetNamespaceCompletionTests.cs | 69 - .../FromImportPythonModuleCompletionTests.cs | 70 - ...mMathLibraryImportCompletionTestFixture.cs | 83 - ...aryImportCosMethodCompletionTestFixture.cs | 61 - ...LibraryImportCompletionItemsTestFixture.cs | 244 -- .../GetMethodsFromSysLibraryTestFixture.cs | 124 - .../Completion/GetPythonModulesTestFixture.cs | 82 - .../GetTypeForPythonModuleTestFixture.cs | 63 - .../Completion/ImportCompletionTestFixture.cs | 66 - ...portEmptyNamespaceCompletionTestFixture.cs | 51 - ...emsIfExpressionHasIdentifierTestFixture.cs | 64 - ...ImportSubNamespaceCompletionTestFixture.cs | 61 - ...ModuleMembersInPythonContextTestFixture.cs | 45 - ...paceContentsAddedToCtrlSpaceTestFixture.cs | 91 - .../PythonCodeCompletionBindingTests.cs | 44 - .../PythonCodeCompletionItemProviderTests.cs | 38 - .../PythonCompletionItemListTests.cs | 56 - .../PythonImportExpressionContextTests.cs | 140 -- .../PythonInsightWindowHandlerTests.cs | 141 -- ...onSocketLibraryDocumentationTestFixture.cs | 59 - ...ModuleMembersInPythonContextTestFixture.cs | 67 - .../Configuration/AddInOptionsTestFixture.cs | 107 - .../BuiltinCodeCompletionTestFixture.cs | 93 - .../Test/Console/PythonConsoleHostTests.cs | 116 - .../AddHandlerConversionTestFixture.cs | 71 - .../ArrayCastConversionTestFixture.cs | 57 - .../Converter/ArrayConversionTestFixture.cs | 182 -- ...AssignmentOperatorConversionTestFixture.cs | 177 -- .../BaseClassConversionTestFixture.cs | 47 - .../BaseClassReferenceTestFixture.cs | 54 - .../BinaryOperatorConversionTests.cs | 181 -- .../BitShiftConversionTestFixture.cs | 52 - .../Converter/BooleanConversionTestFixture.cs | 53 - .../BreakAndContinueConversionTestFixture.cs | 65 - ...ClassWithNamespaceConversionTestFixture.cs | 53 - ...ctorWithParametersConversionTestFixture.cs | 53 - .../ClassConstructorConversionTestFixture.cs | 53 - .../ClassDestructorConversionTestFixture.cs | 58 - .../ClassFieldReferenceTestFixture.cs | 63 - ...ertCSharpToPythonMenuCommandTestFixture.cs | 75 - ...onvertToPythonProjectCommandTestFixture.cs | 160 -- ...vertVBNetToPythonMenuCommandTestFixture.cs | 78 - .../ConverterSupportedLanguageTests.cs | 92 - .../ElseIfStatementConversionTestFixture.cs | 61 - .../EmptyCSharpClassConversionTestFixture.cs | 60 - ...entHandlerWithObjectCreationTestFixture.cs | 62 - ...DeclarationWithNoInitializerTestFixture.cs | 55 - .../Converter/ForLoopConversionTestFixture.cs | 77 - .../Test/Converter/ForNextConversionTests.cs | 89 - .../Converter/ForeachConversionTestFixture.cs | 93 - ...eachConversionWithMethodCallTestFixture.cs | 57 - .../GenerateMainMethodCallTestFixture.cs | 57 - .../GenericListConversionTestFixture.cs | 64 - .../IfBlockStatementConversionTestFixture.cs | 68 - .../IfStatementConversionTestFixture.cs | 63 - .../IncrementAndDecrementConversionTests.cs | 203 -- .../IntegerClassFieldConversionTestFixture.cs | 56 - ...ieldInitializedInConstructorTestFixture.cs | 56 - ...gerClassFieldWithConstructorTestFixture.cs | 56 - .../IntegerMethodParameterTestFixture.cs | 54 - ...ariableAssignedInConstructorTestFixture.cs | 55 - ...ableDeclarationInIfStatementTestFixture.cs | 68 - ...LocalVariableDefinitionsOnSameLineTests.cs | 75 - .../LocalVariableNotInitializedTestFixture.cs | 50 - .../MethodCallInConstructorTestFixture.cs | 53 - .../MethodParameterConversionTestFixture.cs | 53 - .../MethodReturnValueConversionTestFixture.cs | 53 - .../MethodWithBodyConversionTestFixture.cs | 53 - .../ModulusOperatorConversionTestFixture.cs | 49 - .../Converter/MultiLineCommentTestFixture.cs | 66 - .../MultipleFieldsOnSameLineTests.cs | 121 - .../NestedClassConversionTestFixture.cs | 69 - .../NestedIfStatementConversionTestFixture.cs | 86 - .../Converter/NullConversionTestFixture.cs | 57 - .../Converter/ObjectCreationTestFixture.cs | 56 - .../ObjectInitializerConversionTestFixture.cs | 86 - ...ectReferenceEqualsConversionTestFixture.cs | 50 - .../ProjectHasStartupObjectTestFixture.cs | 136 -- .../PropertyConversionTestFixture.cs | 70 - .../PropertyReferenceConversionTestFixture.cs | 73 - ...PropertyWithGetSetStatementsTestfixture.cs | 82 - .../PropertyWithGetterTestFixture.cs | 66 - .../PropertyWithSetterTestFixture.cs | 59 - .../RemoveHandlerConversionTestFixture.cs | 62 - .../SingleClassMethodConversionTestFixture.cs | 51 - .../SingleLineCommentConversionTestFixture.cs | 64 - .../StaticClassReferenceTestFixture.cs | 53 - .../StaticMethodConversionTestFixture.cs | 98 - .../SwitchStatementConversionTestFixture.cs | 111 - .../TernaryOperatorConversionTestFixture.cs | 52 - .../ThrowExceptionConversionTestFixture.cs | 54 - .../TryCatchFinallyConversionTestFixture.cs | 70 - .../Converter/TypeofConversionTestFixture.cs | 52 - .../Converter/UnaryOperatorConversionTests.cs | 115 - .../UsingStatementConversionTestFixture.cs | 67 - .../Converter/VBClassConversionTestFixture.cs | 50 - .../Test/Converter/VBExitConversionTests.cs | 53 - .../Converter/VBStringConcatTestFixture.cs | 52 - .../WhileLoopConversionTestFixture.cs | 54 - .../XmlDocCommentConversionTestFixture.cs | 88 - .../PythonBinding/Test/Designer/App.ico | Bin 1078 -> 0 bytes .../Designer/AssignmentAfterFormClassTests.cs | 77 - .../CallBeginInitOnLoadTestFixture.cs | 63 - ...ustomClassUsingTypeConverterTestFixture.cs | 43 - .../CursorTypeResolutionTestFixture.cs | 55 - .../DeserializeAssignmentTestFixtureBase.cs | 61 - .../DeserializeColorFromArgbTestFixture.cs | 56 - ...serializeComponentAssignmentTestFixture.cs | 51 - .../DeserializeConstraintArrayTestFixture.cs | 50 - .../DeserializeDateTimeArrayTestFixture.cs | 48 - .../DeserializeLocalVariableTestFixture.cs | 75 - .../DeserializeMethodParametersTestFixture.cs | 118 - .../DeserializeStringArrayTestFixture.cs | 57 - ...eserializeToolStripItemArrayTestFixture.cs | 63 - ...alizerConstructorStringArrayTestFixture.cs | 70 - ...edSetUsingPropertyDescriptorTestFixture.cs | 56 - .../EventHandlerAlreadyExistsTestFixture.cs | 86 - ...sWithIncorrectParameterCountTestFixture.cs | 71 - ...indInitializeComponentMethodTestFixture.cs | 135 -- .../FormBaseClassCreatedOnLoadTestFixture.cs | 58 - .../GenerateAcceptButtonFormTestFixture.cs | 61 - .../GenerateAccessibleRoleFormTestFixture.cs | 77 - .../GenerateAutoScaleModeFormTestFixture.cs | 90 - .../GenerateAutoScrollFormTestFixture.cs | 77 - .../GenerateBackgroundWorkerTestFixture.cs | 80 - ...GenerateButtonFlatAppearanceTestFixture.cs | 99 - .../GenerateComboBoxItemsTestFixture.cs | 98 - .../GenerateContextMenuStripTestFixture.cs | 97 - .../Designer/GenerateCursorFormTestFixture.cs | 77 - ...enerateCustomCollectionItemsTestFixture.cs | 122 - .../Designer/GenerateDataSetTestFixture.cs | 99 - .../GenerateDoubleBufferedFormTestFixture.cs | 80 - .../GenerateEventHandlerFormTestFixture.cs | 95 - .../Designer/GenerateEventLogTestFixture.cs | 79 - ...olderBrowserDialogRootFolderTestFixture.cs | 83 - .../Designer/GenerateFormColorTestFixture.cs | 80 - .../GenerateFormLocationTestFixture.cs | 77 - .../GenerateFormPaddingTestFixture.cs | 77 - .../GenerateFormResourcesTestFixture.cs | 114 - .../GenerateImageListResourcesTestFixture.cs | 114 - .../GenerateImeModeFormTestFixture.cs | 74 - .../GenerateInheritedFormTestFixture.cs | 88 - ...eInheritedProtectedPanelFormTestFixture.cs | 121 - .../GenerateInheritedToolTipTestFixture.cs | 91 - .../GenerateListViewGroupsTestFixture.cs | 124 - .../GenerateListViewItemTestFixture.cs | 144 -- .../GenerateListViewSubItemsTestFixture.cs | 143 -- ...enerateListViewWithImageListTestFixture.cs | 143 -- .../GenerateLocalImageResourceTestFixture.cs | 167 -- .../GenerateMenuStripFormTestFixture.cs | 97 - .../GenerateMenuStripItemsTestFixture.cs | 166 -- .../GenerateMinSizeFormTestFixture.cs | 86 - .../GenerateMonthCalendarTestFixture.cs | 94 - .../GenerateNestedPanelFormTestFixture.cs | 124 - .../Designer/GeneratePanelFormTestFixture.cs | 118 - .../GenerateRichTextBoxTestFixture.cs | 96 - .../GenerateRightToLeftFormTestFixture.cs | 74 - .../Designer/GenerateSimpleFormTestFixture.cs | 70 - .../GenerateTableLayoutPanelTestFixture.cs | 103 - .../GenerateTextBoxFormTestFixture.cs | 87 - .../Test/Designer/GenerateTimerTestFixture.cs | 81 - .../GenerateToolTipFormTestFixture.cs | 79 - .../Designer/GenerateTreeViewTestFixture.cs | 124 - ...teUserControlWithNullPropertyValueTests.cs | 60 - .../GeneratedControlOrderingTestFixture.cs | 110 - .../IgnoreDesignTimePropertiesTestFixture.cs | 78 - .../InsertEventHandlerTestFixtureBase.cs | 76 - ...tEventHandlerWithSpaceIndentTestFixture.cs | 78 - .../InsertNewEventHandlerTestFixture.cs | 106 - .../InsertSecondEventHandlerTestFixture.cs | 70 - .../Designer/IsFormDesignableTestFixture.cs | 89 - ...ifiedBaseClassFormDesignableTestFixture.cs | 74 - .../LoadAcceptButtonFormTestFixture.cs | 75 - .../Designer/LoadAccessibleRoleTestFixture.cs | 54 - .../LoadAnchorStylesFormTestFixture.cs | 68 - .../LoadBindingNavigatorTestFixture.cs | 216 -- .../LoadButtonFlatAppearanceTestFixture.cs | 82 - .../Designer/LoadColorFromArgbTestFixture.cs | 54 - .../LoadControlEventHandlerTestFixture.cs | 89 - .../Test/Designer/LoadCursorTestFixture.cs | 54 - .../Designer/LoadEventHandlerTestFixture.cs | 79 - .../LoadFileSystemWatcherTestFixture.cs | 90 - .../Test/Designer/LoadFontTestFixture.cs | 55 - .../Test/Designer/LoadFormTestFixtureBase.cs | 51 - ...FormWithBooleanPropertiesSetTestFixture.cs | 61 - ...ormWithButtonFollowedByTimerTestFixture.cs | 123 - ...rmWithSysPathAppendStatementTestFixture.cs | 77 - ...dInheritedProtectedPanelFormTestFixture.cs | 101 - ...LoadInheritedPublicPanelFormTestFixture.cs | 102 - .../LoadInheritedToolTipTestFixture.cs | 79 - .../Designer/LoadListViewFormTestFixture.cs | 96 - .../LoadLocalImageResourceTestFixture.cs | 116 - ...alVariablePropertyAssignmentTestFixture.cs | 76 - .../Designer/LoadMenuStripFormTestFixture.cs | 141 -- .../Designer/LoadMonthCalendarTestFixture.cs | 80 - .../Designer/LoadSimpleFormTestFixture.cs | 126 - .../LoadSimpleUserControlTestFixture.cs | 84 - .../Designer/LoadSplitContainerTestFixture.cs | 97 - .../LoadTableLayoutPanelTestFixture.cs | 99 - .../Designer/LoadTextBoxOnPanelTestFixture.cs | 85 - .../Test/Designer/LoadTextBoxTestFixture.cs | 114 - .../Test/Designer/LoadTimerTestFixture.cs | 78 - .../Test/Designer/LoadToolTipTestFixture.cs | 61 - .../Test/Designer/LoadTreeViewTestFixture.cs | 156 -- ...serControlWithDoublePropertyTestFixture.cs | 81 - .../Test/Designer/MergeFormTestFixture.cs | 131 -- ...ingInitializeComponentMethodTestFixture.cs | 143 -- ...LineAfterInitializeComponentTestFixture.cs | 115 - ...ctRootNamespacePassedToMergeTestFixture.cs | 141 -- .../Test/Designer/PythonBaseClassTests.cs | 86 - .../Test/Designer/PythonCodeBuilderTests.cs | 57 - .../Designer/PythonCodeDeserializerTests.cs | 123 - .../PythonControlFieldExpressionTests.cs | 293 --- ...PythonDesignerLoaderProviderTestFixture.cs | 57 - .../Designer/PythonGeneratorTestFixture.cs | 80 - .../PythonPropertyAssignmentToStringTests.cs | 132 -- .../RemoveMainMenuStripFromFormTestFixture.cs | 91 - .../TextBoxNotAddedToFormTestFixture.cs | 75 - .../Test/Designer/UnknownTypeTestFixture.cs | 94 - ...ressionOnLineWithSingleSpaceTestFixture.cs | 45 - ...sionWithImportOnPreviousLineTestFixture.cs | 46 - .../FindImportExpressionTestFixture.cs | 118 - .../FindSystemConsoleExpressionTestFixture.cs | 142 -- .../FromImportNamespaceExpressionTests.cs | 69 - .../FromSystemImportTestFixture.cs | 50 - .../ImportNamespaceExpressionTests.cs | 60 - .../IsImportExpressionTestFixture.cs | 92 - ...arseFromImportWithIdentifierTestFixture.cs | 55 - ...romImportWithoutImportedNameTestFixture.cs | 52 - .../ParseImportExpressionOnlyTestFixture.cs | 50 - ...mportSystemConsoleExpressionTestFixture.cs | 50 - .../ParseImportSystemExpressionTestFixture.cs | 50 - ...sePartialFromImportStatementTestFixture.cs | 134 -- ...ImportStatementWithTokenizerTestFixture.cs | 156 -- .../ParseSimpleImportExpressionTestFixture.cs | 69 - .../Test/Expressions/RemoveLastPartTests.cs | 61 - .../StringTextContentProviderTests.cs | 50 - .../Test/Gui/AppSettingsPanelTestFixture.cs | 214 -- .../Gui/CompilingOptionsPanelTestFixture.cs | 150 -- .../Test/Gui/DebugPythonCommandTests.cs | 73 - .../FormsDesignerDisplayBindingTestFixture.cs | 148 -- .../Test/Gui/PythonFormattingStrategyTests.cs | 334 --- .../Test/Gui/RunPythonCommandTests.cs | 91 - ...InvalidSourceSpanToErrorSinkTestFixture.cs | 45 - .../Parsing/ClassWithBaseClassTestFixture.cs | 63 - .../InvalidCastInPythonParserTestFixture.cs | 75 - .../Test/Parsing/InvalidClassTestFixture.cs | 64 - .../MethodWithParametersTestFixture.cs | 74 - ...ssingLastParameterFromMethodTestFixture.cs | 53 - ...ParseClassNestedInsideMethodTestFixture.cs | 66 - .../Parsing/ParseClassWithCtorTestFixture.cs | 105 - .../ParseClassWithMethodTestFixture.cs | 173 -- .../ParseFromMathImportAllTestFixture.cs | 63 - ...ParseFromMathImportCosAndTanTestFixture.cs | 73 - ...rseFromSysImportExitAsMyExitTestFixture.cs | 61 - .../ParseFromSysImportExitTestFixture.cs | 61 - ...seFromSysImportMissingImportTestFixture.cs | 61 - ...SysImportWithoutImportedNameTestFixture.cs | 61 - .../ParseImportMultipleModulesTestFixture.cs | 59 - .../Test/Parsing/ParseImportSysTestFixture.cs | 49 - .../Test/Parsing/ParseImportTestFixture.cs | 57 - .../ParseInvalidPythonCodeTestFixture.cs | 58 - .../ParseMethodsWithNoClassTestFixture.cs | 214 -- .../Parsing/ParseSingleClassTestFixture.cs | 101 - .../Test/Parsing/ParseTestClassTestFixture.cs | 63 - .../ParseTestClassWithBaseClassTestFixture.cs | 109 - .../Test/Parsing/ParserTestFixture.cs | 141 -- .../Parsing/PythonParserParseFieldTests.cs | 72 - .../Parsing/PythonParserParsePropertyTests.cs | 137 -- .../Test/PythonBinding.Tests.csproj | 528 ----- .../CreateNewPythonProjectTestFixture.cs | 131 -- .../ProjectBindingTestFixture.cs | 66 - .../PythonLanguageBindingTestFixture.cs | 55 - .../PythonLanguagePropertiesTests.cs | 41 - .../ImportModuleResolveResultTests.cs | 66 - .../InvalidResolveInputsTestFixture.cs | 65 - .../Test/Resolver/MemberNameTests.cs | 131 -- .../PythonLocalVariableAssignmentTests.cs | 48 - .../PythonLocalVariableResolverTests.cs | 134 -- .../Test/Resolver/PythonSelfResolverTests.cs | 64 - .../ResolveBuiltInRoundMethodTests.cs | 132 -- .../Test/Resolver/ResolveClassEventTests.cs | 97 - .../Test/Resolver/ResolveClassFieldTests.cs | 67 - .../Resolver/ResolveClassPropertyTests.cs | 113 - .../Resolver/ResolveConsoleWriteLineTests.cs | 73 - ...xitMethodFromSysImportExitAsMyExitTests.cs | 62 - ...eExitMethodFromSysImportExitTestFixture.cs | 75 - ...lveFooWindowsWithImportSystemAsFooTests.cs | 60 - .../Test/Resolver/ResolveFromImportTests.cs | 69 - ...hImportedMathModuleCompletionItemsTests.cs | 70 - .../ResolveFromSystemImportEverythingTests.cs | 71 - .../Resolver/ResolveImportsTestFixture.cs | 73 - .../ResolveLocalClassInstanceTests.cs | 195 -- .../ResolveLocalVariableMethodTests.cs | 71 - ...olveMemberWhenFieldHasNoReturnTypeTests.cs | 55 - .../ResolveMethodFromUnknownImportAllTests.cs | 52 - .../Resolver/ResolveMethodReturnValueTests.cs | 81 - ...solveMethodWhenFromImportIsUnknownTests.cs | 51 - .../ResolveMethodWhenImportIsUnknownTests.cs | 51 - ...esolveNullCtrlSpaceParseInfoTestFixture.cs | 42 - .../Resolver/ResolveRandomRandintTests.cs | 53 - .../Test/Resolver/ResolveSelfTests.cs | 130 -- .../ResolveSysModuleExitMethodTests.cs | 151 -- .../ResolveSysModuleImportedAsMySysTests.cs | 57 - .../Resolver/ResolveSysModuleTestFixture.cs | 72 - .../ResolveSysModuleUnknownMethodTests.cs | 51 - ...lveSystemConsoleOutsideClassTestFixture.cs | 47 - .../Resolver/ResolveSystemConsoleTests.cs | 120 - .../Test/Resolver/ResolveSystemImportTests.cs | 74 - .../ResolveSystemImportedAsMySystemTests.cs | 83 - .../Resolver/ResolveSystemNamespaceTests.cs | 81 - ...veSystemNamespaceWithMissingImportTests.cs | 59 - ...SystemWindowsFormsWithImportSystemTests.cs | 60 - ...solveSystemWindowsWithImportSystemTests.cs | 60 - ...solveSystemWithImportSystemWindowsTests.cs | 54 - .../ResolveTanMethodFromMathImportAllTests.cs | 78 - ...veTanMethodFromMathImportCosAndTanTests.cs | 75 - .../Test/Resolver/ResolveTestsBase.cs | 56 - ...romSystemWindowsFormsImportTextBoxTests.cs | 66 - ...romSystemWindowsFormsImportedAsFooTests.cs | 66 - ...temWindowsFormsImportedAsMyTextBoxTests.cs | 66 - .../Resolver/ResolveUnknownNamespaceTests.cs | 58 - ...lverContextDottedImportedNameMatchTests.cs | 50 - ...verContextGetModuleForImportedNameTests.cs | 62 - ...rNameImportedAsDifferentNameTestFixture.cs | 67 - ...textGetModulesThatImportEverythingTests.cs | 84 - .../Resolver/ResolverContextHasImportTests.cs | 80 - ...olverContextPartialNamespaceExistsTests.cs | 70 - ...extUnaliasImportedModuleNameTestFixture.cs | 56 - .../Python/PythonBinding/Test/Strings.resx | 123 - .../Python/PythonBinding/Test/TODO.txt | 106 - .../CreatePythonTestRunnerTestFixture.cs | 63 - .../Testing/PythonConsoleApplicationTests.cs | 120 - .../Testing/PythonStandardLibraryPathTests.cs | 93 - ...buggerRunsSelectedTestMethodTestFixture.cs | 170 -- .../PythonTestFrameworkIsTestClassTests.cs | 93 - .../PythonTestFrameworkIsTestMemberTests.cs | 83 - .../PythonTestFrameworkIsTestProjectTests.cs | 78 - .../PythonTestResultFailureTestFixture.cs | 101 - ...StackTraceLineNumberOverflowTestFixture.cs | 55 - ...PythonTestRunnerResponseFileTestFixture.cs | 193 -- ...RunnerRunsSelectedTestMethodTestFixture.cs | 247 -- .../Test/Utils/BrowseButtonInfo.cs | 41 - .../Test/Utils/BrowseFolderButtonInfo.cs | 41 - .../Utils/DerivedApplicationSettingsPanel.cs | 198 -- .../Utils/DerivedCompilingOptionsPanel.cs | 192 -- ...vedConvertProjectToPythonProjectCommand.cs | 129 - .../Test/Utils/DerivedPythonConsoleHost.cs | 71 - .../Utils/DerivedPythonDesignerGenerator.cs | 66 - ...erivedPythonFormsDesignerDisplayBinding.cs | 97 - .../Test/Utils/FakeCompletionItemProvider.cs | 39 - .../Test/Utils/FakeInsightWindow.cs | 102 - .../Test/Utils/PythonBindingAddInFile.cs | 50 - .../Utils/PythonCodeDomSerializerHelper.cs | 31 - .../Test/Utils/PythonCompletionItemsHelper.cs | 108 - .../Test/Utils/PythonComponentWalkerHelper.cs | 32 - .../Test/Utils/PythonMSBuildEngineHelper.cs | 48 - .../Test/Utils/PythonParserHelper.cs | 62 - .../Test/Utils/PythonResolverTestsHelper.cs | 88 - .../TestablePythonCodeCompletionBinding.cs | 70 - ...establePythonCodeCompletionItemProvider.cs | 32 - .../Tests/PythonCompletionItemsHelperTests.cs | 162 -- .../Utils/Tests/PythonParserHelperTests.cs | 65 - .../Python/RequiredLibraries/Chiron.exe | Bin 85504 -> 0 bytes .../RequiredLibraries/Chiron.exe.Config | 180 -- .../RequiredLibraries/DLLs/IronPython.Wpf.dll | Bin 7168 -> 0 bytes .../RequiredLibraries/IronPython.Modules.dll | Bin 732160 -> 0 bytes .../Python/RequiredLibraries/IronPython.dll | Bin 1810944 -> 0 bytes .../Python/RequiredLibraries/License.Rtf | 245 -- .../RequiredLibraries/Microsoft.Dynamic.dll | Bin 1044480 -> 0 bytes .../Microsoft.Scripting.Metadata.dll | Bin 93184 -> 0 bytes .../RequiredLibraries/Microsoft.Scripting.dll | Bin 144384 -> 0 bytes .../Python/RequiredLibraries/ipy.exe | Bin 18432 -> 0 bytes .../Python/RequiredLibraries/ipy.exe.config | 22 - .../Python/RequiredLibraries/ipyw.exe | Bin 17920 -> 0 bytes .../Python/RequiredLibraries/ipyw.exe.config | 22 - src/Setup/Files.wxs | 109 - src/Setup/Setup.wxs | 31 - 538 files changed, 49604 deletions(-) delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/CodeDomVisitor.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/Indentation.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/MainForm.Designer.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/MainForm.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/MainForm.resx delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/NRefactoryAstVisitor.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/Program.cs delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/PyWalker.csproj delete mode 100644 src/AddIns/BackendBindings/Python/PyWalker/ResolveWalker.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Python.Build.Tasks.csproj delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/SharpDevelop.Build.Python.targets delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/IPythonCompiler.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerException.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerTask.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/ResourceFile.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/Resources.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileResourcesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileSingleSourceFileTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DifferentTargetTypesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DummyPythonCompilerTask.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IOErrorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IncludeDebugInfoTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/LogicalResourceNamesTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MainEntryPointTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MissingMainEntryPointTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MockPythonCompiler.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PlatformTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/Python.Build.Tasks.Tests.csproj delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PythonCompilerTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeReferenceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeResourceFileTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorFileNameWithDotCharTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorNullFileNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorUnknownFileNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding.sln delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/__future__.py delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/runpy.py delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/site.py delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/ApplicationSettingsPanel.xfrm delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/CompilingOptionsPanel.xfrm delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/Python.xshd delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ApplicationSettingsPanel.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CompilingOptionsPanel.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConstructorInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertProjectToPythonProjectCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertToPythonMenuCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/MemberName.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/NRefactoryToPythonConverter.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonBuiltInModuleMemberName.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClass.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassFields.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassMembers.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeBuilder.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionItemProvider.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDeserializer.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilationUnit.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompletionItemList.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalkerException.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleHost.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsolePad.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConstructor.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoader.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoaderProvider.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpression.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpressionFinder.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormsDesignerDisplayBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFromImport.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImport.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportCompletion.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpression.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpressionContext.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportModuleResolveResult.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonInsightWindowHandler.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageProperties.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLineIndenter.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableAssignment.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMemberResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethod.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodDefinition.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodGroupResolveResult.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodOrClassBodyRegion.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodReturnValueResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModule.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItems.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItemsFactory.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonNamespaceResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonParser.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonProject.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonProjectBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonProperty.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyAssignment.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonPropertyValueAssignment.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonResolverContext.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonSelfResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardLibraryPath.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleMethodResolveResult.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleMethodResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleResolveResult.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleResolver.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleType.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModules.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestDebugger.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestFramework.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestResult.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunner.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerApplication.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerContext.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerResponseFile.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonUsingScope.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonWorkbench.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunDebugPythonCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/SendLineToPythonConsoleCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/SendSelectedTextToPythonConsoleCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/StringTextContentProvider.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/SysModuleCompletionItems.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/ConsoleProject.xpt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/Empty.xft delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/EmptyClass.xft delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/EmptyForm.xft delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/EmptyUserControl.xft delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/FormsProject.xpt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/LibraryProject.xpt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/SilverlightApplication.xpt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFApplication.xpt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFWindow.xft delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingFromImportCompletionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromDateTimeImportCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportDotNetNamespaceCompletionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportPythonModuleCompletionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCosMethodCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromSysLibraryImportCompletionItemsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetMethodsFromSysLibraryTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetPythonModulesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetTypeForPythonModuleTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportEmptyNamespaceCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportResolveResultReturnsNoCompletionItemsIfExpressionHasIdentifierTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportSubNamespaceCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/MathModuleMembersInPythonContextTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionBindingTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionItemProviderTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCompletionItemListTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonImportExpressionContextTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonInsightWindowHandlerTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonSocketLibraryDocumentationTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/SysModuleMembersInPythonContextTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/BuiltinCodeCompletionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AddHandlerConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayCastConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassReferenceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BinaryOperatorConversionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BitShiftConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BooleanConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassConstructorConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassDestructorConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassFieldReferenceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertCSharpToPythonMenuCommandTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertVBNetToPythonMenuCommandTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConverterSupportedLanguageTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForNextConversionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenericListConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IncrementAndDecrementConversionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerMethodParameterTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodCallInConstructorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodParameterConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultiLineCommentTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedClassConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NullConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectCreationTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetSetStatementsTestfixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetterTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithSetterTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticClassReferenceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticMethodConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SwitchStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TypeofConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UnaryOperatorConversionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UsingStatementConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBClassConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBExitConversionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBStringConcatTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/WhileLoopConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/App.ico delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/AssignmentAfterFormClassTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CursorTypeResolutionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeConstraintArrayTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeStringArrayTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializerConstructorStringArrayTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCursorFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDataSetTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventLogTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormColorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormLocationTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormPaddingTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormResourcesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImageListResourcesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImeModeFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewItemTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewWithImageListTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripItemsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateSimpleFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTimerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateToolTipFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTreeViewTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFormDesignableTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAnchorStylesFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadColorFromArgbTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadCursorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadEventHandlerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFileSystemWatcherTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFontTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormTestFixtureBase.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithButtonFollowedByTimerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithSysPathAppendStatementTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadListViewFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMenuStripFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMonthCalendarTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTimerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadToolTipTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MergeFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/NoNewLineAfterInitializeComponentTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonBaseClassTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeBuilderTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeDeserializerTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonControlFieldExpressionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderProviderTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/UnknownTypeTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionOnLineWithSingleSpaceTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionWithImportOnPreviousLineTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindImportExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindSystemConsoleExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromImportNamespaceExpressionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromSystemImportTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ImportNamespaceExpressionTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/IsImportExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithIdentifierTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithoutImportedNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportExpressionOnlyTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemConsoleExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementWithTokenizerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseSimpleImportExpressionTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/RemoveLastPartTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/StringTextContentProviderTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonFormattingStrategyTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/AddInvalidSourceSpanToErrorSinkTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidCastInPythonParserTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MethodWithParametersTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MissingLastParameterFromMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportAllTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportCosAndTanTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitAsMyExitTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportMissingImportTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportWithoutImportedNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportMultipleModulesTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportSysTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseInvalidPythonCodeTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseSingleClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParseFieldTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguageBindingTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ImportModuleResolveResultTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/InvalidResolveInputsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/MemberNameTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableAssignmentTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableResolverTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonSelfResolverTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveBuiltInRoundMethodTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassEventTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassFieldTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassPropertyTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitAsMyExitTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooWindowsWithImportSystemAsFooTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromImportTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromMathImportedMathModuleCompletionItemsTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromSystemImportEverythingTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveImportsTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalVariableMethodTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMemberWhenFieldHasNoReturnTypeTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodFromUnknownImportAllTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodReturnValueTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenFromImportIsUnknownTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenImportIsUnknownTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveNullCtrlSpaceParseInfoTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveRandomRandintTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSelfTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleExitMethodTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleImportedAsMySysTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleUnknownMethodTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleOutsideClassTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportedAsMySystemTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsFormsWithImportSystemTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsWithImportSystemTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWithImportSystemWindowsTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportAllTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportCosAndTanTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTestsBase.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsFooTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveUnknownNamespaceTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextDottedImportedNameMatchTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForImportedNameTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForNameImportedAsDifferentNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModulesThatImportEverythingTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextHasImportTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextPartialNamespaceExistsTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextUnaliasImportedModuleNameTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Strings.resx delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/TODO.txt delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMemberTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseButtonInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseFolderButtonInfo.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedApplicationSettingsPanel.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedCompilingOptionsPanel.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedConvertProjectToPythonProjectCommand.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonConsoleHost.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerGenerator.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonFormsDesignerDisplayBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeCompletionItemProvider.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeInsightWindow.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCodeDomSerializerHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCompletionItemsHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonComponentWalkerHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonParserHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonResolverTestsHelper.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionBinding.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionItemProvider.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonCompletionItemsHelperTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonParserHelperTests.cs delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe.Config delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/DLLs/IronPython.Wpf.dll delete mode 100755 src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.Modules.dll delete mode 100755 src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.dll delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/License.Rtf delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Dynamic.dll delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.Metadata.dll delete mode 100755 src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.dll delete mode 100755 src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe.config delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe delete mode 100644 src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe.config diff --git a/src/AddIns/BackendBindings/Python/PyWalker/AssemblyInfo.cs b/src/AddIns/BackendBindings/Python/PyWalker/AssemblyInfo.cs deleted file mode 100644 index c252cee703e..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/AssemblyInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -#region Using directives - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -#endregion - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PyWalker")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PyWalker")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("0.1")] diff --git a/src/AddIns/BackendBindings/Python/PyWalker/CodeDomVisitor.cs b/src/AddIns/BackendBindings/Python/PyWalker/CodeDomVisitor.cs deleted file mode 100644 index 378ba467c9d..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/CodeDomVisitor.cs +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.CodeDom; -using System.Collections; -using System.Reflection; -using System.Text; - -namespace PyWalker -{ - /// - /// Visits the code dom generated by PythonProvider. - /// - public class CodeDomVisitor - { - IOutputWriter writer; - - public CodeDomVisitor(IOutputWriter writer) - { - this.writer = writer; - } - - public void Visit(CodeCompileUnit unit) - { - VisitCodeCompileUnit(unit); - } - - void VisitCodeCompileUnit(CodeCompileUnit unit) - { - WriteLine("VisitCodeCompileUnit"); - - foreach (CodeNamespace ns in unit.Namespaces) { - VisitCodeNamespace(ns); - } - } - - void VisitCodeNamespace(CodeNamespace ns) - { - WriteLine("VisitCodeNamespace: " + ns.Name); - - foreach (CodeNamespaceImport import in ns.Imports) { - VisitCodeNamespaceImport(import); - } - - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - foreach (CodeTypeDeclaration type in ns.Types) { - VisitCodeTypeDeclaration(type); - } - } - } - - void VisitCodeNamespaceImport(CodeNamespaceImport import) - { - WriteLine("VisitCodeNamespaceImport: " + import.Namespace); - } - - void VisitCodeTypeDeclaration(CodeTypeDeclaration type) - { - WriteLine("VisitCodeTypeDeclaration: " + type.Name); - WriteLine(MemberAttributesToString(type.Attributes)); - - WriteLine("UserData: " + UserDataKeysToString(type.UserData)); - - WriteLine("VisitCodeTypeDeclaration: Custom attributes"); - foreach (CodeAttributeDeclaration attributeDeclaration in type.CustomAttributes) { - VisitCodeAttributeDeclaration(attributeDeclaration); - } - - WriteLine("TypeAttributes: " + TypeAttributesToString(type.TypeAttributes)); - - foreach (CodeTypeParameter parameter in type.TypeParameters) { - VisitCodeTypeParameter(parameter); - } - - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - foreach (CodeTypeMember member in type.Members) { - CodeMemberMethod method = member as CodeMemberMethod; - CodeMemberField field = member as CodeMemberField; - if (method != null) { - VisitCodeMemberMethod(method); - } else if (field != null) { - VisitCodeMemberField(field); - } else { - WriteLine("Unhandled type member: " + member.GetType().Name); - } - } - } - } - - void VisitCodeTypeParameter(CodeTypeParameter parameter) - { - WriteLine("VisitCodeTypeParameter: " + parameter.Name); - } - - string TypeAttributesToString(TypeAttributes typeAttributes) - { - return typeAttributes.ToString(); - } - - void VisitCodeAttributeDeclaration(CodeAttributeDeclaration attributeDeclaration) - { - WriteLine("VisitCodeAttributeDeclaration: " + attributeDeclaration.Name); - } - - void VisitCodeMemberMethod(CodeMemberMethod method) - { - WriteLine("VisitCodeMemberMethod: " + method.Name); - WriteLine(MemberAttributesToString(method.Attributes)); - - WriteLine("UserData: " + UserDataKeysToString(method.UserData)); - foreach (CodeParameterDeclarationExpression param in method.Parameters) { - VisitCodeParameterDeclarationExpression(param); - } - - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - WriteLine("Method.Statements.Count: " + method.Statements.Count); - foreach (CodeStatement statement in method.Statements) { - VisitCodeStatement(statement); - } - } - } - - void VisitCodeStatement(CodeStatement statement) - { - WriteLine("VisitCodeStatement: " + statement.GetType().Name); - CodeVariableDeclarationStatement codeVariableDeclarationStatement = statement as CodeVariableDeclarationStatement; - CodeAssignStatement codeAssignStatement = statement as CodeAssignStatement; - CodeConditionStatement codeConditionStatement = statement as CodeConditionStatement; - CodeIterationStatement codeIterationStatement = statement as CodeIterationStatement; - CodeExpressionStatement codeExpressionStatement = statement as CodeExpressionStatement; - CodeTryCatchFinallyStatement codeTryCatchFinallyStatement = statement as CodeTryCatchFinallyStatement; - if (codeVariableDeclarationStatement != null) { - VisitCodeVariableDeclarationStatement(codeVariableDeclarationStatement); - } else if (codeAssignStatement != null) { - VisitCodeAssignStatement(codeAssignStatement); - } else if (codeConditionStatement != null) { - VisitCodeConditionStatement(codeConditionStatement); - } else if (codeIterationStatement != null) { - VisitCodeIterationStatement(codeIterationStatement); - } else if (codeExpressionStatement != null) { - VisitCodeExpressionStatement(codeExpressionStatement); - } else if (codeTryCatchFinallyStatement != null) { - VisitCodeTryCatchFinallyStatement(codeTryCatchFinallyStatement); - } else { - WriteLine("Unhandled statement: " + statement.GetType().Name); - } - } - - void VisitCodeAssignStatement(CodeAssignStatement assignStatement) - { - WriteLine("VisitCodeAssignmentStatement"); - WriteLine("Left follows"); - VisitCodeExpression(assignStatement.Left); - WriteLine("Right follows"); - VisitCodeExpression(assignStatement.Right); - } - - void VisitCodeParameterDeclarationExpression(CodeParameterDeclarationExpression expression) - { - WriteLine("VisitCodeParameterDeclarationExpression: " + expression.Name); - WriteLine("BaseType: " + expression.Type.BaseType); - } - - void VisitCodeVariableDeclarationStatement(CodeVariableDeclarationStatement codeVariableDeclarationStatement) - { - WriteLine("VisitCodeVariableDeclarationStatement: " + codeVariableDeclarationStatement.Name); - WriteLine("BaseType: " + codeVariableDeclarationStatement.Type.BaseType); - WriteLine("UserData: " + UserDataKeysToString(codeVariableDeclarationStatement.UserData)); - WriteLine("InitExpression follows"); - VisitCodeExpression(codeVariableDeclarationStatement.InitExpression); - } - - void VisitCodeExpression(CodeExpression expression) - { - if (expression != null) { - WriteLine("VisitCodeExpression: " + expression.GetType().Name); - CodePrimitiveExpression primitiveExpression = expression as CodePrimitiveExpression; - CodeFieldReferenceExpression fieldReferenceExpression = expression as CodeFieldReferenceExpression; - CodeThisReferenceExpression thisReferenceExpression = expression as CodeThisReferenceExpression; - CodeObjectCreateExpression createExpression = expression as CodeObjectCreateExpression; - CodeBinaryOperatorExpression binaryExpression = expression as CodeBinaryOperatorExpression; - CodeMethodReferenceExpression methodReferenceExpression = expression as CodeMethodReferenceExpression; - CodeMethodInvokeExpression methodInvokeExpression = expression as CodeMethodInvokeExpression; - CodeVariableReferenceExpression variableReferenceExpression = expression as CodeVariableReferenceExpression; - if (primitiveExpression != null) { - VisitCodePrimitiveExpression(primitiveExpression); - } else if (fieldReferenceExpression != null) { - VisitCodeFieldReferenceExpression(fieldReferenceExpression); - } else if (thisReferenceExpression != null) { - VisitCodeThisReferenceExpression(thisReferenceExpression); - } else if (createExpression != null) { - VisitObjectCreateExpression(createExpression); - } else if (binaryExpression != null) { - VisitCodeBinaryOperatorExpression(binaryExpression); - } else if (methodReferenceExpression != null) { - VisitCodeMethodReferenceExpression(methodReferenceExpression); - } else if (methodInvokeExpression != null) { - VisitCodeMethodInvokeExpression(methodInvokeExpression); - } else if (variableReferenceExpression != null) { - VisitCodeVariableReferenceExpression(variableReferenceExpression); - } - } else { - WriteLine("VisitCodeExpression: Null"); - } - } - - void VisitCodePrimitiveExpression(CodePrimitiveExpression expression) - { - WriteLine("VisitCodePrimitiveExpression: " + expression.Value); - } - - void VisitCodeFieldReferenceExpression(CodeFieldReferenceExpression expression) - { - WriteLine("VisitFieldReferenceExpression: " + expression.FieldName); - WriteLine("Target object follows"); - VisitCodeExpression(expression.TargetObject); - } - - void VisitCodeThisReferenceExpression(CodeThisReferenceExpression expression) - { - WriteLine("VisitCodeThisReferenceExpression"); - WriteLine("UserData: " + UserDataKeysToString(expression.UserData)); - } - - void VisitCodeMemberField(CodeMemberField field) - { - WriteLine("VisitCodeMemberField: " + field.Name); - WriteLine("UserData: " + UserDataKeysToString(field.UserData)); - WriteLine(MemberAttributesToString(field.Attributes)); - WriteLine("InitExpression follows"); - VisitCodeExpression(field.InitExpression); - } - - void VisitObjectCreateExpression(CodeObjectCreateExpression createExpression) - { - WriteLine("VisitObjectCreateExpression: Type: " + createExpression.CreateType.BaseType); - foreach (CodeExpression expression in createExpression.Parameters) { - VisitCodeExpression(expression); - } - } - - void VisitCodeConditionStatement(CodeConditionStatement conditionStatement) - { - WriteLine("VisitCodeConditionStatement"); - - WriteLine("Condition follows"); - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(conditionStatement.Condition); - } - - WriteLine("TrueStatements follow"); - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - foreach (CodeStatement statement in conditionStatement.TrueStatements) { - VisitCodeStatement(statement); - } - } - - WriteLine("FalseStatements follow"); - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - foreach (CodeStatement statement in conditionStatement.FalseStatements) { - VisitCodeStatement(statement); - } - } - } - - void VisitCodeBinaryOperatorExpression(CodeBinaryOperatorExpression expression) - { - WriteLine("VisitBinaryOperatorExpression: " + expression.Operator); - - WriteLine("Left follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(expression.Left); - } - - WriteLine("Right follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(expression.Right); - } - } - - void VisitCodeIterationStatement(CodeIterationStatement statement) - { - WriteLine("VisitIterationStatement"); - - WriteLine("Init statement follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeStatement(statement.InitStatement); - } - - WriteLine("Increment statement follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeStatement(statement.IncrementStatement); - } - - WriteLine("Test expression follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(statement.TestExpression); - } - - WriteLine("Statements follow"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - foreach (CodeStatement currentStatement in statement.Statements) { - VisitCodeStatement(currentStatement); - } - } - } - - void VisitCodeMethodInvokeExpression(CodeMethodInvokeExpression expression) - { - WriteLine("VisitCodeMethodInvokeExpression"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(expression.Method); - } - } - - void VisitCodeMethodReferenceExpression(CodeMethodReferenceExpression expression) - { - WriteLine("VisitCodeMethodReferenceExpression: " + expression.MethodName); - WriteLine("Target Object follows"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(expression.TargetObject); - } - } - - void VisitCodeExpressionStatement(CodeExpressionStatement statement) - { - WriteLine("VisitCodeExpressionStatement"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - VisitCodeExpression(statement.Expression); - } - } - - void VisitCodeVariableReferenceExpression(CodeVariableReferenceExpression expression) - { - WriteLine("VisitCodeVariableReferenceExpression: " + expression.VariableName); - } - - void VisitCodeTryCatchFinallyStatement(CodeTryCatchFinallyStatement tryStatement) - { - WriteLine("VisitCodeTryCatchFinallyStatement"); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - WriteLine("Try statements follow: Count: " + tryStatement.TryStatements.Count); - foreach (CodeStatement statement in tryStatement.TryStatements) { - VisitCodeStatement(statement); - } - - WriteLine("Catch clauses follow: Count: " + tryStatement.CatchClauses.Count); - foreach (CodeCatchClause catchClause in tryStatement.CatchClauses) { - VisitCodeCatchClause(catchClause); - } - - WriteLine("Finally statements follow: Count: " + tryStatement.FinallyStatements); - foreach (CodeStatement statement in tryStatement.FinallyStatements) { - VisitCodeStatement(statement); - } - } - } - - void VisitCodeCatchClause(CodeCatchClause catchClause) - { - WriteLine("VisitCodeCatchClause"); - WriteLine("Exception caught: " + catchClause.CatchExceptionType.BaseType); - WriteLine("Exception variable: " + catchClause.LocalName); - - WriteLine("Catch statements follow: Count: " + catchClause.Statements.Count); - using (IDisposable currentLevel = Indentation.IncrementLevel()) { - foreach (CodeStatement statement in catchClause.Statements) { - VisitCodeStatement(statement); - } - } - } - - string MemberAttributesToString(MemberAttributes attributes) - { - StringBuilder s = new StringBuilder(); - s.Append("Attributes: "); - - if ((attributes & MemberAttributes.Public) == MemberAttributes.Public) { - s.Append("Public, "); - } - if ((attributes & MemberAttributes.Private) == MemberAttributes.Private) { - s.Append("Private, "); - } - if ((attributes & MemberAttributes.Family) == MemberAttributes.Family) { - s.Append("Family, "); - } - if ((attributes & MemberAttributes.Final) == MemberAttributes.Final) { - s.Append("Final, "); - } - - return s.ToString(); - } - - string UserDataKeysToString(IDictionary userData) - { - StringBuilder s = new StringBuilder(); - ICollection keys = userData.Keys; - foreach (object o in keys) { - string name = o as string; - if (name != null) { - s.Append(name); - s.Append(", "); - } - } - return s.ToString(); - } - - /// - /// Writes a line and indents it to the current level. - /// - void WriteLine(string s) - { - writer.WriteLine(GetIndent() + s); - } - - string GetIndent() - { - StringBuilder indent = new StringBuilder(); - for (int i = 0; i < Indentation.CurrentLevel; ++i) { - indent.Append('\t'); - } - return indent.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/Indentation.cs b/src/AddIns/BackendBindings/Python/PyWalker/Indentation.cs deleted file mode 100644 index 988d9d63c95..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/Indentation.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace PyWalker -{ - class Indentation : IDisposable - { - static int currentLevel; - - public static int CurrentLevel { - get { return currentLevel; } - } - - Indentation() - { - currentLevel++; - } - - public void Dispose() - { - currentLevel--; - } - - public static IDisposable IncrementLevel() - { - return new Indentation(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.Designer.cs b/src/AddIns/BackendBindings/Python/PyWalker/MainForm.Designer.cs deleted file mode 100644 index c0eedae1d84..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.Designer.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -namespace PyWalker -{ - partial class MainForm - { - /// - /// Designer variable used to keep track of non-visual components. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Disposes resources used by the form. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) { - if (components != null) { - components.Dispose(); - } - } - base.Dispose(disposing); - } - - /// - /// This method is required for Windows Forms designer support. - /// Do not change the method contents inside the source code editor. The Forms designer might - /// not be able to load this method if it was changed manually. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.codeTextBox = new System.Windows.Forms.RichTextBox(); - this.runCSharpNRefactoryVisitor = new System.Windows.Forms.Button(); - this.runNRefactoryCSharpCodeDomVisitor = new System.Windows.Forms.Button(); - this.runCSharpToPythonButton = new System.Windows.Forms.Button(); - this.runRoundTripButton = new System.Windows.Forms.Button(); - this.clearButton = new System.Windows.Forms.Button(); - this.runAstWalkerButton = new System.Windows.Forms.Button(); - this.walkerOutputTextBox = new System.Windows.Forms.RichTextBox(); - this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer - // - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.Location = new System.Drawing.Point(0, 0); - this.splitContainer.Name = "splitContainer"; - this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.Controls.Add(this.codeTextBox); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this.runCSharpNRefactoryVisitor); - this.splitContainer.Panel2.Controls.Add(this.runNRefactoryCSharpCodeDomVisitor); - this.splitContainer.Panel2.Controls.Add(this.runCSharpToPythonButton); - this.splitContainer.Panel2.Controls.Add(this.runRoundTripButton); - this.splitContainer.Panel2.Controls.Add(this.clearButton); - this.splitContainer.Panel2.Controls.Add(this.runAstWalkerButton); - this.splitContainer.Panel2.Controls.Add(this.walkerOutputTextBox); - this.splitContainer.Size = new System.Drawing.Size(515, 386); - this.splitContainer.SplitterDistance = 138; - this.splitContainer.TabIndex = 0; - // - // codeTextBox - // - this.codeTextBox.AcceptsTab = true; - this.codeTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.codeTextBox.Location = new System.Drawing.Point(0, 0); - this.codeTextBox.Name = "codeTextBox"; - this.codeTextBox.Size = new System.Drawing.Size(515, 138); - this.codeTextBox.TabIndex = 0; - this.codeTextBox.Text = ""; - this.codeTextBox.WordWrap = false; - // - // runCSharpNRefactoryVisitor - // - this.runCSharpNRefactoryVisitor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.runCSharpNRefactoryVisitor.Location = new System.Drawing.Point(261, 218); - this.runCSharpNRefactoryVisitor.Name = "runCSharpNRefactoryVisitor"; - this.runCSharpNRefactoryVisitor.Size = new System.Drawing.Size(117, 23); - this.runCSharpNRefactoryVisitor.TabIndex = 8; - this.runCSharpNRefactoryVisitor.Text = "Visit C# AST"; - this.toolTip.SetToolTip(this.runCSharpNRefactoryVisitor, "Walks the NRefactory AST generated from the C# code."); - this.runCSharpNRefactoryVisitor.UseVisualStyleBackColor = true; - this.runCSharpNRefactoryVisitor.Click += new System.EventHandler(this.RunCSharpNRefactoryVisitorClick); - // - // runNRefactoryCSharpCodeDomVisitor - // - this.runNRefactoryCSharpCodeDomVisitor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.runNRefactoryCSharpCodeDomVisitor.Location = new System.Drawing.Point(384, 218); - this.runNRefactoryCSharpCodeDomVisitor.Name = "runNRefactoryCSharpCodeDomVisitor"; - this.runNRefactoryCSharpCodeDomVisitor.Size = new System.Drawing.Size(127, 23); - this.runNRefactoryCSharpCodeDomVisitor.TabIndex = 7; - this.runNRefactoryCSharpCodeDomVisitor.Text = "Visit C# Code DOM"; - this.toolTip.SetToolTip(this.runNRefactoryCSharpCodeDomVisitor, "Visits the code dom generated from the C# code by the NRefactory code dom visitor" + - "."); - this.runNRefactoryCSharpCodeDomVisitor.UseVisualStyleBackColor = true; - this.runNRefactoryCSharpCodeDomVisitor.Click += new System.EventHandler(this.RunNRefactoryCSharpCodeDomVisitorClick); - // - // runCSharpToPythonButton - // - this.runCSharpToPythonButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.runCSharpToPythonButton.Location = new System.Drawing.Point(261, 192); - this.runCSharpToPythonButton.Name = "runCSharpToPythonButton"; - this.runCSharpToPythonButton.Size = new System.Drawing.Size(117, 23); - this.runCSharpToPythonButton.TabIndex = 6; - this.runCSharpToPythonButton.Text = "C# to Python"; - this.toolTip.SetToolTip(this.runCSharpToPythonButton, "Takes the code dom generated from the NRefactory parser and converts it to python" + - " using the python generator."); - this.runCSharpToPythonButton.UseVisualStyleBackColor = true; - this.runCSharpToPythonButton.Click += new System.EventHandler(this.RunCSharpToPythonClick); - // - // runRoundTripButton - // - this.runRoundTripButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.runRoundTripButton.Location = new System.Drawing.Point(138, 191); - this.runRoundTripButton.Name = "runRoundTripButton"; - this.runRoundTripButton.Size = new System.Drawing.Size(117, 23); - this.runRoundTripButton.TabIndex = 4; - this.runRoundTripButton.Text = "Round Trip"; - this.toolTip.SetToolTip(this.runRoundTripButton, "Generates a code dom from the python code and then generates python code from the" + - " code dom."); - this.runRoundTripButton.UseVisualStyleBackColor = true; - this.runRoundTripButton.Click += new System.EventHandler(this.RunRoundTripButtonClick); - // - // clearButton - // - this.clearButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.clearButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.clearButton.Location = new System.Drawing.Point(138, 218); - this.clearButton.Name = "clearButton"; - this.clearButton.Size = new System.Drawing.Size(117, 23); - this.clearButton.TabIndex = 2; - this.clearButton.Text = "Clear"; - this.clearButton.UseVisualStyleBackColor = true; - this.clearButton.Click += new System.EventHandler(this.ClearButtonClick); - // - // runAstWalkerButton - // - this.runAstWalkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.runAstWalkerButton.Location = new System.Drawing.Point(384, 191); - this.runAstWalkerButton.Name = "runAstWalkerButton"; - this.runAstWalkerButton.Size = new System.Drawing.Size(127, 23); - this.runAstWalkerButton.TabIndex = 1; - this.runAstWalkerButton.Text = "Visit AST"; - this.toolTip.SetToolTip(this.runAstWalkerButton, "Walks the python AST generated from the python code."); - this.runAstWalkerButton.UseVisualStyleBackColor = true; - this.runAstWalkerButton.Click += new System.EventHandler(this.RunAstWalkerButtonClick); - // - // walkerOutputTextBox - // - this.walkerOutputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.walkerOutputTextBox.Location = new System.Drawing.Point(0, 2); - this.walkerOutputTextBox.Name = "walkerOutputTextBox"; - this.walkerOutputTextBox.Size = new System.Drawing.Size(515, 184); - this.walkerOutputTextBox.TabIndex = 0; - this.walkerOutputTextBox.Text = ""; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(515, 386); - this.Controls.Add(this.splitContainer); - this.Name = "MainForm"; - this.Text = "PyWalker"; - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - this.splitContainer.ResumeLayout(false); - this.ResumeLayout(false); - } - private System.Windows.Forms.Button runCSharpNRefactoryVisitor; - private System.Windows.Forms.Button runNRefactoryCSharpCodeDomVisitor; - private System.Windows.Forms.Button runCSharpToPythonButton; - private System.Windows.Forms.ToolTip toolTip; - private System.Windows.Forms.Button runRoundTripButton; - private System.Windows.Forms.Button clearButton; - private System.Windows.Forms.Button runAstWalkerButton; - private System.Windows.Forms.RichTextBox walkerOutputTextBox; - private System.Windows.Forms.RichTextBox codeTextBox; - private System.Windows.Forms.SplitContainer splitContainer; - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.cs b/src/AddIns/BackendBindings/Python/PyWalker/MainForm.cs deleted file mode 100644 index c532a2be29d..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.CodeDom; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython; -using IronPython.Compiler; -using IronPython.Compiler.Ast; -using IronPython.Runtime; -using Microsoft.CSharp; -using Microsoft.Scripting; -using Microsoft.Scripting.Runtime; -using NRefactory = ICSharpCode.NRefactory; - -namespace PyWalker -{ - public partial class MainForm : Form, IOutputWriter - { - public MainForm() - { - InitializeComponent(); - } - - public void WriteLine(string s) - { - walkerOutputTextBox.Text += String.Concat(s, "\r\n"); - } - - void RunAstWalkerButtonClick(object sender, EventArgs e) - { - try { - IronPython.Hosting.Python.CreateEngine(); - Clear(); - PythonCompilerSink sink = new PythonCompilerSink(); - SourceUnit source = DefaultContext.DefaultPythonContext.CreateFileUnit(@"D:\Temp.py", codeTextBox.Text); - CompilerContext context = new CompilerContext(source, new PythonCompilerOptions(), sink); - Parser parser = Parser.CreateParser(context, new PythonOptions()); - PythonAst ast = parser.ParseFile(false); - if (sink.Errors.Count == 0) { - ResolveWalker walker = new ResolveWalker(this); - ast.Walk(walker); - } else { - walkerOutputTextBox.Text += "\r\n"; - foreach (PythonCompilerError error in sink.Errors) { - walkerOutputTextBox.Text += error.ToString() + "\r\n"; - } - } - } catch (Exception ex) { - walkerOutputTextBox.Text = ex.ToString(); - } - } - - void ClearButtonClick(object sender, EventArgs e) - { - Clear(); - } - - void Clear() - { - walkerOutputTextBox.Text = String.Empty; - } - - /// - /// Round trips the Python code through the code DOM and back - /// to source code. - /// - void RunRoundTripButtonClick(object sender, EventArgs e) - { - try { - Clear(); -// PythonProvider provider = new PythonProvider(); -// CodeCompileUnit unit = provider.Parse(new StringReader(codeTextBox.Text)); -// StringWriter writer = new StringWriter(); -// CodeGeneratorOptions options = new CodeGeneratorOptions(); -// options.BlankLinesBetweenMembers = false; -// options.IndentString = "\t"; -// provider.GenerateCodeFromCompileUnit(unit, writer, options); -// -// walkerOutputTextBox.Text = writer.ToString(); - } catch (Exception ex) { - walkerOutputTextBox.Text = ex.ToString(); - } - } - - /// - /// Converts the C# code to a code dom using the NRefactory - /// library and then visits the code dom. - /// - void RunCSharpToPythonClick(object sender, EventArgs e) - { - try { - Clear(); - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(NRefactory.SupportedLanguage.CSharp); - walkerOutputTextBox.Text = converter.Convert(codeTextBox.Text); - } catch (Exception ex) { - walkerOutputTextBox.Text = ex.ToString(); - } - } - - /// - /// Converts C# to python using the code dom generated by the - /// NRefactory parser. - /// - void RunNRefactoryCSharpCodeDomVisitorClick(object sender, EventArgs e) - { - try { - Clear(); - using (NRefactory.IParser parser = NRefactory.ParserFactory.CreateParser(NRefactory.SupportedLanguage.CSharp, new StringReader(codeTextBox.Text))) { - parser.ParseMethodBodies = false; - parser.Parse(); - NRefactory.Visitors.CodeDomVisitor visitor = new NRefactory.Visitors.CodeDomVisitor(); - visitor.VisitCompilationUnit(parser.CompilationUnit, null); - CodeDomVisitor codeDomVisitor = new CodeDomVisitor(this); - codeDomVisitor.Visit(visitor.codeCompileUnit); - } - } catch (Exception ex) { - walkerOutputTextBox.Text = ex.ToString(); - } - } - - void RunCSharpNRefactoryVisitorClick(object sender, EventArgs e) - { - try { - Clear(); - using (NRefactory.IParser parser = NRefactory.ParserFactory.CreateParser(NRefactory.SupportedLanguage.CSharp, new StringReader(codeTextBox.Text))) { - parser.ParseMethodBodies = false; - parser.Parse(); - NRefactoryAstVisitor visitor = new NRefactoryAstVisitor(this); - visitor.VisitCompilationUnit(parser.CompilationUnit, null); - } - } catch (Exception ex) { - walkerOutputTextBox.Text = ex.ToString(); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.resx b/src/AddIns/BackendBindings/Python/PyWalker/MainForm.resx deleted file mode 100644 index 5cea0f6fc45..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/MainForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PyWalker/NRefactoryAstVisitor.cs b/src/AddIns/BackendBindings/Python/PyWalker/NRefactoryAstVisitor.cs deleted file mode 100644 index 4bcc9914061..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/NRefactoryAstVisitor.cs +++ /dev/null @@ -1,678 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using ICSharpCode.NRefactory.Ast; -using ICSharpCode.NRefactory.Visitors; - -namespace PyWalker -{ - public class NRefactoryAstVisitor : AbstractAstVisitor - { - IOutputWriter writer; - - public NRefactoryAstVisitor(IOutputWriter writer) - { - this.writer = writer; - } - - public override object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) - { - return base.VisitAddHandlerStatement(addHandlerStatement, data); - } - - public override object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) - { - return base.VisitAddressOfExpression(addressOfExpression, data); - } - - public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) - { - return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data); - } - - public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) - { - return base.VisitArrayCreateExpression(arrayCreateExpression, data); - } - - public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) - { - WriteLine("VisitAssignmentExpression"); - return base.VisitAssignmentExpression(assignmentExpression, data); - } - - public override object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) - { - return base.VisitAttribute(attribute, data); - } - - public override object VisitAttributeSection(AttributeSection attributeSection, object data) - { - return base.VisitAttributeSection(attributeSection, data); - } - - public override object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) - { - return base.VisitBaseReferenceExpression(baseReferenceExpression, data); - } - - public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) - { - return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data); - } - - public override object VisitBlockStatement(BlockStatement blockStatement, object data) - { - return base.VisitBlockStatement(blockStatement, data); - } - - public override object VisitBreakStatement(BreakStatement breakStatement, object data) - { - return base.VisitBreakStatement(breakStatement, data); - } - - public override object VisitCaseLabel(CaseLabel caseLabel, object data) - { - return base.VisitCaseLabel(caseLabel, data); - } - - public override object VisitCastExpression(CastExpression castExpression, object data) - { - return base.VisitCastExpression(castExpression, data); - } - - public override object VisitCatchClause(CatchClause catchClause, object data) - { - return base.VisitCatchClause(catchClause, data); - } - - public override object VisitCheckedExpression(CheckedExpression checkedExpression, object data) - { - return base.VisitCheckedExpression(checkedExpression, data); - } - - public override object VisitCheckedStatement(CheckedStatement checkedStatement, object data) - { - return base.VisitCheckedStatement(checkedStatement, data); - } - - public override object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) - { - return base.VisitClassReferenceExpression(classReferenceExpression, data); - } - - public override object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) - { - WriteLine("VisitCollectionInitializerExpression"); - return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data); - } - - public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data) - { - WriteLine("VisitCodeCompileUnit"); - return base.VisitCompilationUnit(compilationUnit, data); - } - - public override object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) - { - return base.VisitConditionalExpression(conditionalExpression, data); - } - - public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) - { - WriteLine("VisitConstructorDeclaration"); - return base.VisitConstructorDeclaration(constructorDeclaration, data); - } - - public override object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) - { - WriteLine("VisitConstructorInitializer"); - return base.VisitConstructorInitializer(constructorInitializer, data); - } - - public override object VisitContinueStatement(ContinueStatement continueStatement, object data) - { - return base.VisitContinueStatement(continueStatement, data); - } - - public override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) - { - return base.VisitDeclareDeclaration(declareDeclaration, data); - } - - public override object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) - { - return base.VisitDefaultValueExpression(defaultValueExpression, data); - } - - public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) - { - return base.VisitDelegateDeclaration(delegateDeclaration, data); - } - - public override object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) - { - return base.VisitDestructorDeclaration(destructorDeclaration, data); - } - - public override object VisitDirectionExpression(DirectionExpression directionExpression, object data) - { - return base.VisitDirectionExpression(directionExpression, data); - } - - public override object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) - { - return base.VisitDoLoopStatement(doLoopStatement, data); - } - - public override object VisitElseIfSection(ElseIfSection elseIfSection, object data) - { - return base.VisitElseIfSection(elseIfSection, data); - } - - public override object VisitEmptyStatement(EmptyStatement emptyStatement, object data) - { - WriteLine("VisitEmptyStatement"); - return base.VisitEmptyStatement(emptyStatement, data); - } - - public override object VisitEndStatement(EndStatement endStatement, object data) - { - return base.VisitEndStatement(endStatement, data); - } - - public override object VisitEraseStatement(EraseStatement eraseStatement, object data) - { - return base.VisitEraseStatement(eraseStatement, data); - } - - public override object VisitErrorStatement(ErrorStatement errorStatement, object data) - { - return base.VisitErrorStatement(errorStatement, data); - } - - public override object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) - { - return base.VisitEventAddRegion(eventAddRegion, data); - } - - public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) - { - return base.VisitEventDeclaration(eventDeclaration, data); - } - - public override object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) - { - return base.VisitEventRaiseRegion(eventRaiseRegion, data); - } - - public override object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) - { - return base.VisitEventRemoveRegion(eventRemoveRegion, data); - } - - public override object VisitExitStatement(ExitStatement exitStatement, object data) - { - return base.VisitExitStatement(exitStatement, data); - } - - public override object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) - { - return base.VisitExpressionRangeVariable(expressionRangeVariable, data); - } - - public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) - { - WriteLine("VisitExpressionStatement"); - return base.VisitExpressionStatement(expressionStatement, data); - } - - public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) - { - WriteLine("VisitFieldDeclaration: " + fieldDeclaration.Fields[0].Name); - return base.VisitFieldDeclaration(fieldDeclaration, data); - } - - public override object VisitFixedStatement(FixedStatement fixedStatement, object data) - { - return base.VisitFixedStatement(fixedStatement, data); - } - - public override object VisitForeachStatement(ForeachStatement foreachStatement, object data) - { - return base.VisitForeachStatement(foreachStatement, data); - } - - public override object VisitForNextStatement(ForNextStatement forNextStatement, object data) - { - return base.VisitForNextStatement(forNextStatement, data); - } - - public override object VisitForStatement(ForStatement forStatement, object data) - { - return base.VisitForStatement(forStatement, data); - } - - public override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) - { - return base.VisitGotoCaseStatement(gotoCaseStatement, data); - } - - public override object VisitGotoStatement(GotoStatement gotoStatement, object data) - { - return base.VisitGotoStatement(gotoStatement, data); - } - - public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) - { - WriteLine("VisitIdentifierExpression"); - return base.VisitIdentifierExpression(identifierExpression, data); - } - - public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) - { - return base.VisitIfElseStatement(ifElseStatement, data); - } - - public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data) - { - return base.VisitIndexerExpression(indexerExpression, data); - } - - public override object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) - { - return base.VisitInnerClassTypeReference(innerClassTypeReference, data); - } - - public override object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) - { - return base.VisitInterfaceImplementation(interfaceImplementation, data); - } - - public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data) - { - return base.VisitInvocationExpression(invocationExpression, data); - } - - public override object VisitLabelStatement(LabelStatement labelStatement, object data) - { - return base.VisitLabelStatement(labelStatement, data); - } - - public override object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) - { - return base.VisitLambdaExpression(lambdaExpression, data); - } - - public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) - { - WriteLine("VisitLocalVariableDeclaration"); - return base.VisitLocalVariableDeclaration(localVariableDeclaration, data); - } - - public override object VisitLockStatement(LockStatement lockStatement, object data) - { - return base.VisitLockStatement(lockStatement, data); - } - - public override object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) - { - WriteLine("VisitMemberReferenceExpression"); - return base.VisitMemberReferenceExpression(memberReferenceExpression, data); - } - - public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) - { - WriteLine("VisitMethodDeclaration"); - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - return base.VisitMethodDeclaration(methodDeclaration, data); - } - } - - public override object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) - { - return base.VisitNamedArgumentExpression(namedArgumentExpression, data); - } - - public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) - { - WriteLine("VisitNamespaceDeclaration"); - return base.VisitNamespaceDeclaration(namespaceDeclaration, data); - } - - public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) - { - WriteLine("VisitObjectCreateExpression"); - return base.VisitObjectCreateExpression(objectCreateExpression, data); - } - - public override object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) - { - return base.VisitOnErrorStatement(onErrorStatement, data); - } - - public override object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) - { - return base.VisitOperatorDeclaration(operatorDeclaration, data); - } - - public override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) - { - return base.VisitOptionDeclaration(optionDeclaration, data); - } - - public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) - { - return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data); - } - - public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) - { - return base.VisitParenthesizedExpression(parenthesizedExpression, data); - } - - public override object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) - { - return base.VisitPointerReferenceExpression(pointerReferenceExpression, data); - } - - public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) - { - return base.VisitPrimitiveExpression(primitiveExpression, data); - } - - public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) - { - return base.VisitPropertyDeclaration(propertyDeclaration, data); - } - - public override object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) - { - return base.VisitPropertyGetRegion(propertyGetRegion, data); - } - - public override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) - { - return base.VisitPropertySetRegion(propertySetRegion, data); - } - - public override object VisitQueryExpression(QueryExpression queryExpression, object data) - { - return base.VisitQueryExpression(queryExpression, data); - } - - public override object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) - { - return base.VisitQueryExpressionAggregateClause(queryExpressionAggregateClause, data); - } - - public override object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) - { - return base.VisitQueryExpressionDistinctClause(queryExpressionDistinctClause, data); - } - - public override object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) - { - return base.VisitQueryExpressionFromClause(queryExpressionFromClause, data); - } - - public override object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) - { - return base.VisitQueryExpressionGroupClause(queryExpressionGroupClause, data); - } - - public override object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) - { - return base.VisitQueryExpressionGroupJoinVBClause(queryExpressionGroupJoinVBClause, data); - } - - public override object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) - { - return base.VisitQueryExpressionGroupVBClause(queryExpressionGroupVBClause, data); - } - - public override object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) - { - return base.VisitQueryExpressionJoinClause(queryExpressionJoinClause, data); - } - - public override object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) - { - return base.VisitQueryExpressionJoinConditionVB(queryExpressionJoinConditionVB, data); - } - - public override object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) - { - return base.VisitQueryExpressionJoinVBClause(queryExpressionJoinVBClause, data); - } - - public override object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) - { - return base.VisitQueryExpressionLetClause(queryExpressionLetClause, data); - } - - public override object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) - { - return base.VisitQueryExpressionLetVBClause(queryExpressionLetVBClause, data); - } - - public override object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) - { - return base.VisitQueryExpressionOrderClause(queryExpressionOrderClause, data); - } - - public override object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) - { - return base.VisitQueryExpressionOrdering(queryExpressionOrdering, data); - } - - public override object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) - { - return base.VisitQueryExpressionPartitionVBClause(queryExpressionPartitionVBClause, data); - } - - public override object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) - { - return base.VisitQueryExpressionSelectClause(queryExpressionSelectClause, data); - } - - public override object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) - { - return base.VisitQueryExpressionSelectVBClause(queryExpressionSelectVBClause, data); - } - - public override object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) - { - return base.VisitQueryExpressionWhereClause(queryExpressionWhereClause, data); - } - - public override object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) - { - return base.VisitRaiseEventStatement(raiseEventStatement, data); - } - - public override object VisitReDimStatement(ReDimStatement reDimStatement, object data) - { - return base.VisitReDimStatement(reDimStatement, data); - } - - public override object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) - { - return base.VisitRemoveHandlerStatement(removeHandlerStatement, data); - } - - public override object VisitResumeStatement(ResumeStatement resumeStatement, object data) - { - return base.VisitResumeStatement(resumeStatement, data); - } - - public override object VisitReturnStatement(ReturnStatement returnStatement, object data) - { - return base.VisitReturnStatement(returnStatement, data); - } - - public override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) - { - return base.VisitSizeOfExpression(sizeOfExpression, data); - } - - public override object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) - { - return base.VisitStackAllocExpression(stackAllocExpression, data); - } - - public override object VisitStopStatement(StopStatement stopStatement, object data) - { - return base.VisitStopStatement(stopStatement, data); - } - - public override object VisitSwitchSection(SwitchSection switchSection, object data) - { - return base.VisitSwitchSection(switchSection, data); - } - - public override object VisitSwitchStatement(SwitchStatement switchStatement, object data) - { - return base.VisitSwitchStatement(switchStatement, data); - } - - public override object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) - { - return base.VisitTemplateDefinition(templateDefinition, data); - } - - public override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) - { - WriteLine("VisitThisReferenceExpression"); - return base.VisitThisReferenceExpression(thisReferenceExpression, data); - } - - public override object VisitThrowStatement(ThrowStatement throwStatement, object data) - { - return base.VisitThrowStatement(throwStatement, data); - } - - public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) - { - return base.VisitTryCatchStatement(tryCatchStatement, data); - } - - public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) - { - WriteLine("VisitTypeDeclaration"); - using (IDisposable indentLevel = Indentation.IncrementLevel()) { - return base.VisitTypeDeclaration(typeDeclaration, data); - } - } - - public override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) - { - return base.VisitTypeOfExpression(typeOfExpression, data); - } - - public override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) - { - return base.VisitTypeOfIsExpression(typeOfIsExpression, data); - } - - public override object VisitTypeReference(TypeReference typeReference, object data) - { - return base.VisitTypeReference(typeReference, data); - } - - public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) - { - return base.VisitTypeReferenceExpression(typeReferenceExpression, data); - } - - public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) - { - return base.VisitUnaryOperatorExpression(unaryOperatorExpression, data); - } - - public override object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) - { - return base.VisitUncheckedExpression(uncheckedExpression, data); - } - - public override object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) - { - return base.VisitUncheckedStatement(uncheckedStatement, data); - } - - public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) - { - return base.VisitUnsafeStatement(unsafeStatement, data); - } - - public override object VisitUsing(Using @using, object data) - { - WriteLine("VisitUsing"); - return base.VisitUsing(@using, data); - } - - public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) - { - WriteLine("VisitUsingDeclaration"); - return base.VisitUsingDeclaration(usingDeclaration, data); - } - - public override object VisitUsingStatement(UsingStatement usingStatement, object data) - { - WriteLine("VisitUsingStatement"); - return base.VisitUsingStatement(usingStatement, data); - } - - public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) - { - WriteLine("VisitVariableDeclaration"); - return base.VisitVariableDeclaration(variableDeclaration, data); - } - - public override object VisitWithStatement(WithStatement withStatement, object data) - { - return base.VisitWithStatement(withStatement, data); - } - - public override object VisitYieldStatement(YieldStatement yieldStatement, object data) - { - return base.VisitYieldStatement(yieldStatement, data); - } - - /// - /// Writes a line and indents it to the current level. - /// - void WriteLine(string s) - { - writer.WriteLine(GetIndent() + s); - } - - string GetIndent() - { - StringBuilder indent = new StringBuilder(); - for (int i = 0; i < Indentation.CurrentLevel; ++i) { - indent.Append('\t'); - } - return indent.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/Program.cs b/src/AddIns/BackendBindings/Python/PyWalker/Program.cs deleted file mode 100644 index 49504f22d29..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/Program.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Windows.Forms; - -namespace PyWalker -{ - /// - /// Class with program entry point. - /// - internal sealed class Program - { - /// - /// Program entry point. - /// - [STAThread] - private static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PyWalker/PyWalker.csproj b/src/AddIns/BackendBindings/Python/PyWalker/PyWalker.csproj deleted file mode 100644 index 50c0c251a6e..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/PyWalker.csproj +++ /dev/null @@ -1,84 +0,0 @@ - - - - {55329704-6046-48EC-8A20-5C80B3092A63} - Debug - AnyCPU - WinExe - PyWalker - PyWalker - v4.0 - False - False - 4 - false - - - bin\Debug\ - true - Full - True - DEBUG;TRACE - Project - False - - - bin\Release\ - False - None - False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - ..\RequiredLibraries\IronPython.dll - - - ..\RequiredLibraries\IronPython.Modules.dll - - - ..\RequiredLibraries\Microsoft.Dynamic.dll - - - ..\RequiredLibraries\Microsoft.Scripting.dll - - - - - - - - - - - - - - MainForm.cs - - - - - - MainForm.cs - - - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - - - {8D732610-8FC6-43BA-94C9-7126FD7FE361} - PythonBinding - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PyWalker/ResolveWalker.cs b/src/AddIns/BackendBindings/Python/PyWalker/ResolveWalker.cs deleted file mode 100644 index 504a3138147..00000000000 --- a/src/AddIns/BackendBindings/Python/PyWalker/ResolveWalker.cs +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Text; -using IronPython; -using IronPython.Compiler; -using IronPython.Compiler.Ast; - -namespace PyWalker -{ - public interface IOutputWriter - { - void WriteLine(string s); - } - - public class ResolveWalker : PythonWalker - { - IOutputWriter writer; - - public ResolveWalker(IOutputWriter writer) - { - this.writer = writer; - } - - public override bool Walk(AndExpression node) - { - writer.WriteLine("And"); - return base.Walk(node); - } - - public override bool Walk(AssertStatement node) - { - writer.WriteLine("Assert"); - return base.Walk(node); - } - - public override bool Walk(Arg node) - { - writer.WriteLine("Arg: " + node.Name.ToString()); - return base.Walk(node); - } - - public override bool Walk(AugmentedAssignStatement node) - { - writer.WriteLine("AugmentedAssignStatement"); - return base.Walk(node); - } - - public override bool Walk(AssignmentStatement node) - { - writer.WriteLine("AssignmentStatement"); - return base.Walk(node); - } - - public override bool Walk(BackQuoteExpression node) - { - writer.WriteLine("BackQuote"); - return base.Walk(node); - } - - public override bool Walk(BinaryExpression node) - { - writer.WriteLine("Binary"); - return base.Walk(node); - } - - public override bool Walk(BreakStatement node) - { - writer.WriteLine("Breaks"); - return base.Walk(node); - } - - public override bool Walk(ClassDefinition node) - { - if (node.Bases.Count > 0) { - writer.WriteLine("Class: " + node.Name + " BaseTypes: " + GetBaseTypes(node.Bases)); - } else { - writer.WriteLine("Class: " + node.Name); - } - return base.Walk(node); - } - - public override bool Walk(ConditionalExpression node) - { - writer.WriteLine("ConditionalExpression"); - return base.Walk(node); - } - - public override bool Walk(ConstantExpression node) - { - writer.WriteLine("ConstantExpression"); - return base.Walk(node); - } - - public override bool Walk(ContinueStatement node) - { - writer.WriteLine("Continue"); - return base.Walk(node); - } - - public override bool Walk(PrintStatement node) - { - writer.WriteLine("PrintStatement"); - return base.Walk(node); - } - - public override bool Walk(FunctionDefinition node) - { - writer.WriteLine("FunctionDefinition"); - return base.Walk(node); - } - - public override bool Walk(CallExpression node) - { - writer.WriteLine("Call"); - return base.Walk(node); - } - - public override bool Walk(DictionaryExpression node) - { - writer.WriteLine("Dict"); - return base.Walk(node); - } - - public override bool Walk(DottedName node) - { - writer.WriteLine("DottedName"); - return base.Walk(node); - } - - public override bool Walk(ExpressionStatement node) - { - writer.WriteLine("Expr"); - return base.Walk(node); - } - - public override bool Walk(GlobalStatement node) - { - writer.WriteLine("Global"); - return base.Walk(node); - } - - public override bool Walk(NameExpression node) - { - writer.WriteLine("Name: " + node.Name); - return base.Walk(node); - } - - public override bool Walk(MemberExpression node) - { - writer.WriteLine("Member: " + node.Name); - return base.Walk(node); - } - - public override bool Walk(FromImportStatement node) - { - writer.WriteLine("FromImport: " + node.Root.MakeString()); - return base.Walk(node); - } - - public override bool Walk(ImportStatement node) - { - writer.WriteLine("Import: " + GetImports(node.Names)); - return base.Walk(node); - } - - public override bool Walk(IndexExpression node) - { - writer.WriteLine("Index: " + node.Index.ToString()); - return base.Walk(node); - } - - public override bool Walk(UnaryExpression node) - { - writer.WriteLine("Unary"); - return base.Walk(node); - } - - public override bool Walk(SuiteStatement node) - { - writer.WriteLine("Suite"); - return base.Walk(node); - } - - public override bool Walk(ErrorExpression node) - { - writer.WriteLine("Error"); - return base.Walk(node); - } - - public override bool Walk(IfStatement node) - { - writer.WriteLine("If"); - return base.Walk(node); - } - - string GetImports(IList names) - { - StringBuilder s = new StringBuilder(); - foreach (DottedName name in names) { - s.Append(name.MakeString()); - s.Append(','); - } - return s.ToString(); - } - - string GetBaseTypes(IList types) - { - StringBuilder s = new StringBuilder(); - foreach (Expression expression in types) { - NameExpression nameExpression = expression as NameExpression; - if (nameExpression != null) { - s.Append(nameExpression.Name.ToString()); - s.Append(','); - } - } - return s.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Configuration/AssemblyInfo.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Configuration/AssemblyInfo.cs deleted file mode 100644 index b0b9b2682e5..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System.Reflection; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("Python.Build.Tasks")] -[assembly: AssemblyDescription("Provides IronPython build tasks for the IronPython addin.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Python.Build.Tasks.csproj b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Python.Build.Tasks.csproj deleted file mode 100644 index 413080a8a7a..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Python.Build.Tasks.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - {D332F2D1-2CF1-43B7-903C-844BD5211A7E} - Debug - AnyCPU - Library - ICSharpCode.Python.Build.Tasks - Python.Build.Tasks - False - False - 4 - false - v4.0 - OnBuildSuccess - - - - - ..\..\..\..\..\..\AddIns\BackendBindings\PythonBinding\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\..\AddIns\BackendBindings\PythonBinding\ - false - None - False - TRACE - False - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - ..\..\RequiredLibraries\IronPython.dll - - - ..\..\RequiredLibraries\IronPython.Modules.dll - - - - - 3.5 - - - ..\..\RequiredLibraries\Microsoft.Dynamic.dll - - - ..\..\RequiredLibraries\Microsoft.Scripting.dll - - - - - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - Always - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/SharpDevelop.Build.Python.targets b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/SharpDevelop.Build.Python.targets deleted file mode 100644 index 51171eeae5a..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/SharpDevelop.Build.Python.targets +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - $(MSBuildAllProjects);$(PythonBinPath)\SharpDevelop.Build.Python.targets - .py - Python - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - CopyFilesToOutputDirectory;CopyIntermediateAssemblyDllToOutputDirectory - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/IPythonCompiler.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/IPythonCompiler.cs deleted file mode 100644 index dd5e193f5fa..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/IPythonCompiler.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Reflection.Emit; - -namespace ICSharpCode.Python.Build.Tasks -{ - /// - /// Python compiler interface. - /// - public interface IPythonCompiler : IDisposable - { - /// - /// Gets or sets the source files to compile. - /// - IList SourceFiles { get; set; } - - /// - /// Gets or sets the filenames of the referenced assemblies. - /// - IList ReferencedAssemblies { get; set; } - - /// - /// Gets or sets the resources to be compiled. - /// - IList ResourceFiles { get; set; } - - /// - /// Executes the compiler. - /// - void Compile(); - - /// - /// Gets or sets the type of the compiled assembly (e.g. windows app, - /// console app or dll). - /// - PEFileKinds TargetKind { get; set; } - - /// - /// Gets or sets the nature of the code in the executable produced by the compiler. - /// - PortableExecutableKinds ExecutableKind { get; set; } - - /// - /// Gets or sets the machine that will be targeted by the compiler. - /// - ImageFileMachine Machine { get; set; } - - /// - /// Gets or sets the file that contains the main entry point. - /// - string MainFile { get; set; } - - /// - /// Gets or sets the output assembly filename. - /// - string OutputAssembly { get; set; } - - /// - /// Gets or sets whether the compiler should include debug - /// information in the created assembly. - /// - bool IncludeDebugInformation { get; set; } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs deleted file mode 100644 index 30d4063580b..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; -using System.Resources; - -using IronPython.Hosting; -using IronPython.Runtime; -using IronPython.Runtime.Operations; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; - -namespace ICSharpCode.Python.Build.Tasks -{ - /// - /// Wraps the IronPython.Hosting.PythonCompiler class so it - /// implements the IPythonCompiler interface. - /// - public class PythonCompiler : IPythonCompiler - { - IList sourceFiles; - IList referencedAssemblies; - IList resourceFiles; - PEFileKinds targetKind = PEFileKinds.Dll; - PortableExecutableKinds executableKind = PortableExecutableKinds.ILOnly; - ImageFileMachine machine = ImageFileMachine.I386; - string mainFile = String.Empty; - bool includeDebugInformation; - string outputAssembly = String.Empty; - - public PythonCompiler() - { - } - - public IList SourceFiles { - get { return sourceFiles; } - set { sourceFiles = value; } - } - - public IList ReferencedAssemblies { - get { return referencedAssemblies; } - set { referencedAssemblies = value; } - } - - public IList ResourceFiles { - get { return resourceFiles; } - set { resourceFiles = value; } - } - - public PEFileKinds TargetKind { - get { return targetKind; } - set { targetKind = value; } - } - - public PortableExecutableKinds ExecutableKind { - get { return executableKind; } - set { executableKind = value; } - } - - public ImageFileMachine Machine { - get { return machine; } - set { machine = value; } - } - - public string MainFile { - get { return mainFile; } - set { mainFile = value; } - } - - public string OutputAssembly { - get { return outputAssembly; } - set { outputAssembly = value; } - } - - public bool IncludeDebugInformation { - get { return includeDebugInformation; } - set { includeDebugInformation = value; } - } - - /// - /// The compilation requires us to change into the compile output folder since the - /// AssemblyBuilder.Save does not use a full path when generating the assembly. - /// - public void Compile() - { - VerifyParameters(); - - // Compile the source files to a dll first. - ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); - Dictionary dictionary = new Dictionary(); - dictionary.Add("mainModule", mainFile); - string outputAssemblyDll = Path.ChangeExtension(outputAssembly, ".dll"); - ClrModule.CompileModules(DefaultContext.Default, outputAssemblyDll, dictionary, ToStringArray(sourceFiles)); - - // Generate an executable if required. - if (targetKind != PEFileKinds.Dll) { - // Change into compilation folder. - string originalFolder = Directory.GetCurrentDirectory(); - try { - string compileFolder = Path.Combine(originalFolder, Path.GetDirectoryName(outputAssembly)); - Directory.SetCurrentDirectory(compileFolder); - GenerateExecutable(outputAssemblyDll); - } finally { - Directory.SetCurrentDirectory(originalFolder); - } - } - } - - /// - /// Verifies the compiler parameters that have been set correctly. - /// - public void VerifyParameters() - { - if ((mainFile == null) && (targetKind != PEFileKinds.Dll)) { - throw new PythonCompilerException(Resources.NoMainFileSpecified); - } - } - - public void Dispose() - { - } - - /// - /// Generates an executable from the already compiled dll. - /// - void GenerateExecutable(string outputAssemblyDll) - { - string outputAssemblyFileNameWithoutExtension = Path.GetFileNameWithoutExtension(outputAssembly); - AssemblyName assemblyName = new AssemblyName(outputAssemblyFileNameWithoutExtension); - AssemblyBuilder assemblyBuilder = PythonOps.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); - ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(outputAssemblyFileNameWithoutExtension, assemblyName.Name + ".exe"); - TypeBuilder typeBuilder = moduleBuilder.DefineType("PythonMain", TypeAttributes.Public); - MethodBuilder mainMethod = typeBuilder.DefineMethod("Main", MethodAttributes.Public | MethodAttributes.Static, typeof(int), new Type[0]); - - MarkMainMethodAsSTA(mainMethod); - GenerateMainMethodBody(mainMethod, outputAssemblyDll); - - // Add resources. - AddResources(moduleBuilder); - - // Create executable. - typeBuilder.CreateType(); - assemblyBuilder.SetEntryPoint(mainMethod, targetKind); - assemblyBuilder.Save(assemblyName.Name + ".exe", executableKind, machine); - } - - void MarkMainMethodAsSTA(MethodBuilder mainMethod) - { - mainMethod.SetCustomAttribute(typeof(STAThreadAttribute).GetConstructor(Type.EmptyTypes), new byte[0]); - } - - void GenerateMainMethodBody(MethodBuilder mainMethod, string outputAssemblyDll) - { - ILGenerator generator = mainMethod.GetILGenerator(); - LocalBuilder exeAssemblyLocalVariable = generator.DeclareLocal(typeof(Assembly)); - LocalBuilder directoryLocalVariable = generator.DeclareLocal(typeof(string)); - LocalBuilder fileNameLocalVariable = generator.DeclareLocal(typeof(string)); - - generator.EmitCall(OpCodes.Call, typeof(Assembly).GetMethod("GetExecutingAssembly", new Type[0], new ParameterModifier[0]), null); - generator.Emit(OpCodes.Stloc_0); - - generator.Emit(OpCodes.Ldloc_0); - generator.EmitCall(OpCodes.Callvirt, typeof(Assembly).GetMethod("get_Location"), null); - generator.EmitCall(OpCodes.Call, typeof(Path).GetMethod("GetDirectoryName", new Type[] {typeof(String)}, new ParameterModifier[0]), null); - generator.Emit(OpCodes.Stloc_1); - - generator.Emit(OpCodes.Ldloc_1); - generator.Emit(OpCodes.Ldstr, Path.GetFileName(outputAssemblyDll)); - generator.EmitCall(OpCodes.Call, typeof(Path).GetMethod("Combine", new Type[] {typeof(String), typeof(String)}, new ParameterModifier[0]), null); - generator.Emit(OpCodes.Stloc_2); - - generator.Emit(OpCodes.Ldloc_2); - generator.EmitCall(OpCodes.Call, typeof(Assembly).GetMethod("LoadFile", new Type[] {typeof(String)}, new ParameterModifier[0]), null); - generator.Emit(OpCodes.Ldstr, Path.GetFileNameWithoutExtension(mainFile)); - - // Add referenced assemblies. - AddReferences(generator); - - generator.EmitCall(OpCodes.Call, typeof(PythonOps).GetMethod("InitializeModule"), new Type[0]); - generator.Emit(OpCodes.Ret); - } - - /// - /// Converts an IList into a string[]. - /// - string[] ToStringArray(IList items) - { - string[] array = new string[items.Count]; - items.CopyTo(array, 0); - return array; - } - - /// - /// Adds reference information to the IL. - /// - void AddReferences(ILGenerator generator) - { - if (referencedAssemblies.Count > 0) { - generator.Emit(OpCodes.Ldc_I4, referencedAssemblies.Count); - generator.Emit(OpCodes.Newarr, typeof(String)); - - for (int i = 0; i < referencedAssemblies.Count; ++i) { - generator.Emit(OpCodes.Dup); - generator.Emit(OpCodes.Ldc_I4, i); - string assemblyFileName = referencedAssemblies[i]; - Assembly assembly = Assembly.ReflectionOnlyLoadFrom(assemblyFileName); - generator.Emit(OpCodes.Ldstr, assembly.FullName); - generator.Emit(OpCodes.Stelem_Ref); - } - } else { - generator.Emit(OpCodes.Ldnull); - } - } - - /// - /// Embeds resources into the assembly. - /// - void AddResources(ModuleBuilder moduleBuilder) - { - foreach (ResourceFile resourceFile in resourceFiles) { - AddResource(moduleBuilder, resourceFile); - } - } - - /// - /// Embeds a single resource into the assembly. - /// - void AddResource(ModuleBuilder moduleBuilder, ResourceFile resourceFile) - { - string fileName = resourceFile.FileName; - string extension = Path.GetExtension(fileName).ToLowerInvariant(); - if (extension == ".resources") { - string fullFileName = Path.GetFileName(fileName); - IResourceWriter resourceWriter = moduleBuilder.DefineResource(fullFileName, resourceFile.Name, ResourceAttributes.Public); - AddResources(resourceWriter, fileName); - } else { - moduleBuilder.DefineManifestResource(resourceFile.Name, new FileStream(fileName, FileMode.Open), ResourceAttributes.Public); - } - } - - void AddResources(IResourceWriter resourceWriter, string fileName) - { - ResourceReader resourceReader = new ResourceReader(fileName); - using (resourceReader) { - IDictionaryEnumerator enumerator = resourceReader.GetEnumerator(); - while (enumerator.MoveNext()) { - string key = enumerator.Key as string; - Stream resourceStream = enumerator.Value as Stream; - if (resourceStream != null) { - BinaryReader reader = new BinaryReader(resourceStream); - MemoryStream stream = new MemoryStream(); - byte[] bytes = reader.ReadBytes((int)resourceStream.Length); - stream.Write(bytes, 0, bytes.Length); - resourceWriter.AddResource(key, stream); - } else { - resourceWriter.AddResource(key, enumerator.Value); - } - } - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerException.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerException.cs deleted file mode 100644 index 71535e84649..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerException.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.Python.Build.Tasks -{ - public class PythonCompilerException : ApplicationException - { - public PythonCompilerException(string message) : base(message) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerTask.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerTask.cs deleted file mode 100644 index 7c8ce1da92a..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompilerTask.cs +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Hosting; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; - -namespace ICSharpCode.Python.Build.Tasks -{ - /// - /// Python compiler task. - /// - public class PythonCompilerTask : Task - { - IPythonCompiler compiler; - ITaskItem[] sources; - ITaskItem[] references; - ITaskItem[] resources; - string targetType; - string mainFile; - string outputAssembly; - bool emitDebugInformation; - string platform; - - public PythonCompilerTask() - : this(new PythonCompiler()) - { - } - - public PythonCompilerTask(IPythonCompiler compiler) - { - this.compiler = compiler; - } - - /// - /// Gets or sets the source files that will be compiled. - /// - public ITaskItem[] Sources { - get { return sources; } - set { sources = value; } - } - - /// - /// Gets or sets the resources to be compiled. - /// - public ITaskItem[] Resources { - get { return resources; } - set { resources = value; } - } - - /// - /// Gets or sets the output assembly type. - /// - public string TargetType { - get { return targetType; } - set { targetType = value; } - } - - /// - /// Gets or sets the file that contains the main entry point. - /// - public string MainFile { - get { return mainFile; } - set { mainFile = value; } - } - - /// - /// Gets or sets the output assembly filename. - /// - public string OutputAssembly { - get { return outputAssembly; } - set { outputAssembly = value; } - } - - /// - /// Gets or sets the platform that will be targeted by the compiler (e.g. x86). - /// - public string Platform { - get { return platform; } - set { platform = value; } - } - - /// - /// Gets or sets whether the compiler should include debug - /// information in the created assembly. - /// - public bool EmitDebugInformation { - get { return emitDebugInformation; } - set { emitDebugInformation = value; } - } - - /// - /// Gets or sets the assembly references. - /// - public ITaskItem[] References { - get { return references; } - set { references = value; } - } - - /// - /// Executes the compiler. - /// - public override bool Execute() - { - using (compiler) { - // Set what sort of assembly we are generating - // (e.g. WinExe, Exe or Dll) - compiler.TargetKind = GetPEFileKind(targetType); - - compiler.ExecutableKind = GetExecutableKind(platform); - compiler.Machine = GetMachine(platform); - - compiler.SourceFiles = GetFiles(sources, false); - compiler.ReferencedAssemblies = GetFiles(references, true); - compiler.ResourceFiles = GetResourceFiles(resources); - compiler.MainFile = mainFile; - compiler.OutputAssembly = outputAssembly; - compiler.IncludeDebugInformation = emitDebugInformation; - - // Compile the code. - try { - compiler.Compile(); - return true; - } catch (SyntaxErrorException ex) { - LogSyntaxError(ex); - } catch (IOException ex) { - LogError(ex.Message); - } catch (PythonCompilerException ex) { - LogError(ex.Message); - } - } - return false; - } - - /// - /// Gets the current folder where this task is being executed from. - /// - protected virtual string GetCurrentFolder() - { - return Directory.GetCurrentDirectory(); - } - - /// - /// Logs any error message that occurs during compilation. Default implementation - /// is to use the MSBuild task's base.Log.LogError(...) - /// - protected virtual void LogError(string message, string errorCode, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber) - { - Log.LogError(null, errorCode, null, file, lineNumber, columnNumber, endLineNumber, endColumnNumber, message); - } - - void LogError(string message) - { - LogError(message, null, null, 0, 0, 0, 0); - } - - void LogSyntaxError(SyntaxErrorException ex) - { - string fileName = GetFileName(ex, sources); - LogError(ex.Message, ex.ErrorCode.ToString(), fileName, ex.Line, ex.Column, ex.RawSpan.End.Line, ex.RawSpan.End.Column); - } - - /// - /// Matches the syntax exception SourcePath against filenames being compiled. The - /// syntax exception only contains the file name without its path and without its file extension. - /// - string GetFileName(SyntaxErrorException ex, ITaskItem[] sources) - { - if (ex.SourcePath == null) { - return null; - } - - string sourcePath = ex.SourcePath.Replace('\\', '.'); - foreach (ITaskItem item in sources) { - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item.ItemSpec); - if (fileNameWithoutExtension == sourcePath) { - return item.ItemSpec; - } - } - string fileName = sourcePath + ".py"; - return Path.Combine(GetCurrentFolder(), fileName); - } - - /// - /// Maps from the target type string to the PEFileKind - /// needed by the compiler. - /// - static PEFileKinds GetPEFileKind(string targetType) - { - if (targetType != null) { - switch (targetType.ToLowerInvariant()) { - case "winexe": - return PEFileKinds.WindowApplication; - case "library": - return PEFileKinds.Dll; - } - } - return PEFileKinds.ConsoleApplication; - } - - /// - /// Converts from an array of ITaskItems to a list of - /// strings, each containing the ITaskItem filename. - /// - IList GetFiles(ITaskItem[] taskItems, bool fullPath) - { - List files = new List(); - if (taskItems != null) { - foreach (ITaskItem item in taskItems) { - string fileName = item.ItemSpec; - if (fullPath) { - fileName = GetFullPath(item.ItemSpec); - } - files.Add(fileName); - } - } - return files; - } - - /// - /// Converts the string into a PortableExecutableKinds enum. - /// - PortableExecutableKinds GetExecutableKind(string platform) - { - switch (platform) { - case "x86": - return PortableExecutableKinds.ILOnly | PortableExecutableKinds.Required32Bit; - case "Itanium": - case "x64": - return PortableExecutableKinds.ILOnly | PortableExecutableKinds.PE32Plus; - } - return PortableExecutableKinds.ILOnly; - } - - /// - /// Gets the machine associated with a PortalExecutableKind. - /// - ImageFileMachine GetMachine(string platform) - { - switch (platform) { - case "Itanium": - return ImageFileMachine.IA64; - case "x64": - return ImageFileMachine.AMD64; - } - return ImageFileMachine.I386; - } - - /// - /// Converts from an array of ITaskItems to a list of - /// ResourceFiles. - /// - /// - /// The resource name is the filename without any preceding - /// path information. - /// - IList GetResourceFiles(ITaskItem[] taskItems) - { - List files = new List(); - if (taskItems != null) { - foreach (ITaskItem item in taskItems) { - string resourceFileName = GetFullPath(item.ItemSpec); - string resourceName = GetResourceName(item); - ResourceFile resourceFile = new ResourceFile(resourceName, resourceFileName); - files.Add(resourceFile); - } - } - return files; - } - - string GetResourceName(ITaskItem item) - { - string logicalResourceName = item.GetMetadata("LogicalName"); - if (!String.IsNullOrEmpty(logicalResourceName)) { - return logicalResourceName; - } - return Path.GetFileName(item.ItemSpec); - } - - /// - /// Takes a relative path to a file and turns it into the full path using the current folder - /// as the base directory. - /// - string GetFullPath(string fileName) - { - if (!Path.IsPathRooted(fileName)) { - return Path.GetFullPath(Path.Combine(GetCurrentFolder(), fileName)); - } - return fileName; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/ResourceFile.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/ResourceFile.cs deleted file mode 100644 index 77c82cec707..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/ResourceFile.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.Python.Build.Tasks -{ - /// - /// Stores the name and filename of a resource that will be embedded by the PythonCompiler. - /// - public class ResourceFile - { - string name; - string fileName; - bool isPublic; - - public ResourceFile(string name, string fileName) : this(name, fileName, true) - { - } - - public ResourceFile(string name, string fileName, bool isPublic) - { - this.name = name; - this.fileName = fileName; - this.isPublic = isPublic; - } - - public string Name { - get { return name; } - set { name = value; } - } - - public string FileName { - get { return fileName; } - set { fileName = value; } - } - - public bool IsPublic { - get { return isPublic; } - set { isPublic = value; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/Resources.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/Resources.cs deleted file mode 100644 index 4fc6db072df..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/Resources.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.Python.Build.Tasks -{ - public class Resources - { - Resources() - { - } - - /// - /// No main file specified when trying to compile an application - /// - public static string NoMainFileSpecified { - get { return "No main file specified."; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/AssemblyInfo.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/AssemblyInfo.cs deleted file mode 100644 index 7dffcdad0bb..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/AssemblyInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("Python.Build.Tasks.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Python.Build.Tasks.Tests")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("0.3")] diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileResourcesTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileResourcesTestFixture.cs deleted file mode 100644 index 358140d0770..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileResourcesTestFixture.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using IronPython.Hosting; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that resources are compiled using the PythonCompilerTask. - /// - [TestFixture] - public class CompileResourcesTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem resourceTaskItem; - ResourceFile resourceFile; - PythonCompilerTask compiler; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new PythonCompilerTask(mockCompiler); - TaskItem sourceTaskItem = new TaskItem("test.py"); - - compiler.Sources = new ITaskItem[] {sourceTaskItem}; - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - resourceTaskItem = new TaskItem(@"C:\Projects\Test\Test.resources"); - compiler.Resources = new ITaskItem[] {resourceTaskItem}; - - compiler.Execute(); - - if (mockCompiler.ResourceFiles != null && mockCompiler.ResourceFiles.Count > 0) { - resourceFile = mockCompiler.ResourceFiles[0]; - } - } - - [Test] - public void OneResourceFile() - { - Assert.AreEqual(1, mockCompiler.ResourceFiles.Count); - } - - [Test] - public void ResourceFileName() - { - Assert.AreEqual(resourceTaskItem.ItemSpec, resourceFile.FileName); - } - - /// - /// The resource name should be the same as the filename without - /// any preceding path information. - /// - [Test] - public void ResourceName() - { - Assert.AreEqual("Test.resources", resourceFile.Name); - } - - [Test] - public void CompilerTaskResources() - { - ITaskItem[] resources = compiler.Resources; - Assert.AreEqual(resourceTaskItem, resources[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileSingleSourceFileTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileSingleSourceFileTestFixture.cs deleted file mode 100644 index 3fd9e653c39..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/CompileSingleSourceFileTestFixture.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that the python compiler task compiles a single source file. - /// - [TestFixture] - public class CompileSingleSourceFileTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem sourceTaskItem; - TaskItem systemXmlReferenceTaskItem; - TaskItem systemDataReferenceTaskItem; - PythonCompilerTask compiler; - bool success; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new PythonCompilerTask(mockCompiler); - sourceTaskItem = new TaskItem("test.py"); - compiler.Sources = new ITaskItem[] {sourceTaskItem}; - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - systemDataReferenceTaskItem = new TaskItem(@"C:\Windows\Microsoft.NET\Framework\2.0\System.Data.dll"); - systemXmlReferenceTaskItem = new TaskItem(@"C:\Windows\Microsoft.NET\Framework\2.0\System.Xml.dll"); - compiler.References = new ITaskItem[] {systemDataReferenceTaskItem, systemXmlReferenceTaskItem}; - - success = compiler.Execute(); - } - - [Test] - public void CompilationSucceeded() - { - Assert.IsTrue(success); - } - - [Test] - public void OneSourceFile() - { - Assert.AreEqual(1, mockCompiler.SourceFiles.Count); - } - - [Test] - public void SourceFileName() - { - Assert.AreEqual("test.py", mockCompiler.SourceFiles[0]); - } - - [Test] - public void IsCompileCalled() - { - Assert.IsTrue(mockCompiler.CompileCalled); - } - - [Test] - public void IsDisposeCalled() - { - Assert.IsTrue(mockCompiler.DisposeCalled); - } - - [Test] - public void TargetKindIsExe() - { - Assert.AreEqual(PEFileKinds.ConsoleApplication, mockCompiler.TargetKind); - } - - [Test] - public void OutputAssembly() - { - Assert.AreEqual("test.exe", mockCompiler.OutputAssembly); - } - - [Test] - public void DebugInfo() - { - Assert.IsFalse(mockCompiler.IncludeDebugInformation); - } - - [Test] - public void TwoReferences() - { - Assert.AreEqual(2, mockCompiler.ReferencedAssemblies.Count); - } - - [Test] - public void PythonCompilerTaskReferences() - { - ITaskItem[] references = compiler.References; - Assert.AreEqual(systemDataReferenceTaskItem, references[0]); - Assert.AreEqual(systemXmlReferenceTaskItem, references[1]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DifferentTargetTypesTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DifferentTargetTypesTestFixture.cs deleted file mode 100644 index 41b3c36ff18..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DifferentTargetTypesTestFixture.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that the PythonCompiler correctly compiles to a - /// windows app when the TargetType is set to WinExe". - /// - [TestFixture] - public class DifferentTargetTypesTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem sourceTaskItem; - PythonCompilerTask compilerTask; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compilerTask = new PythonCompilerTask(mockCompiler); - sourceTaskItem = new TaskItem("test.py"); - compilerTask.Sources = new ITaskItem[] {sourceTaskItem}; - } - - [Test] - public void CompiledToWindowsApp() - { - compilerTask.TargetType = "WinExe"; - compilerTask.Execute(); - - Assert.AreEqual(PEFileKinds.WindowApplication, mockCompiler.TargetKind); - } - - [Test] - public void CompiledToWindowsAppWhenTargetTypeLowerCase() - { - compilerTask.TargetType = "winexe"; - compilerTask.Execute(); - - Assert.AreEqual(PEFileKinds.WindowApplication, mockCompiler.TargetKind); - } - - [Test] - public void CompiledToDll() - { - compilerTask.TargetType = "Library"; - compilerTask.Execute(); - - Assert.AreEqual(PEFileKinds.Dll, mockCompiler.TargetKind); - } - - [Test] - public void NullTargetTypeCompilesToConsoleApp() - { - compilerTask.TargetType = null; - compilerTask.Execute(); - - Assert.AreEqual(PEFileKinds.ConsoleApplication, mockCompiler.TargetKind); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DummyPythonCompilerTask.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DummyPythonCompilerTask.cs deleted file mode 100644 index 9720747f220..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/DummyPythonCompilerTask.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Python.Build.Tasks; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Overrides the GetCurrentFolder to return a predefined string. - /// - public class DummyPythonCompilerTask : PythonCompilerTask - { - string currentFolder; - string loggedErrorMessage; - string loggedErrorCode; - string loggedErrorFile; - int loggedStartColumn = -1; - int loggedStartLine = -1; - int loggedEndLine = -1; - int loggedEndColumn = -1; - - public DummyPythonCompilerTask(IPythonCompiler compiler, string currentFolder) - : base(compiler) - { - this.currentFolder = currentFolder; - } - - /// - /// Gets the error message passed to the LogError method. - /// - public string LoggedErrorMessage { - get { return loggedErrorMessage; } - } - - /// - /// Gets the error code passed to the LogError method. - /// - public string LoggedErrorCode { - get { return loggedErrorCode; } - } - - /// - /// Gets the file passed to the LogError method. - /// - public string LoggedErrorFile { - get { return loggedErrorFile; } - } - - /// - /// Gets the start line passed to the LogError method. - /// - public int LoggedStartLine { - get { return loggedStartLine; } - } - - /// - /// Gets the end line passed to the LogError method. - /// - public int LoggedEndLine { - get { return loggedEndLine; } - } - - /// - /// Gets the start column passed to the LogError method. - /// - public int LoggedStartColumn { - get { return loggedStartColumn; } - } - - /// - /// Gets the end column passed to the LogError method. - /// - public int LoggedEndColumn { - get { return loggedEndColumn; } - } - - protected override string GetCurrentFolder() - { - return currentFolder; - } - - protected override void LogError(string message, string errorCode, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber) - { - loggedErrorMessage = message; - loggedErrorCode = errorCode; - loggedErrorFile = file; - loggedStartColumn = columnNumber; - loggedStartLine = lineNumber; - loggedEndColumn = endColumnNumber; - loggedEndLine = endLineNumber; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IOErrorTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IOErrorTestFixture.cs deleted file mode 100644 index 1c459b2e8b9..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IOErrorTestFixture.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Runtime; -using IronPython.Runtime.Operations; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that an IOException is caught and logged. - /// - [TestFixture] - public class IOErrorTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\test.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - mockCompiler.ThrowExceptionAtCompile = PythonOps.IOError("Could not find main file test.py"); - - success = compiler.Execute(); - } - - [Test] - public void ExecuteFailed() - { - Assert.IsFalse(success); - } - - [Test] - public void IsExceptionMessageLogged() - { - Assert.AreEqual("Could not find main file test.py", compiler.LoggedErrorMessage); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IncludeDebugInfoTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IncludeDebugInfoTestFixture.cs deleted file mode 100644 index ea6d5edfd78..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/IncludeDebugInfoTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that the compiler includes debug info in the - /// generated assembly. - /// - [TestFixture] - public class IncludeDebugInfoTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem sourceTaskItem; - PythonCompilerTask compiler; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new PythonCompilerTask(mockCompiler); - sourceTaskItem = new TaskItem("test.py"); - compiler.Sources = new ITaskItem[] {sourceTaskItem}; - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - compiler.EmitDebugInformation = true; - - compiler.Execute(); - } - - [Test] - public void DebugInfoIncluded() - { - Assert.IsTrue(mockCompiler.IncludeDebugInformation); - } - - [Test] - public void PythonCompilerTaskTargetType() - { - Assert.AreEqual("Exe", compiler.TargetType); - } - - [Test] - public void PythonCompilerTaskOutputAssembly() - { - Assert.AreEqual("test.exe", compiler.OutputAssembly); - } - - [Test] - public void PythonCompilerTaskEmitDebugInfo() - { - Assert.AreEqual(true, compiler.EmitDebugInformation); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/LogicalResourceNamesTests.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/LogicalResourceNamesTests.cs deleted file mode 100644 index f23443a7f7c..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/LogicalResourceNamesTests.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - [TestFixture] - public class LogicalResourceNamesTests - { - MockPythonCompiler mockCompiler; - PythonCompilerTask compilerTask; - - void CreatePythonCompilerTask() - { - mockCompiler = new MockPythonCompiler(); - compilerTask = new PythonCompilerTask(mockCompiler); - compilerTask.TargetType = "Exe"; - compilerTask.OutputAssembly = "test.exe"; - } - - [Test] - public void Execute_ResourceHasLogicalNameSetInTaskItemMetadata_ResourceNamePassedToCompilerUsesLogicalName() - { - CreatePythonCompilerTask(); - - TaskItem resourceTaskItem = new TaskItem("test.xaml"); - resourceTaskItem.SetMetadata("LogicalName", "MyLogicalResourceName"); - compilerTask.Resources = new ITaskItem[] {resourceTaskItem}; - compilerTask.Execute(); - - ResourceFile resourceFile = mockCompiler.ResourceFiles[0]; - string resourceName = resourceFile.Name; - - string expectedResourceName = "MyLogicalResourceName"; - - Assert.AreEqual(expectedResourceName, resourceName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MainEntryPointTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MainEntryPointTestFixture.cs deleted file mode 100644 index c1b3290aba2..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MainEntryPointTestFixture.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that the main entry point is set in the PythonCompiler - /// by the PythonCompilerTask. - /// - [TestFixture] - public class MainEntryPointTestFixture - { - MockPythonCompiler mockCompiler; - PythonCompilerTask compilerTask; - TaskItem mainTaskItem; - TaskItem classTaskItem; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compilerTask = new PythonCompilerTask(mockCompiler); - mainTaskItem = new TaskItem("main.py"); - classTaskItem = new TaskItem("class1.py"); - compilerTask.Sources = new ITaskItem[] {mainTaskItem, classTaskItem}; - compilerTask.MainFile = "main.py"; - compilerTask.Execute(); - } - - [Test] - public void MainFile() - { - Assert.AreEqual("main.py", mockCompiler.MainFile); - } - - [Test] - public void TaskMainFile() - { - Assert.AreEqual("main.py", compilerTask.MainFile); - } - - [Test] - public void TaskSources() - { - ITaskItem[] sources = compilerTask.Sources; - Assert.AreEqual(sources[0], mainTaskItem); - Assert.AreEqual(sources[1], classTaskItem); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MissingMainEntryPointTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MissingMainEntryPointTestFixture.cs deleted file mode 100644 index fe9e37e90c5..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MissingMainEntryPointTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that an error is reported when the mainFile is missing and we are trying to compile - /// an executable. - /// - [TestFixture] - public class MissingMainEntryPointTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\test.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - mockCompiler.ThrowExceptionAtCompile = new PythonCompilerException("Missing main file."); - - success = compiler.Execute(); - } - - [Test] - public void ExecuteFailed() - { - Assert.IsFalse(success); - } - - [Test] - public void IsExceptionMessageLogged() - { - Assert.AreEqual("Missing main file.", compiler.LoggedErrorMessage); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MockPythonCompiler.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MockPythonCompiler.cs deleted file mode 100644 index 9ce7f6e6e30..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/MockPythonCompiler.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using IronPython.Hosting; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Implements the IPythonCompiler interface so the - /// PythonCompiler task can be tested. - /// - public class MockPythonCompiler : IPythonCompiler - { - IList sourceFiles; - bool compileCalled; - bool disposeCalled; - PEFileKinds targetKind; - PortableExecutableKinds executableKind; - ImageFileMachine machine; - string mainFile; - string outputAssembly; - bool includeDebugInformation; - IList referencedAssemblies; - IList resourceFiles; - Exception throwExceptionAtCompile; - - public MockPythonCompiler() - { - } - - /// - /// Gets or sets the source files to compiler. - /// - public IList SourceFiles { - get { return sourceFiles; } - set { sourceFiles = value; } - } - - /// - /// Gets or sets the filenames of the referenced assemblies. - /// - public IList ReferencedAssemblies { - get { return referencedAssemblies; } - set { referencedAssemblies = value; } - } - - /// - /// Gets or sets the resources to be compiled. - /// - public IList ResourceFiles { - get { return resourceFiles; } - set { resourceFiles = value; } - } - - /// - /// Gets or sets the exception that will be thrown when the Compile method is called. - /// - public Exception ThrowExceptionAtCompile { - get { return throwExceptionAtCompile; } - set { throwExceptionAtCompile = value; } - } - - /// - /// Compiles the source code. - /// - public void Compile() - { - compileCalled = true; - - if (throwExceptionAtCompile != null) { - throw throwExceptionAtCompile; - } - } - - /// - /// Disposes the compiler. - /// - public void Dispose() - { - disposeCalled = true; - } - - /// - /// Gets or sets the type of the compiled assembly. - /// - public PEFileKinds TargetKind { - get { return targetKind; } - set { targetKind = value; } - } - - public PortableExecutableKinds ExecutableKind { - get { return executableKind; } - set { executableKind = value; } - } - - public ImageFileMachine Machine { - get { return machine; } - set { machine = value; } - } - - /// - /// Gets or sets the file that contains the main entry point. - /// - public string MainFile { - get { return mainFile; } - set { mainFile = value; } - } - - /// - /// Gets or sets the output assembly filename. - /// - public string OutputAssembly { - get { return outputAssembly; } - set { outputAssembly = value; } - } - - /// - /// Gets or sets whether the compiler should include debug - /// information in the created assembly. - /// - public bool IncludeDebugInformation { - get { return includeDebugInformation; } - set { includeDebugInformation = value; } - } - - /// - /// Gets whether the Compile method has been called. - /// - public bool CompileCalled { - get { return compileCalled; } - } - - /// - /// Gets whether the Dispose method has been called. - /// - public bool DisposeCalled { - get { return disposeCalled; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PlatformTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PlatformTestFixture.cs deleted file mode 100644 index 6c2a2c63f54..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PlatformTestFixture.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests the platform information (e.g. x86) is correctly passed to the IPythonCompiler. - /// - [TestFixture] - public class PlatformTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem sourceTaskItem; - PythonCompilerTask compilerTask; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compilerTask = new PythonCompilerTask(mockCompiler); - sourceTaskItem = new TaskItem("test.py"); - compilerTask.Sources = new ITaskItem[] {sourceTaskItem}; - } - - [Test] - public void DefaultPlatformIsILOnly() - { - compilerTask.Execute(); - Assert.AreEqual(PortableExecutableKinds.ILOnly, mockCompiler.ExecutableKind); - } - - [Test] - public void DefaultMachineIs386() - { - compilerTask.Execute(); - Assert.AreEqual(ImageFileMachine.I386, mockCompiler.Machine); - } - - [Test] - public void ExecutableIsCompiledTo32Bit() - { - compilerTask.Platform = "x86"; - compilerTask.Execute(); - - Assert.AreEqual(PortableExecutableKinds.ILOnly | PortableExecutableKinds.Required32Bit, mockCompiler.ExecutableKind); - } - - [Test] - public void MachineWhenExecutableIsCompiledTo32Bit() - { - compilerTask.Platform = "x86"; - compilerTask.Execute(); - - Assert.AreEqual(ImageFileMachine.I386, mockCompiler.Machine); - } - - [Test] - public void ExecutableIsCompiledToItanium() - { - compilerTask.Platform = "Itanium"; - compilerTask.Execute(); - - Assert.AreEqual(PortableExecutableKinds.ILOnly | PortableExecutableKinds.PE32Plus, mockCompiler.ExecutableKind); - } - - [Test] - public void MachineWhenExecutableIsCompiledToItanium() - { - compilerTask.Platform = "Itanium"; - compilerTask.Execute(); - - Assert.AreEqual(ImageFileMachine.IA64, mockCompiler.Machine); - } - - [Test] - public void ExecutableIsCompiledTo64Bit() - { - compilerTask.Platform = "x64"; - compilerTask.Execute(); - - Assert.AreEqual(PortableExecutableKinds.ILOnly | PortableExecutableKinds.PE32Plus, mockCompiler.ExecutableKind); - } - - [Test] - public void MachineWhenExecutableIsCompiledTo64Bit() - { - compilerTask.Platform = "x64"; - compilerTask.Execute(); - - Assert.AreEqual(ImageFileMachine.AMD64, mockCompiler.Machine); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/Python.Build.Tasks.Tests.csproj b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/Python.Build.Tasks.Tests.csproj deleted file mode 100644 index deffa1633a4..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/Python.Build.Tasks.Tests.csproj +++ /dev/null @@ -1,90 +0,0 @@ - - - - {833904AB-3CD4-4071-9B48-5770E44685AA} - Debug - AnyCPU - Library - Python.Build.Tasks.Tests - Python.Build.Tasks.Tests - False - False - 4 - false - v4.0 - - - ..\..\..\..\..\..\bin\UnitTests\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\..\bin\UnitTests\ - false - None - False - TRACE - False - - - False - Auto - 4194304 - x86 - 4096 - - - - - ..\..\RequiredLibraries\IronPython.dll - - - - - - 3.5 - - - ..\..\RequiredLibraries\Microsoft.Dynamic.dll - - - ..\..\RequiredLibraries\Microsoft.Scripting.dll - - - ..\..\..\..\..\Tools\NUnit\nunit.framework.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - {D332F2D1-2CF1-43B7-903C-844BD5211A7E} - Python.Build.Tasks - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PythonCompilerTests.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PythonCompilerTests.cs deleted file mode 100644 index a692ad75b92..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/PythonCompilerTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - [TestFixture] - public class PythonCompilerTests - { - [Test] - public void NoMainFileSpecifiedForWindowsApplication() - { - try { - PythonCompiler compiler = new PythonCompiler(); - compiler.TargetKind = PEFileKinds.WindowApplication; - compiler.OutputAssembly = "test.exe"; - compiler.SourceFiles = new string[0]; - compiler.MainFile = null; - compiler.Compile(); - - Assert.Fail("Expected PythonCompilerException."); - } catch (PythonCompilerException ex) { - Assert.AreEqual(Resources.NoMainFileSpecified, ex.Message); - } - } - - [Test] - public void NoMainSpecifiedForLibraryThrowsNoError() - { - PythonCompiler compiler = new PythonCompiler(); - compiler.TargetKind = PEFileKinds.Dll; - compiler.OutputAssembly = "test.dll"; - compiler.SourceFiles = new string[0]; - compiler.MainFile = null; - compiler.VerifyParameters(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeReferenceTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeReferenceTestFixture.cs deleted file mode 100644 index df3314470ec..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeReferenceTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that references with a relative path are converted to a full path before being - /// passed to the PythonCompiler. - /// - [TestFixture] - public class RelativeReferenceTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem referenceTaskItem; - TaskItem fullPathReferenceTaskItem; - DummyPythonCompilerTask compiler; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - referenceTaskItem = new TaskItem(@"..\RequiredLibraries\MyReference.dll"); - fullPathReferenceTaskItem = new TaskItem(@"C:\Projects\Test\MyTest.dll"); - compiler.References = new ITaskItem[] {referenceTaskItem, fullPathReferenceTaskItem}; - - compiler.Execute(); - } - - [Test] - public void RelativePathReferenceItemPassedToCompilerWithFullPath() - { - string fileName = mockCompiler.ReferencedAssemblies[0]; - Assert.AreEqual(@"C:\Projects\RequiredLibraries\MyReference.dll", fileName); - } - - [Test] - public void FullPathReferenceItemUnchangedWhenPassedToCompiler() - { - string fileName = mockCompiler.ReferencedAssemblies[1]; - Assert.AreEqual(fullPathReferenceTaskItem.ItemSpec, fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeResourceFileTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeResourceFileTestFixture.cs deleted file mode 100644 index b0d6d1695f0..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/RelativeResourceFileTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection.Emit; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that resoures with a relative path are converted to a full path before being - /// passed to the PythonCompiler. - /// - [TestFixture] - public class RelativeResourceFileTestFixture - { - MockPythonCompiler mockCompiler; - TaskItem resourceTaskItem; - TaskItem fullPathResourceTaskItem; - DummyPythonCompilerTask compiler; - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - resourceTaskItem = new TaskItem(@"..\RequiredLibraries\MyResource.resx"); - fullPathResourceTaskItem = new TaskItem(@"C:\Projects\Test\MyTest.resx"); - compiler.Resources = new ITaskItem[] {resourceTaskItem, fullPathResourceTaskItem}; - - compiler.Execute(); - } - - [Test] - public void RelativePathReferenceItemPassedToCompilerWithFullPath() - { - string fileName = mockCompiler.ResourceFiles[0].FileName; - Assert.AreEqual(@"C:\Projects\RequiredLibraries\MyResource.resx", fileName); - } - - [Test] - public void FullPathReferenceItemUnchangedWhenPassedToCompiler() - { - string fileName = mockCompiler.ResourceFiles[1].FileName; - Assert.AreEqual(fullPathResourceTaskItem.ItemSpec, fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorFileNameWithDotCharTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorFileNameWithDotCharTestFixture.cs deleted file mode 100644 index d921239ea4e..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorFileNameWithDotCharTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Runtime; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// If the project has a filename with a dot character in it (e.g. Resources.Designer.py) and this file - /// has a syntax error then IronPython's ClrModule.CompileModules method will throw a syntax error exception but the - /// filename will have a '\' replacing the dot character (i.e. Resources\Designer.py). - /// - [TestFixture] - public class SyntaxErrorFileNameWithDotCharTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [TestFixtureSetUp] - public void SetUpFixture() - { - ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); - } - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\PythonApp.Program.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - SourceUnit source = DefaultContext.DefaultPythonContext.CreateSourceUnit(NullTextContentProvider.Null, @"PythonApp\Program", SourceCodeKind.InteractiveCode); - - SourceLocation start = new SourceLocation(0, 1, 1); - SourceLocation end = new SourceLocation(0, 2, 3); - SourceSpan span = new SourceSpan(start, end); - SyntaxErrorException ex = new SyntaxErrorException("Error", source, span, 1000, Severity.FatalError); - mockCompiler.ThrowExceptionAtCompile = ex; - - success = compiler.Execute(); - } - - [Test] - public void SourceFile() - { - Assert.AreEqual(@"D:\Projects\MyProject\PythonApp.Program.py", compiler.LoggedErrorFile); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorNullFileNameTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorNullFileNameTestFixture.cs deleted file mode 100644 index f3fbb2c8f39..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorNullFileNameTestFixture.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Runtime; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - [TestFixture] - public class SyntaxErrorNullFileNameTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [TestFixtureSetUp] - public void SetUpFixture() - { - ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); - } - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\test.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - SourceUnit source = DefaultContext.DefaultPythonContext.CreateSourceUnit(NullTextContentProvider.Null, @"test", SourceCodeKind.InteractiveCode); - - SyntaxErrorException ex = new SyntaxErrorException("Error", null, SourceSpan.None, 1000, Severity.FatalError); - mockCompiler.ThrowExceptionAtCompile = ex; - - success = compiler.Execute(); - } - - [Test] - public void IsExceptionMessageLogged() - { - Assert.AreEqual("Error", compiler.LoggedErrorMessage); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorTestFixture.cs deleted file mode 100644 index 0d2ef5ee667..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorTestFixture.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Runtime; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// Tests that a syntax error exception is caught and logged. - /// - [TestFixture] - public class SyntaxErrorTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [TestFixtureSetUp] - public void SetUpFixture() - { - ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); - } - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"C:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\test.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - SourceUnit source = DefaultContext.DefaultPythonContext.CreateSourceUnit(NullTextContentProvider.Null, @"test", SourceCodeKind.InteractiveCode); - - SourceLocation start = new SourceLocation(0, 1, 1); - SourceLocation end = new SourceLocation(0, 2, 3); - SourceSpan span = new SourceSpan(start, end); - SyntaxErrorException ex = new SyntaxErrorException("Error", source, span, 1000, Severity.FatalError); - mockCompiler.ThrowExceptionAtCompile = ex; - - success = compiler.Execute(); - } - - [Test] - public void ExecuteFailed() - { - Assert.IsFalse(success); - } - - [Test] - public void IsExceptionMessageLogged() - { - Assert.AreEqual("Error", compiler.LoggedErrorMessage); - } - - [Test] - public void IsErrorCodeLogged() - { - Assert.AreEqual("1000", compiler.LoggedErrorCode); - } - - [Test] - public void SourceFile() - { - Assert.AreEqual(@"D:\Projects\MyProject\test.py", compiler.LoggedErrorFile); - } - - [Test] - public void SourceStartLine() - { - Assert.AreEqual(1, compiler.LoggedStartLine); - } - - [Test] - public void SourceStartColumn() - { - Assert.AreEqual(1, compiler.LoggedStartColumn); - } - - [Test] - public void SourceEndLine() - { - Assert.AreEqual(2, compiler.LoggedEndLine); - } - - [Test] - public void SourceEndColumn() - { - Assert.AreEqual(3, compiler.LoggedEndColumn); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorUnknownFileNameTestFixture.cs b/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorUnknownFileNameTestFixture.cs deleted file mode 100644 index 0936c472073..00000000000 --- a/src/AddIns/BackendBindings/Python/Python.Build.Tasks/Test/SyntaxErrorUnknownFileNameTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using IronPython.Runtime; -using ICSharpCode.Python.Build.Tasks; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace Python.Build.Tasks.Tests -{ - /// - /// If the filename returned from the SyntaxErrorException cannot be found in the project then - /// just use the project's folder concatenated with the filename. - /// - [TestFixture] - public class SyntaxErrorUnknownFileNameTestFixture - { - MockPythonCompiler mockCompiler; - DummyPythonCompilerTask compiler; - bool success; - - [TestFixtureSetUp] - public void SetUpFixture() - { - ScriptEngine engine = IronPython.Hosting.Python.CreateEngine(); - } - - [SetUp] - public void Init() - { - mockCompiler = new MockPythonCompiler(); - compiler = new DummyPythonCompilerTask(mockCompiler, @"D:\Projects\MyProject"); - compiler.TargetType = "Exe"; - compiler.OutputAssembly = "test.exe"; - - TaskItem sourceFile = new TaskItem(@"D:\Projects\MyProject\test.py"); - compiler.Sources = new ITaskItem[] {sourceFile}; - - SourceUnit source = DefaultContext.DefaultPythonContext.CreateSourceUnit(NullTextContentProvider.Null, @"test\unknown", SourceCodeKind.InteractiveCode); - - SourceLocation start = new SourceLocation(0, 1, 1); - SourceLocation end = new SourceLocation(0, 2, 3); - SourceSpan span = new SourceSpan(start, end); - SyntaxErrorException ex = new SyntaxErrorException("Error", source, span, 1000, Severity.FatalError); - mockCompiler.ThrowExceptionAtCompile = ex; - - success = compiler.Execute(); - } - - [Test] - public void SourceFile() - { - Assert.AreEqual(@"D:\Projects\MyProject\test.unknown.py", compiler.LoggedErrorFile); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding.sln b/src/AddIns/BackendBindings/Python/PythonBinding.sln deleted file mode 100644 index 2b9b97c3ca3..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding.sln +++ /dev/null @@ -1,206 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -# SharpDevelop 4.3 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding", "PythonBinding\Project\PythonBinding.csproj", "{8D732610-8FC6-43BA-94C9-7126FD7FE361}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding.Tests", "PythonBinding\Test\PythonBinding.Tests.csproj", "{23B517C9-1ECC-4419-A13F-0B7136D085CB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Build.Tasks", "Python.Build.Tasks\Project\Python.Build.Tasks.csproj", "{D332F2D1-2CF1-43B7-903C-844BD5211A7E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Build.Tasks.Tests", "Python.Build.Tasks\Test\Python.Build.Tasks.Tests.csproj", "{833904AB-3CD4-4071-9B48-5770E44685AA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", "..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj", "{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Presentation", "..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj", "{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "..\..\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting.Tests", "..\..\Analysis\UnitTesting\Test\UnitTesting.Tests.csproj", "{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting", "..\Scripting\Project\ICSharpCode.Scripting.csproj", "{7048AE18-EB93-4A84-82D0-DD60EB58ADBD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting.Tests", "..\Scripting\Test\ICSharpCode.Scripting.Tests.csproj", "{85C09AD8-183B-403A-869A-7226646218A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PyWalker", "PyWalker\PyWalker.csproj", "{55329704-6046-48EC-8A20-5C80B3092A63}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Release|Any CPU.Build.0 = Release|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Release|Any CPU.Build.0 = Release|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Release|Any CPU.Build.0 = Release|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Release|Any CPU.Build.0 = Release|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.Build.0 = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.Build.0 = Release|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.Build.0 = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.Build.0 = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.ActiveCfg = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.Build.0 = Release|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.Build.0 = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.Build.0 = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|Any CPU.Build.0 = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|Any CPU.ActiveCfg = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Any CPU.Build.0 = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Any CPU.ActiveCfg = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|x86.Build.0 = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|x86.ActiveCfg = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.Build.0 = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.ActiveCfg = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|Any CPU.Build.0 = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|Any CPU.ActiveCfg = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|x86.Build.0 = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|x86.ActiveCfg = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|Any CPU.Build.0 = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|Any CPU.ActiveCfg = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|x86.Build.0 = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|x86.ActiveCfg = Release|x86 - {55329704-6046-48EC-8A20-5C80B3092A63}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Debug|x86.Build.0 = Debug|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Debug|x86.ActiveCfg = Debug|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Release|Any CPU.Build.0 = Release|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Release|x86.Build.0 = Release|Any CPU - {55329704-6046-48EC-8A20-5C80B3092A63}.Release|x86.ActiveCfg = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|x86.Build.0 = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|x86.ActiveCfg = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|x86.Build.0 = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|x86.ActiveCfg = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.Build.0 = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.ActiveCfg = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.Build.0 = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.ActiveCfg = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.Build.0 = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.ActiveCfg = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.Build.0 = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.ActiveCfg = Release|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.Build.0 = Debug|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.ActiveCfg = Debug|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.Build.0 = Release|Any CPU - {8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.ActiveCfg = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.Build.0 = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.ActiveCfg = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.Build.0 = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.ActiveCfg = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.Build.0 = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.ActiveCfg = Release|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.Build.0 = Debug|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.ActiveCfg = Debug|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.Build.0 = Release|Any CPU - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.ActiveCfg = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.Build.0 = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.ActiveCfg = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.Build.0 = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.ActiveCfg = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.Build.0 = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.ActiveCfg = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.Build.0 = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.ActiveCfg = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.Build.0 = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.ActiveCfg = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.Build.0 = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.ActiveCfg = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|x86.Build.0 = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|x86.ActiveCfg = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|x86.Build.0 = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|x86.ActiveCfg = Release|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Debug|x86.Build.0 = Debug|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Release|x86.Build.0 = Release|Any CPU - {833904AB-3CD4-4071-9B48-5770E44685AA}.Release|x86.ActiveCfg = Release|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Debug|x86.Build.0 = Debug|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Debug|x86.ActiveCfg = Debug|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Release|x86.Build.0 = Release|Any CPU - {D332F2D1-2CF1-43B7-903C-844BD5211A7E}.Release|x86.ActiveCfg = Release|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Debug|x86.Build.0 = Debug|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Debug|x86.ActiveCfg = Debug|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Release|x86.Build.0 = Release|Any CPU - {23B517C9-1ECC-4419-A13F-0B7136D085CB}.Release|x86.ActiveCfg = Release|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Debug|x86.Build.0 = Debug|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Debug|x86.ActiveCfg = Debug|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Release|x86.Build.0 = Release|Any CPU - {8D732610-8FC6-43BA-94C9-7126FD7FE361}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Configuration/AssemblyInfo.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Configuration/AssemblyInfo.cs deleted file mode 100644 index e765f062dd0..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System.Reflection; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PythonBinding")] -[assembly: AssemblyDescription("IronPython addin for SharpDevelop.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/__future__.py b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/__future__.py deleted file mode 100644 index 4b9df43d5e3..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/__future__.py +++ /dev/null @@ -1,25 +0,0 @@ -##################################################################################### -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# This source code is subject to terms and conditions of the Microsoft Public License. A -# copy of the license can be found in the License.html file at the root of this distribution. If -# you cannot locate the Microsoft Public License, please send an email to -# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound -# by the terms of the Microsoft Public License. -# -# You must not remove this notice, or any other, from this software. -# -# -##################################################################################### - -all_feature_names = ['nested_scopes', 'generators', 'division', - 'absolute_import', 'with_statement', 'print_function', - 'unicode_literals'] - -division=1 -with_statement=1 -generators=1 -absolute_import=1 -print_function=1 -unicode_literals=1 diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/runpy.py b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/runpy.py deleted file mode 100644 index 451562244fa..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/runpy.py +++ /dev/null @@ -1,31 +0,0 @@ -##################################################################################### -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# This source code is subject to terms and conditions of the Microsoft Public License. A -# copy of the license can be found in the License.html file at the root of this distribution. If -# you cannot locate the Microsoft Public License, please send an email to -# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound -# by the terms of the Microsoft Public License. -# -# You must not remove this notice, or any other, from this software. -# -# -##################################################################################### - -""" -Fake runpy.py which emulates what CPython does to properly support the '-m' flag. -If you have access to the CPython standard library, you most likely do not need this. -""" - -import sys, nt - -def run_module(modToRun, init_globals=None, run_name = '__main__', alter_sys = True): - if alter_sys: - for o in sys.path: - libpath = o + '\\' + modToRun + '.py' - if nt.access(libpath, nt.F_OK): - sys.argv[0] = libpath - break - - __import__(modToRun) diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/site.py b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/site.py deleted file mode 100644 index 07581427f69..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Lib/site.py +++ /dev/null @@ -1,14 +0,0 @@ -##################################################################################### -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# This source code is subject to terms and conditions of the Microsoft Public License. A -# copy of the license can be found in the License.html file at the root of this distribution. If -# you cannot locate the Microsoft Public License, please send an email to -# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound -# by the terms of the Microsoft Public License. -# -# You must not remove this notice, or any other, from this software. -# -# -##################################################################################### diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin deleted file mode 100644 index 529aea81d83..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj deleted file mode 100644 index dd2fef1d06a..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj +++ /dev/null @@ -1,319 +0,0 @@ - - - - {8D732610-8FC6-43BA-94C9-7126FD7FE361} - Debug - AnyCPU - Library - ICSharpCode.PythonBinding - PythonBinding - False - False - 4 - false - v4.0 - - - - - ..\..\..\..\..\..\AddIns\BackendBindings\PythonBinding\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\..\AddIns\BackendBindings\PythonBinding\ - false - None - False - TRACE - False - - - False - Auto - 4194304 - x86 - 4096 - - - - - ..\..\RequiredLibraries\Chiron.exe - - - ..\..\RequiredLibraries\ipy.exe - - - ..\..\RequiredLibraries\IronPython.dll - True - - - ..\..\RequiredLibraries\IronPython.Modules.dll - True - - - ..\..\RequiredLibraries\Microsoft.Dynamic.dll - True - - - ..\..\RequiredLibraries\Microsoft.Scripting.dll - True - - - ..\..\RequiredLibraries\Microsoft.Scripting.Metadata.dll - True - - - 3.0 - - - 3.0 - - - - 3.5 - - - - - - 4.0 - - - - 3.0 - - - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PythonOptionsPanel.xaml - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chiron.exe.Config - Always - - - DLLs\IronPython.Wpf.dll - Always - - - License.Rtf - Always - - - Always - - - Always - - - Always - - - Always - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - - - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} - ICSharpCode.AvalonEdit - False - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - False - - - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} - ICSharpCode.Core.Presentation - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - False - - - {8035765F-D51F-4A0C-A746-2FD100E19419} - ICSharpCode.SharpDevelop.Widgets - - - {1F261725-6318-4434-A1B1-6C70CE4CD324} - UnitTesting - False - - - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} - FormsDesigner - False - - - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD} - ICSharpCode.Scripting - False - - - - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/ApplicationSettingsPanel.xfrm b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/ApplicationSettingsPanel.xfrm deleted file mode 100644 index 25b9056d0e6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/ApplicationSettingsPanel.xfrm +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/CompilingOptionsPanel.xfrm b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/CompilingOptionsPanel.xfrm deleted file mode 100644 index c972ec65db1..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/CompilingOptionsPanel.xfrm +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/Python.xshd b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/Python.xshd deleted file mode 100644 index 2f7076e5c41..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Resources/Python.xshd +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - """ - """ - - - - ''' - ''' - - - - \# - - - - " - " - - - - - - - - ' - ' - - - - - - - - assert - del - exec - global - lambda - print - - - - class - - - - except - finally - raise - try - - - - def - - - - import - from - - - - for - in - while - - - - break - continue - yield - return - - - - and - as - is - not - or - - - - pass - - - - elif - else - if - - - - with - - - - None - - - \b[\d\w_]+(?=(\s*\()) - \b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)? - - - [?,.;()\[\]{}+\-/%*<>^+~!|&]+ - - - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs deleted file mode 100644 index e8f7cc724c8..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/AddInOptions.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.IO; -using ICSharpCode.Core; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Holds the options for the PythonBinding AddIn - /// - public class PythonAddInOptions - { - /// - /// The name of the options as read from the PropertyService. - /// - public static readonly string AddInOptionsName = "PythonBinding.Options"; - - /// - /// The default python console filename. - /// - public static readonly string DefaultPythonFileName = "ipy.exe"; - - #region Property names - public static readonly string PythonFileNameProperty = "PythonFileName"; - public static readonly string PythonLibraryPathProperty = "PythonLibraryPath"; - #endregion - - Properties properties; - - public PythonAddInOptions() - : this(PropertyService.Get(AddInOptionsName, new Properties())) - { - } - - /// - /// Creates the addin options class which will use - /// the options from the properties class specified. - /// - public PythonAddInOptions(Properties properties) - { - this.properties = properties; - } - - public string PythonLibraryPath { - get { return properties.Get(PythonLibraryPathProperty, String.Empty); } - set { properties.Set(PythonLibraryPathProperty, value); } - } - - public bool HasPythonLibraryPath { - get { return !String.IsNullOrEmpty(PythonLibraryPath); } - } - - /// - /// Gets or sets the python console filename. - /// - public string PythonFileName { - get { return properties.Get(PythonFileNameProperty, GetDefaultPythonFileName()); } - set { - if (String.IsNullOrEmpty(value)) { - properties.Set(PythonFileNameProperty, GetDefaultPythonFileName()); - } else { - properties.Set(PythonFileNameProperty, value); - } - } - } - - /// - /// Returns the full path to ipyw.exe which is installed in the - /// Python addin folder. - /// - string GetDefaultPythonFileName() - { - string path = GetPythonBindingAddInPath(); - return Path.Combine(path, DefaultPythonFileName); - } - - string GetPythonBindingAddInPath() - { - return StringParser.Parse("${addinpath:ICSharpCode.PythonBinding}"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ApplicationSettingsPanel.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ApplicationSettingsPanel.cs deleted file mode 100644 index 11aabd8e216..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ApplicationSettingsPanel.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui.OptionPanels; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Python project's application settings panel. - /// - public class ApplicationSettingsPanel : AbstractXmlFormsProjectOptionPanel - { - const string AssemblyTextBoxName = "assemblyNameTextBox"; - const string RootNamespaceTextBoxName = "rootNamespaceTextBox"; - const string OutputTypeComboBoxName = "outputTypeComboBox"; - const string MainFileComboBoxName = "mainFileComboBox"; - - public override void LoadPanelContents() - { - SetupFromManifestResource("ICSharpCode.PythonBinding.Resources.ApplicationSettingsPanel.xfrm"); - InitializeHelper(); - - ConfigurationGuiBinding b = BindString(AssemblyTextBoxName, "AssemblyName", TextBoxEditMode.EditEvaluatedProperty); - CreateLocationButton(b, AssemblyTextBoxName); - AssemblyNameTextBox.TextChanged += AssemblyNameTextBoxTextChanged; - - b = BindString(RootNamespaceTextBoxName, "RootNamespace", TextBoxEditMode.EditEvaluatedProperty); - CreateLocationButton(b, RootNamespaceTextBoxName); - - b = BindEnum(OutputTypeComboBoxName, "OutputType"); - CreateLocationButton(b, OutputTypeComboBoxName); - OutputTypeComboBox.SelectedIndexChanged += OutputTypeComboBoxSelectedIndexChanged; - - b = BindString(MainFileComboBoxName, "MainFile", TextBoxEditMode.EditEvaluatedProperty); - CreateLocationButton(b, MainFileComboBoxName); - ConnectBrowseButtonControl("mainFileBrowseButton", "mainFileComboBox", - "${res:SharpDevelop.FileFilter.AllFiles}|*.*", - TextBoxEditMode.EditEvaluatedProperty); - - Get("projectFolder").Text = project.Directory; - Get("projectFile").Text = Path.GetFileName(project.FileName); - Get("projectFile").ReadOnly = true; - - RefreshOutputNameTextBox(); - AddConfigurationSelector(this); - } - - /// - /// Calls SetupFromXmlStream after creating a stream from the current - /// assembly using the specified manifest resource name. - /// - /// The manifest resource name used - /// to create the stream. - protected virtual void SetupFromManifestResource(string resource) - { - SetupFromXmlStream(typeof(ApplicationSettingsPanel).Assembly.GetManifestResourceStream(resource)); - } - - /// - /// Binds the string property to a text box control. - /// - protected virtual ConfigurationGuiBinding BindString(string control, string property, TextBoxEditMode textBoxEditMode) - { - return helper.BindString(control, property, textBoxEditMode); - } - - /// - /// Binds an enum property to a control. - /// - protected virtual ConfigurationGuiBinding BindEnum(string control, string property) where T : struct - { - return helper.BindEnum(control, property); - } - - /// - /// Associates a location button with a control. - /// - protected virtual ChooseStorageLocationButton CreateLocationButton(ConfigurationGuiBinding binding, string controlName) - { - return binding.CreateLocationButton(controlName); - } - - /// - /// Adds a configuration selector to the specified control. - /// - protected virtual void AddConfigurationSelector(Control control) - { - helper.AddConfigurationSelector(control); - } - - /// - /// Connects the browse button control to the target control. - /// - protected virtual void ConnectBrowseButtonControl(string browseButton, string target, string fileFilter, TextBoxEditMode textBoxEditMode) - { - ConnectBrowseButton(browseButton, target, fileFilter, textBoxEditMode); - } - - /// - /// Refreshes the output name text box after the assembly name - /// has changed. - /// - protected void AssemblyNameTextBoxTextChanged(object source, EventArgs e) - { - RefreshOutputNameTextBox(); - } - - /// - /// Refreshes the output name text box after the output type has changed. - /// - protected void OutputTypeComboBoxSelectedIndexChanged(object source, EventArgs e) - { - RefreshOutputNameTextBox(); - } - - /// - /// Updates the output name text box based on the assembly name and - /// output type. - /// - void RefreshOutputNameTextBox() - { - string assemblyName = AssemblyNameTextBox.Text; - string extension = CompilableProject.GetExtension((OutputType)OutputTypeComboBox.SelectedIndex); - Get("outputName").Text = String.Concat(assemblyName, extension); - } - - TextBox AssemblyNameTextBox { - get { return Get("assemblyName"); } - } - - ComboBox OutputTypeComboBox { - get { return Get("outputType"); } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CompilingOptionsPanel.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CompilingOptionsPanel.cs deleted file mode 100644 index c187b0c694a..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/CompilingOptionsPanel.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui.OptionPanels; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Python project's compiling options panel. - /// - public class CompilingOptionsPanel : AbstractBuildOptions - { - public override void LoadPanelContents() - { - SetupFromManifestResource("ICSharpCode.PythonBinding.Resources.CompilingOptionsPanel.xfrm"); - InitializeHelper(); - - ConfigurationGuiBinding b = BindString("outputPathTextBox", "OutputPath", TextBoxEditMode.EditRawProperty); - CreateLocationButton(b, "outputPathTextBox"); - ConnectBrowseFolderButtonControl("outputPathBrowseButton", "outputPathTextBox", "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", TextBoxEditMode.EditRawProperty); - - b = BindBoolean("debugInfoCheckBox", "DebugInfo", false); - CreateLocationButton(b, "debugInfoCheckBox"); - - b = CreatePlatformTargetComboBox(); - CreateLocationButton(b, "targetCpuComboBox"); - - AddConfigurationSelector(this); - } - - /// - /// Calls SetupFromXmlStream after creating a stream from the current - /// assembly using the specified manifest resource name. - /// - /// The manifest resource name used - /// to create the stream. - protected virtual void SetupFromManifestResource(string resource) - { - SetupFromXmlStream(typeof(CompilingOptionsPanel).Assembly.GetManifestResourceStream(resource)); - } - - /// - /// Binds the string property to a text box control. - /// - protected virtual ConfigurationGuiBinding BindString(string control, string property, TextBoxEditMode textBoxEditMode) - { - return helper.BindString(control, property, textBoxEditMode); - } - - /// - /// Binds the boolean property to a check box control. - /// - protected virtual ConfigurationGuiBinding BindBoolean(string control, string property, bool defaultValue) - { - return helper.BindBoolean(control, property, defaultValue); - } - - /// - /// Associates a location button with a control. - /// - protected virtual ChooseStorageLocationButton CreateLocationButton(ConfigurationGuiBinding binding, string controlName) - { - return binding.CreateLocationButton(controlName); - } - - /// - /// Connects the browse folder button control to the target control. - /// - protected virtual void ConnectBrowseFolderButtonControl(string browseButton, string target, string description, TextBoxEditMode textBoxEditMode) - { - ConnectBrowseFolder(browseButton, target, description, textBoxEditMode); - } - - /// - /// Adds a configuration selector to the specified control. - /// - protected virtual void AddConfigurationSelector(Control control) - { - helper.AddConfigurationSelector(control); - } - - /// - /// Creates the platform target combo box. - /// - protected virtual ConfigurationGuiBinding CreatePlatformTargetComboBox() - { - return base.CreatePlatformTarget(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConstructorInfo.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConstructorInfo.cs deleted file mode 100644 index a65c316461f..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConstructorInfo.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.NRefactory.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConstructorInfo - { - ConstructorDeclaration constructor; - List fields = new List(); - - PythonConstructorInfo(ConstructorDeclaration constructor, List fields) - { - this.constructor = constructor; - this.fields = fields; - } - - /// - /// Gets the constructor information from a type declaration. Returns null if there is no - /// constructor defined or if there are no fields defined. - /// - public static PythonConstructorInfo GetConstructorInfo(TypeDeclaration type) - { - List fields = new List(); - ConstructorDeclaration constructor = null; - foreach (INode node in type.Children) { - ConstructorDeclaration currentConstructor = node as ConstructorDeclaration; - FieldDeclaration field = node as FieldDeclaration; - if (currentConstructor != null) { - constructor = currentConstructor; - } else if (field != null) { - fields.Add(field); - } - } - - if ((fields.Count > 0) || (constructor != null)) { - return new PythonConstructorInfo(constructor, fields); - } - return null; - } - - public ConstructorDeclaration Constructor { - get { return constructor; } - } - - public List Fields { - get { return fields; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertProjectToPythonProjectCommand.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertProjectToPythonProjectCommand.cs deleted file mode 100644 index 18426bb05e6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertProjectToPythonProjectCommand.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.IO; -using System.Text; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.SharpDevelop.Project.Converter; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Converts a C# or VB.NET project to Python. - /// - public class ConvertProjectToPythonProjectCommand : LanguageConverter - { - public override string TargetLanguageName { - get { return PythonProjectBinding.LanguageName; } - } - - /// - /// Creates an PythonProject. - /// - protected override IProject CreateProject(string targetProjectDirectory, IProject sourceProject) - { - // Add IronPython reference. - PythonProject targetProject = (PythonProject)base.CreateProject(targetProjectDirectory, sourceProject); - IProjectItemListProvider targetProjectItems = targetProject as IProjectItemListProvider; - targetProjectItems.AddProjectItem(CreateIronPythonReference(targetProject)); - return targetProject; - } - - /// - /// Converts C# and VB.NET files to Python and saves the files. - /// - protected override void ConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem) - { - NRefactoryToPythonConverter converter = NRefactoryToPythonConverter.Create(sourceItem.Include); - if (converter != null) { - targetItem.Include = ChangeFileExtensionToPythonFileExtension(sourceItem.Include); - - string code = GetParseableFileContent(sourceItem.FileName); - string pythonCode = converter.Convert(code); - - PythonProject pythonTargetProject = (PythonProject)targetItem.Project; - if ((converter.EntryPointMethods.Count > 0) && !pythonTargetProject.HasMainFile) { - pythonTargetProject.AddMainFile(targetItem.Include); - - // Add code to call main method at the end of the file. - pythonCode += "\r\n\r\n" + converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - } - - SaveFile(targetItem.FileName, pythonCode, GetDefaultFileEncoding()); - } else { - LanguageConverterConvertFile(sourceItem, targetItem); - } - } - - /// - /// Adds the MainFile property since adding it in the CreateProject method would mean - /// it gets removed via the base class CopyProperties method. - /// - protected override void CopyProperties(IProject sourceProject, IProject targetProject) - { - base.CopyProperties(sourceProject, targetProject); - AddMainFile(sourceProject, (PythonProject)targetProject); - } - - /// - /// Calls the LanguageConverter class method ConvertFile which copies the source file to the target - /// file without any modifications. - /// - protected virtual void LanguageConverterConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem) - { - base.ConvertFile(sourceItem, targetItem); - } - - /// - /// Writes the specified file to disk. - /// - protected virtual void SaveFile(string fileName, string content, Encoding encoding) - { - File.WriteAllText(fileName, content, encoding); - } - - protected virtual Encoding GetDefaultFileEncoding() - { - return FileService.DefaultFileEncoding.GetEncoding(); - } - - /// - /// Gets the content of the file from the parser service. - /// - protected virtual string GetParseableFileContent(string fileName) - { - return ParserService.GetParseableFileContent(fileName).Text; - } - - /// - /// Gets the project content for the specified project. - /// - protected virtual IProjectContent GetProjectContent(IProject project) - { - return ParserService.GetProjectContent(project); - } - - ReferenceProjectItem CreateIronPythonReference(IProject project) - { - ReferenceProjectItem reference = new ReferenceProjectItem(project, "IronPython"); - reference.SetMetadata("HintPath", @"$(PythonBinPath)\IronPython.dll"); - return reference; - } - - /// - /// Adds a MainFile if the source project has a StartupObject. - /// - void AddMainFile(IProject sourceProject, PythonProject targetProject) - { - string startupObject = GetStartupObject(sourceProject); - if (startupObject != null) { - IClass c = FindClass(sourceProject, startupObject); - if (c != null) { - string fileName = FileUtility.GetRelativePath(sourceProject.Directory, c.CompilationUnit.FileName); - targetProject.AddMainFile(ChangeFileExtensionToPythonFileExtension(fileName)); - } - } - } - - string GetStartupObject(IProject project) - { - MSBuildBasedProject msbuildProject = project as MSBuildBasedProject; - if (msbuildProject != null) { - return msbuildProject.GetProperty(null, null, "StartupObject"); - } - return null; - } - - IClass FindClass(IProject project, string name) - { - return GetProjectContent(project).GetClass(name, 0); - } - - /// - /// Changes the extension to ".py" - /// - static string ChangeFileExtensionToPythonFileExtension(string fileName) - { - return Path.ChangeExtension(fileName, ".py"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertToPythonMenuCommand.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertToPythonMenuCommand.cs deleted file mode 100644 index c2696255076..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/ConvertToPythonMenuCommand.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Converts VB.NET or C# code to Python. - /// - public class ConvertToPythonMenuCommand : AbstractMenuCommand - { - ScriptingTextEditorViewContent view; - - public override void Run() - { - Run(new PythonWorkbench()); - } - - protected void Run(IScriptingWorkbench workbench) - { - view = new ScriptingTextEditorViewContent(workbench); - string code = GeneratePythonCode(); - ShowPythonCodeInNewWindow(code); - } - - string GeneratePythonCode() - { - NRefactoryToPythonConverter converter = NRefactoryToPythonConverter.Create(view.PrimaryFileName); - converter.IndentString = view.TextEditorOptions.IndentationString; - return converter.Convert(view.EditableView.Text); - } - - void ShowPythonCodeInNewWindow(string code) - { - NewFile("Generated.py", "Python", code); - } - - /// - /// Creates a new file using the FileService by default. - /// - protected virtual void NewFile(string defaultName, string language, string content) - { - FileService.NewFile(defaultName, content); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonResolver.cs deleted file mode 100644 index 96e364fc04e..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonResolver.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public interface IPythonResolver - { - ResolveResult Resolve(PythonResolverContext resolverContext); - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/MemberName.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/MemberName.cs deleted file mode 100644 index f3af28dfbdb..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/MemberName.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Split up an expression into a member name and a type name. - /// - /// - /// "myObject.Field" => "myObject" + "Field" - /// "System.Console.WriteLine" => "System.Console" + "Console.WriteLine" - /// - public class MemberName - { - string name = String.Empty; - string type = String.Empty; - - public MemberName(string expression) - { - Parse(expression); - } - - public MemberName(string typeName, string memberName) - { - this.type = typeName; - this.name = memberName; - } - - void Parse(string expression) - { - if (!String.IsNullOrEmpty(expression)) { - int index = expression.LastIndexOf('.'); - if (index > 0) { - type = expression.Substring(0, index); - name = expression.Substring(index + 1); - } else { - type = expression; - } - } - } - - public string Name { - get { return name; } - } - - public bool HasName { - get { return !String.IsNullOrEmpty(name); } - } - - public string Type { - get { return type; } - } - - public override string ToString() - { - return String.Format("Type: {0}, Member: {1}", type, name); - } - - public override bool Equals(object obj) - { - MemberName rhs = obj as MemberName; - if (rhs != null) { - return (name == rhs.name) && (type == rhs.type); - } - return false; - } - - public override int GetHashCode() - { - return name.GetHashCode() ^ type.GetHashCode(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/NRefactoryToPythonConverter.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/NRefactoryToPythonConverter.cs deleted file mode 100644 index 7d97f031f6f..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/NRefactoryToPythonConverter.cs +++ /dev/null @@ -1,2074 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Text; -using ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Ast; -using ICSharpCode.NRefactory.Parser; -using ICSharpCode.NRefactory.PrettyPrinter; -using ICSharpCode.NRefactory.Visitors; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Used to convert VB.NET and C# to Python. - /// - public class NRefactoryToPythonConverter : NodeTrackingAstVisitor, IOutputFormatter - { - string indentString = "\t"; - PythonCodeBuilder codeBuilder; - - // Holds the constructor for the class being converted. This is used to identify class fields. - PythonConstructorInfo constructorInfo; - - // Holds the parameters of the current method. This is used to identify - // references to fields or parameters. - List methodParameters = new List(); - MethodDeclaration currentMethod; - - // Holds the names of any parameters defined for this class. - List propertyNames = new List(); - - SupportedLanguage language; - List entryPointMethods; - - SpecialNodesInserter specialNodesInserter; - INode currentNode; - List xmlDocComments = new List(); - - static readonly string Docstring = "\"\"\""; - - public NRefactoryToPythonConverter(SupportedLanguage language) - { - this.language = language; - } - - public NRefactoryToPythonConverter() - { - } - - /// - /// Gets or sets the source language that will be converted to python. - /// - public SupportedLanguage SupportedLanguage { - get { return language; } - } - - /// - /// Creates either C# to Python or VB.NET to Python converter based on the filename extension that is to be converted. - /// - /// Null if the file cannot be converted. - public static NRefactoryToPythonConverter Create(string fileName) - { - if (CanConvert(fileName)) { - return new NRefactoryToPythonConverter(GetSupportedLanguage(fileName)); - } - return null; - } - - /// - /// Only C# (.cs) or VB.NET (.vb) files can be converted. - /// - public static bool CanConvert(string fileName) - { - string extension = Path.GetExtension(fileName); - if (!String.IsNullOrEmpty(extension)) { - extension = extension.ToLowerInvariant(); - return (extension == ".cs") || (extension == ".vb"); - } - return false; - } - - /// - /// Gets or sets the string that will be used to indent the generated Python code. - /// - public string IndentString { - get { return indentString; } - set { indentString = value; } - } - - /// - /// Generates compilation unit from the code. - /// - /// - /// Uses ISpecials so comments can be converted. - /// - /// - /// The code to convert to a compilation unit. - /// - public CompilationUnit GenerateCompilationUnit(string source, SupportedLanguage language) - { - using (IParser parser = ParserFactory.CreateParser(language, new StringReader(source))) { - parser.Parse(); - parser.CompilationUnit.UserData = parser.Lexer.SpecialTracker.RetrieveSpecials(); - return parser.CompilationUnit; - } - } - - /// - /// Converts the source code to Python. - /// - public string Convert(string source) - { - return Convert(source, language); - } - - /// - /// Converts the source code to Python. - /// - public string Convert(string source, SupportedLanguage language) - { - // Convert to NRefactory code DOM. - CompilationUnit unit = GenerateCompilationUnit(source, language); - - SpecialOutputVisitor specialOutputVisitor = new SpecialOutputVisitor(this); - specialNodesInserter = new SpecialNodesInserter(unit.UserData as List, specialOutputVisitor); - - // Convert to Python code. - entryPointMethods = new List(); - codeBuilder = new PythonCodeBuilder(); - codeBuilder.IndentString = indentString; - unit.AcceptVisitor(this, null); - - return codeBuilder.ToString().Trim(); - } - - /// - /// Gets a list of possible entry point methods found when converting the - /// python source code. - /// - public ReadOnlyCollection EntryPointMethods { - get { return entryPointMethods.AsReadOnly(); } - } - - /// - /// Generates code to call the main entry point. - /// - public string GenerateMainMethodCall(MethodDeclaration methodDeclaration) - { - StringBuilder code = new StringBuilder(); - code.Append(GetTypeName(methodDeclaration)); - code.Append('.'); - code.Append(methodDeclaration.Name); - code.Append('('); - if (methodDeclaration.Parameters.Count > 0) { - code.Append("None"); - } - code.Append(')'); - - return code.ToString(); - } - - /// - /// Converts from the NRefactory's binary operator type to a string. - /// - public static string GetBinaryOperator(BinaryOperatorType binaryOperatorType) - { - switch (binaryOperatorType) { - case BinaryOperatorType.Add: - return "+"; - case BinaryOperatorType.BitwiseAnd: - return "&"; - case BinaryOperatorType.BitwiseOr: - return "|"; - case BinaryOperatorType.Divide: - case BinaryOperatorType.DivideInteger: - return "/"; - case BinaryOperatorType.ShiftLeft: - return "<<"; - case BinaryOperatorType.ShiftRight: - return ">>"; - case BinaryOperatorType.GreaterThan: - return ">"; - case BinaryOperatorType.GreaterThanOrEqual: - return ">="; - case BinaryOperatorType.InEquality: - return "!="; - case BinaryOperatorType.LessThan: - return "<"; - case BinaryOperatorType.LessThanOrEqual: - return "<="; - case BinaryOperatorType.LogicalAnd: - return "and"; - case BinaryOperatorType.LogicalOr: - return "or"; - case BinaryOperatorType.ExclusiveOr: - return "^"; - case BinaryOperatorType.Modulus: - return "%"; - case BinaryOperatorType.Multiply: - return "*"; - case BinaryOperatorType.ReferenceEquality: - return "is"; - case BinaryOperatorType.Subtract: - return "-"; - case BinaryOperatorType.Concat: - return "+"; - default: - return "=="; - } - } - - public override object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) - { - Console.WriteLine("VisitAddHandlerStatement"); - return null; - } - - public override object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) - { - Console.WriteLine("VisitAddressOfExpression"); - return null; - } - - public override object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) - { - Console.WriteLine("VisitAnonymousMethodExpression"); - return null; - } - - public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) - { - string arrayType = GetTypeName(arrayCreateExpression.CreateType); - if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) { - Append("Array.CreateInstance(" + arrayType); - if (arrayCreateExpression.Arguments.Count > 0) { - foreach (Expression expression in arrayCreateExpression.Arguments) { - Append(", "); - expression.AcceptVisitor(this, data); - } - Append(")"); - } else { - Append(", 0)"); - } - } else { - Append("Array[" + arrayType + "]"); - - // Add initializers. - Append("(("); - bool firstItem = true; - foreach (Expression expression in arrayCreateExpression.ArrayInitializer.CreateExpressions) { - if (firstItem) { - firstItem = false; - } else { - Append(", "); - } - expression.AcceptVisitor(this, data); - } - Append("))"); - } - return null; - } - - public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) - { - switch (assignmentExpression.Op) { - case AssignmentOperatorType.Assign: - return CreateSimpleAssignment(assignmentExpression, "=", data); - case AssignmentOperatorType.Add: - if (IsAddEventHandler(assignmentExpression)) { - return CreateHandlerStatement(assignmentExpression.Left, "+=", assignmentExpression.Right); - } - return CreateSimpleAssignment(assignmentExpression, "+=", data); - case AssignmentOperatorType.Subtract: - if (IsRemoveEventHandler(assignmentExpression)) { - return CreateHandlerStatement(assignmentExpression.Left, "-=", assignmentExpression.Right); - } - return CreateSimpleAssignment(assignmentExpression, "-=", data); - case AssignmentOperatorType.Modulus: - return CreateSimpleAssignment(assignmentExpression, "%=", data); - case AssignmentOperatorType.Multiply: - return CreateSimpleAssignment(assignmentExpression, "*=", data); - case AssignmentOperatorType.Divide: - case AssignmentOperatorType.DivideInteger: - return CreateSimpleAssignment(assignmentExpression, "/=", data); - case AssignmentOperatorType.BitwiseAnd: - return CreateSimpleAssignment(assignmentExpression, "&=", data); - case AssignmentOperatorType.BitwiseOr: - return CreateSimpleAssignment(assignmentExpression, "|=", data); - case AssignmentOperatorType.ExclusiveOr: - return CreateSimpleAssignment(assignmentExpression, "^=", data); - case AssignmentOperatorType.ShiftLeft: - return CreateSimpleAssignment(assignmentExpression, "<<=", data); - case AssignmentOperatorType.ShiftRight: - return CreateSimpleAssignment(assignmentExpression, ">>=", data); - case AssignmentOperatorType.ConcatString: - return CreateSimpleAssignment(assignmentExpression, "+=", data); - case AssignmentOperatorType.Power: - return CreateSimpleAssignment(assignmentExpression, "**=", data); - } - - return null; - } - - public override object TrackedVisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) - { - return null; - } - - public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data) - { - return null; - } - - /// - /// Converts a base class reference to a this reference. - /// Python has no concept of a direct base class reference so - /// "base" is converted to "self". - /// - public override object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) - { - Append("self"); - return null; - } - - public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) - { - binaryOperatorExpression.Left.AcceptVisitor(this, data); - Append(" "); - Append(GetBinaryOperator(binaryOperatorExpression.Op)); - Append(" "); - binaryOperatorExpression.Right.AcceptVisitor(this, data); - return null; - } - - /// - /// Visits the statement's children. - /// - public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data) - { - return blockStatement.AcceptChildren(this, data); - } - - public override object TrackedVisitBreakStatement(BreakStatement breakStatement, object data) - { - AppendIndentedLine("break"); - return null; - } - - public override object TrackedVisitCaseLabel(CaseLabel caseLabel, object data) - { - return null; - } - - /// - /// Ignore the cast and just visit the expression inside the cast. - /// - public override object TrackedVisitCastExpression(CastExpression castExpression, object data) - { - return castExpression.Expression.AcceptVisitor(this, data); - } - - public override object TrackedVisitCatchClause(CatchClause catchClause, object data) - { - Console.WriteLine("VisitCatchClause"); - return null; - } - - public override object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data) - { - Console.WriteLine("VisitCheckedExpression"); - return null; - } - - public override object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data) - { - Console.WriteLine("VisitCheckedStatement"); - return null; - } - - public override object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) - { - Console.WriteLine("VisitClassReferenceExpression"); - return null; - } - - public override object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data) - { - // Visit the child items of the compilation unit. - compilationUnit.AcceptChildren(this, data); - return null; - } - - /// - /// An ternary operator expression: - /// - /// string a = test ? "Ape" : "Monkey"; - /// - /// In Python this gets converted to: - /// - /// a = "Ape" if test else "Monkey" - /// - public override object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data) - { - // Add true part. - conditionalExpression.TrueExpression.AcceptVisitor(this, data); - - // Add condition. - Append(" if "); - conditionalExpression.Condition.AcceptVisitor(this, data); - - // Add false part. - Append(" else "); - conditionalExpression.FalseExpression.AcceptVisitor(this, data); - return null; - } - - public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) - { - CreateConstructor(constructorInfo); - return null; - } - - public override object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) - { - Console.WriteLine("VisitConstructorInitializer"); - return null; - } - - public override object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data) - { - AppendIndentedLine("continue"); - return null; - } - - public override object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) - { - Console.WriteLine("VisitDeclareDeclaration"); - return null; - } - - public override object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) - { - Console.WriteLine("VisitDefaultValueExpression"); - return null; - } - - public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) - { - Console.WriteLine("VisitDelegateDeclaration"); - return null; - } - - public override object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) - { - AppendIndentedLine("def __del__(self):"); - IncreaseIndent(); - destructorDeclaration.Body.AcceptVisitor(this, data); - DecreaseIndent(); - return null; - } - - public override object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data) - { - Console.WriteLine("VisitDirectionExpression"); - return null; - } - - public override object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) - { - AppendIndented("while "); - doLoopStatement.Condition.AcceptVisitor(this, data); - Append(":"); - AppendLine(); - - IncreaseIndent(); - doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - return null; - } - - public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) - { - // Convert condition. - AppendIndented("elif "); - elseIfSection.Condition.AcceptVisitor(this, data); - Append(":"); - AppendLine(); - - // Convert else if body statements. - IncreaseIndent(); - elseIfSection.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - return null; - } - - public override object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data) - { - Console.WriteLine("VisitEmptyStatement"); - return null; - } - - public override object TrackedVisitEndStatement(EndStatement endStatement, object data) - { - Console.WriteLine("VistEndStatement"); - return null; - } - - public override object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data) - { - Console.WriteLine("VisitEraseStatement"); - return null; - } - - public override object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data) - { - Console.WriteLine("VisitErrorStatement"); - return null; - } - - public override object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data) - { - Console.WriteLine("VisitEventAddRegion"); - return null; - } - - public override object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data) - { - Console.WriteLine("VisitEventDeclaration"); - return null; - } - - public override object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) - { - Console.WriteLine("VisitEventRaiseRegion"); - return null; - } - - public override object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) - { - Console.WriteLine("VisitEventRemoveRegion"); - return null; - } - - public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data) - { - AppendIndentedLine("break"); - return null; - } - - public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data) - { - // Convert the expression. - AppendIndented(String.Empty); - expressionStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) - { - return null; - } - - public override object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data) - { - Console.WriteLine("VisitFixedStatement"); - return null; - } - - public override object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data) - { - // Convert the for loop's initializers. - AppendIndented(String.Empty); - CreateInitStatement(foreachStatement); - AppendLine(); - - // Convert the for loop's test expression. - AppendIndentedLine("while enumerator.MoveNext():"); - - // Move the initializer in the foreach loop to the - // first line of the for loop's body. - IncreaseIndent(); - AppendIndentedLine(foreachStatement.VariableName + " = enumerator.Current"); - - // Visit the for loop's body. - foreachStatement.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - return null; - } - - /// - /// Converts from an NRefactory VB.NET for next loop: - /// - /// for i As Integer = 0 To 4 - /// Next - /// - /// to Python's: - /// - /// i = 0 - /// while i < 5: - /// - public override object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data) - { - // Convert the for loop's initializers. - string variableName = forNextStatement.VariableName; - AppendIndented(variableName); - Append(" = "); - forNextStatement.Start.AcceptVisitor(this, data); - AppendLine(); - - // Convert the for loop's test expression. - AppendIndented("while "); - Append(variableName); - Append(" <= "); - forNextStatement.End.AcceptVisitor(this, data); - Append(":"); - AppendLine(); - - // Visit the for loop's body. - IncreaseIndent(); - forNextStatement.EmbeddedStatement.AcceptVisitor(this, data); - - // Convert the for loop's increment statement. - AppendIndented(variableName); - Append(" = "); - Append(variableName); - Append(" + "); - if (forNextStatement.Step.IsNull) { - Append("1"); - } else { - forNextStatement.Step.AcceptVisitor(this, data); - } - AppendLine(); - DecreaseIndent(); - - return null; - } - - /// - /// Converts from an NRefactory for loop: - /// - /// for (int i = 0; i < 5; i = i + 1) - /// - /// to Python's: - /// - /// i = 0 - /// while i < 5: - /// - public override object TrackedVisitForStatement(ForStatement forStatement, object data) - { - // Convert the for loop's initializers. - foreach (Statement statement in forStatement.Initializers) { - statement.AcceptVisitor(this, data); - } - - // Convert the for loop's test expression. - AppendIndented("while "); - forStatement.Condition.AcceptVisitor(this, data); - Append(":"); - AppendLine(); - - // Visit the for loop's body. - IncreaseIndent(); - forStatement.EmbeddedStatement.AcceptVisitor(this, data); - - // Convert the for loop's increment statement. - foreach (Statement statement in forStatement.Iterator) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - - return null; - } - - public override object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) - { - Console.WriteLine("VisitGotoCaseStatement"); - return null; - } - - public override object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data) - { - Console.WriteLine("VisitGotoStatement"); - return null; - } - - public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) - { - string name = identifierExpression.Identifier; - if (IsField(name)) { - Append("self._" + name); - } else if (IsProperty(name) && !IsMethodParameter(name)) { - Append("self." + name); - } else { - Append(name); - } - return null; - } - - public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data) - { - // Convert condition. - AppendIndented("if "); - ifElseStatement.Condition.AcceptVisitor(this, data); - Append(":"); - AppendLine(); - - // Convert true statements. - IncreaseIndent(); - foreach (Statement statement in ifElseStatement.TrueStatement) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - - // Convert else if sections. - if (ifElseStatement.HasElseIfSections) { - foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) { - elseIfSection.AcceptVisitor(this, data); - } - } - - // Convert false statements. - if (ifElseStatement.HasElseStatements) { - AppendIndentedLine("else:"); - IncreaseIndent(); - foreach (Statement statement in ifElseStatement.FalseStatement) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - } - - return null; - } - - public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data) - { - indexerExpression.TargetObject.AcceptVisitor(this, data); - - // Add indices. - foreach (Expression expression in indexerExpression.Indexes) { - Append("["); - expression.AcceptVisitor(this, data); - Append("]"); - } - - return null; - } - - public override object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) - { - Console.WriteLine("VisitInnerClassTypeReference"); - return null; - } - - public override object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) - { - Console.WriteLine("VisitInterfaceImplementation"); - return null; - } - - public override object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data) - { - MemberReferenceExpression memberRefExpression = invocationExpression.TargetObject as MemberReferenceExpression; - IdentifierExpression identifierExpression = invocationExpression.TargetObject as IdentifierExpression; - if (memberRefExpression != null) { - memberRefExpression.TargetObject.AcceptVisitor(this, data); - Append("." + memberRefExpression.MemberName); - } else if (identifierExpression != null) { - if ((currentMethod != null) && IsStatic(currentMethod)) { - Append(GetTypeName(currentMethod) + "."); - } else { - Append("self."); - } - Append(identifierExpression.Identifier); - } - - // Create method parameters - Append("("); - bool firstParam = true; - foreach (Expression param in invocationExpression.Arguments) { - if (firstParam) { - firstParam = false; - } else { - Append(", "); - } - param.AcceptVisitor(this, data); - } - Append(")"); - return null; - } - - public override object TrackedVisitLabelStatement(LabelStatement labelStatement, object data) - { - Console.WriteLine("VisitLabelStatement"); - return null; - } - - /// - /// The variable declaration is not created if the variable has no initializer. - /// - public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) - { - foreach (VariableDeclaration variableDeclaration in localVariableDeclaration.Variables) { - if (!variableDeclaration.Initializer.IsNull) { - - AddTypeToArrayInitializerIfMissing(variableDeclaration); - - // Create variable declaration. - AppendIndented(variableDeclaration.Name + " = "); - - // Generate the variable initializer. - variableDeclaration.Initializer.AcceptVisitor(this, data); - AppendLine(); - } - } - return null; - } - - public override object TrackedVisitLockStatement(LockStatement lockStatement, object data) - { - Console.WriteLine("VisitLockStatement"); - return null; - } - - public override object TrackedVisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) - { - Append(memberInitializerExpression.Name); - Append(" = "); - memberInitializerExpression.Expression.AcceptVisitor(this, data); - return null; - } - - /// - /// Adds a CodeMemberMethod to the current class being visited. - /// - public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) - { - // Add method name. - currentMethod = methodDeclaration; - string methodName = methodDeclaration.Name; - AppendIndented("def " + methodName); - - // Add the parameters. - AddParameters(methodDeclaration); - methodParameters = methodDeclaration.Parameters; - AppendLine(); - - IncreaseIndent(); - AppendDocstring(xmlDocComments); - if (methodDeclaration.Body.Children.Count > 0) { - methodDeclaration.Body.AcceptVisitor(this, data); - } else { - AppendIndentedPassStatement(); - } - - DecreaseIndent(); - AppendLine(); - - if (IsStatic(methodDeclaration)) { - AppendIndentedLine(methodDeclaration.Name + " = staticmethod(" + methodDeclaration.Name + ")"); - AppendLine(); - - // Save Main entry point method. - SaveMethodIfMainEntryPoint(methodDeclaration); - } - - currentMethod = null; - - return null; - } - - public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) - { - Append(namedArgumentExpression.Name); - Append(" = "); - namedArgumentExpression.Expression.AcceptVisitor(this, data); - return null; - } - - /// - /// Visits the namespace declaration and all child nodes. - /// - public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) - { - return namespaceDeclaration.AcceptChildren(this, data); - } - - /// - /// Converts an NRefactory's ObjectCreateExpression to a code dom's - /// CodeObjectCreateExpression. - /// - public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) - { - Append(objectCreateExpression.CreateType.Type); - if (IsGenericType(objectCreateExpression)) { - AppendGenericTypes(objectCreateExpression); - } - Append("("); - - // Add parameters. - bool firstParameter = true; - foreach (Expression expression in objectCreateExpression.Parameters) { - if (!firstParameter) { - Append(", "); - } - expression.AcceptVisitor(this, data); - firstParameter = false; - } - - // Add object initializers. - bool firstInitializer = true; - foreach (Expression expression in objectCreateExpression.ObjectInitializer.CreateExpressions) { - if (!firstInitializer) { - Append(", "); - } - expression.AcceptVisitor(this, data); - firstInitializer = false; - } - - Append(")"); - return null; - } - - public override object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) - { - return null; - } - - public override object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) - { - Console.WriteLine("VisitOperatorDeclaration"); - return null; - } - - public override object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) - { - Console.WriteLine("VisitOptionDeclaration"); - return null; - } - - public override object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) - { - Console.WriteLine("ExternAliasDirective"); - return null; - } - - public override object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) - { - Console.WriteLine("VisitParameterDeclarationExpression"); - return null; - } - - public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) - { - Append("(" ); - parenthesizedExpression.Expression.AcceptVisitor(this, data); - Append(")"); - return null; - } - - public override object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) - { - Console.WriteLine("VisitPointerReferenceExpression"); - return null; - } - - public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) - { - if (primitiveExpression.Value == null) { - Append("None"); - } else if (primitiveExpression.Value is Boolean) { - Append(primitiveExpression.Value.ToString()); - } else { - Append(primitiveExpression.StringValue); - } - return null; - } - - public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) - { - string propertyName = propertyDeclaration.Name; - propertyNames.Add(propertyName); - - // Add get statements. - if (propertyDeclaration.HasGetRegion) { - AppendIndentedLine("def get_" + propertyName + "(self):"); - IncreaseIndent(); - propertyDeclaration.GetRegion.Block.AcceptVisitor(this, data); - DecreaseIndent(); - AppendLine(); - } - - // Add set statements. - if (propertyDeclaration.HasSetRegion) { - AppendIndentedLine("def set_" + propertyName + "(self, value):"); - IncreaseIndent(); - propertyDeclaration.SetRegion.Block.AcceptVisitor(this, data); - DecreaseIndent(); - AppendLine(); - } - - AppendPropertyDecorator(propertyDeclaration); - AppendLine(); - - return null; - } - - public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) - { - Console.WriteLine("VisitPropertyGetRegion"); - return null; - } - - public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) - { - Console.WriteLine("VisitPropertySetRegion"); - return null; - } - - public override object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) - { - Console.WriteLine("VisitRaiseEventStatement"); - return null; - } - - public override object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data) - { - Console.WriteLine("VisitReDimStatement"); - return null; - } - - public override object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) - { - Console.WriteLine("VisitRemoveHandlerStatement"); - return null; - } - - public override object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data) - { - Console.WriteLine("VisitResumeStatement"); - return null; - } - - /// - /// Converts a NRefactory ReturnStatement to a code dom's - /// CodeMethodReturnStatement. - /// - public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data) - { - AppendIndented("return "); - returnStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) - { - Console.WriteLine("VisitSizeOfExpression"); - return null; - } - - public override object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) - { - return null; - } - - public override object TrackedVisitStopStatement(StopStatement stopStatement, object data) - { - return null; - } - - public override object TrackedVisitSwitchSection(SwitchSection switchSection, object data) - { - return null; - } - - public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data) - { - bool firstSection = true; - foreach (SwitchSection section in switchStatement.SwitchSections) { - // Create if/elif/else condition. - CreateSwitchCaseCondition(switchStatement.SwitchExpression, section, firstSection); - - // Create if/elif/else body. - IncreaseIndent(); - CreateSwitchCaseBody(section); - DecreaseIndent(); - - firstSection = false; - } - return null; - } - - public override object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data) - { - return null; - } - - public override object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) - { - Append("self"); - return null; - } - - /// - /// Converts an NRefactory throw statement to a code dom's throw exception statement. - /// - public override object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data) - { - AppendIndented("raise "); - throwStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - /// - /// Converts an NRefactory try-catch statement to a code dom - /// try-catch statement. - /// - public override object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) - { - // Convert try-catch body. - AppendIndentedLine("try:"); - IncreaseIndent(); - tryCatchStatement.StatementBlock.AcceptVisitor(this, data); - DecreaseIndent(); - - // Convert catches. - foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) { - AppendIndented("except "); - Append(catchClause.TypeReference.Type); - Append(", " + catchClause.VariableName + ":"); - AppendLine(); - - // Convert catch child statements. - IncreaseIndent(); - catchClause.StatementBlock.AcceptVisitor(this, data); - DecreaseIndent(); - } - - // Convert finally block. - AppendIndentedLine("finally:"); - IncreaseIndent(); - tryCatchStatement.FinallyBlock.AcceptVisitor(this, data); - DecreaseIndent(); - - return null; - } - - /// - /// Visits a class. - /// - public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) - { - codeBuilder.AppendLineIfPreviousLineIsCode(); - AppendIndented("class " + typeDeclaration.Name); - AppendBaseTypes(typeDeclaration.BaseTypes); - AppendLine(); - IncreaseIndent(); - AppendDocstring(xmlDocComments); - if (typeDeclaration.Children.Count > 0) { - // Look for fields or a constructor for the type. - constructorInfo = PythonConstructorInfo.GetConstructorInfo(typeDeclaration); - if (constructorInfo != null) { - if (constructorInfo.Constructor != null) { - // Generate constructor later when VisitConstructorDeclaration method is called. - // This allows the constructor comments to be converted in the right place. - } else { - CreateConstructor(constructorInfo); - } - } - - // Visit the rest of the class. - typeDeclaration.AcceptChildren(this, data); - } else { - AppendIndentedPassStatement(); - } - DecreaseIndent(); - - return null; - } - - public override object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) - { - codeBuilder.InsertIndentedLine("import clr\r\n"); - Append("clr.GetClrType("); - Append(GetTypeName(typeOfExpression.TypeReference)); - Append(")"); - return null; - } - - public override object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) - { - Console.WriteLine("VisitTypeOfIsExpression"); - return null; - } - - public override object TrackedVisitTypeReference(TypeReference typeReference, object data) - { - Console.WriteLine("VisitTypeReference"); - return null; - } - - public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) - { - Append(GetTypeName(typeReferenceExpression.TypeReference)); - return null; - } - - public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) - { - switch (unaryOperatorExpression.Op) { - case UnaryOperatorType.PostIncrement: - case UnaryOperatorType.Increment: - // Change i++ or ++i to i += 1 - return CreateIncrementStatement(unaryOperatorExpression); - case UnaryOperatorType.Decrement: - case UnaryOperatorType.PostDecrement: - // Change --i or i-- to i -= 1. - return CreateDecrementStatement(unaryOperatorExpression); - case UnaryOperatorType.Minus: - return CreateUnaryOperatorStatement(GetBinaryOperator(BinaryOperatorType.Subtract), unaryOperatorExpression.Expression); - case UnaryOperatorType.Plus: - return CreateUnaryOperatorStatement(GetBinaryOperator(BinaryOperatorType.Add), unaryOperatorExpression.Expression); - case UnaryOperatorType.Not: - return CreateUnaryOperatorStatement("not ", unaryOperatorExpression.Expression); - case UnaryOperatorType.BitNot: - return CreateUnaryOperatorStatement("~", unaryOperatorExpression.Expression); - } - return null; - } - - public override object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) - { - return null; - } - - public override object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) - { - return null; - } - - public override object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) - { - return null; - } - - public override object TrackedVisitUsing(Using @using, object data) - { - return null; - } - - /// - /// Converts using declarations into Python import statements. - /// - public override object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) - { - // Add import statements for each using. - foreach (Using @using in usingDeclaration.Usings) { - AppendIndentedLine("from " + @using.Name + " import *"); - } - return null; - } - - public override object TrackedVisitUsingStatement(UsingStatement usingStatement, object data) - { - return null; - } - - public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) - { - AppendIndented(variableDeclaration.Name + " = "); - variableDeclaration.Initializer.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitWithStatement(WithStatement withStatement, object data) - { - return null; - } - - public override object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data) - { - return null; - } - - public override object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) - { - return null; - } - - public override object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data) - { - return null; - } - - public override object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) - { - memberReferenceExpression.TargetObject.AcceptVisitor(this, data); - if ((memberReferenceExpression.TargetObject is ThisReferenceExpression) && !IsProperty(memberReferenceExpression.MemberName)) { - Append("._"); - } else { - Append("."); - } - Append(memberReferenceExpression.MemberName); - return null; - } - - public override object TrackedVisitQueryExpression(QueryExpression queryExpression, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) - { - return null; - } - - public override object TrackedVisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) - { - return null; - } - - public override object TrackedVisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) - { - return null; - } - - /// - /// Appends any comments that appear before this node. - /// - protected override void BeginVisit(INode node) - { - xmlDocComments.Clear(); - currentNode = node; - specialNodesInserter.AcceptNodeStart(node); - } - - #region IOutputFormatter - - int IOutputFormatter.IndentationLevel { - get { return codeBuilder.Indent; } - set { ; } - } - - string IOutputFormatter.Text { - get { return String.Empty; } - } - - bool IOutputFormatter.IsInMemberBody { - get { return false; } - set { ; } - } - - void IOutputFormatter.NewLine() - { - } - - void IOutputFormatter.Indent() - { - - } - - void IOutputFormatter.PrintComment(Comment comment, bool forceWriteInPreviousBlock) - { - if (comment.CommentType == CommentType.SingleLine) { - AppendSingleLineComment(comment); - } else if (comment.CommentType == CommentType.Block) { - AppendMultilineComment(comment); - } else if (comment.CommentType == CommentType.Documentation) { - if (SupportsDocstring(currentNode)) { - xmlDocComments.Add(comment); - } else { - AppendSingleLineComment(comment); - } - } - } - - void IOutputFormatter.PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock) - { - } - - void IOutputFormatter.PrintBlankLine(bool forceWriteInPreviousBlock) - { - } - - #endregion - - /// - /// Checks that the field declaration has an initializer that - /// sets an initial value. - /// - static bool FieldHasInitialValue(VariableDeclaration variableDeclaration) - { - Expression initializer = variableDeclaration.Initializer; - return !initializer.IsNull; - } - - /// - /// Converts a post or pre increment expression to an assign statement. - /// This converts "i++" and "++i" to "i = i + 1" since python - /// does not support post increment expressions. - /// - object CreateIncrementStatement(UnaryOperatorExpression unaryOperatorExpression) - { - return CreateIncrementStatement(unaryOperatorExpression, 1, GetBinaryOperator(BinaryOperatorType.Add)); - } - - /// - /// Converts a post or pre decrement expression to an assign statement. - /// This converts "i--" and "--i" to "i -= 1" since python - /// does not support post increment expressions. - /// - object CreateDecrementStatement(UnaryOperatorExpression unaryOperatorExpression) - { - return CreateIncrementStatement(unaryOperatorExpression, 1, GetBinaryOperator(BinaryOperatorType.Subtract)); - } - - /// - /// Converts a post or pre increment expression to an assign statement. - /// This converts "i++" and "++i" to "i += 1" since python - /// does not support post increment expressions. - /// - object CreateIncrementStatement(UnaryOperatorExpression unaryOperatorExpression, int increment, string binaryOperator) - { - unaryOperatorExpression.Expression.AcceptVisitor(this, null); - Append(" " + binaryOperator + "= "); - Append(increment.ToString()); - - return null; - } - - /// - /// Creates the statement used to initialize the for loop. The - /// initialize statement will be "enumerator = variableName.GetEnumerator()" - /// which simulates what happens in a foreach loop. - /// - object CreateInitStatement(ForeachStatement foreachStatement) - { - Append("enumerator = "); - AppendForeachVariableName(foreachStatement); - Append(".GetEnumerator()"); - - return null; - } - - /// - /// Gets the name of the variable that is used in the - /// foreach loop as the item being iterated and appends the code. - /// - void AppendForeachVariableName(ForeachStatement foreachStatement) - { - IdentifierExpression identifierExpression = foreachStatement.Expression as IdentifierExpression; - InvocationExpression invocationExpression = foreachStatement.Expression as InvocationExpression; - MemberReferenceExpression memberRefExpression = foreachStatement.Expression as MemberReferenceExpression; - if (identifierExpression != null) { - Append(identifierExpression.Identifier); - } else if (invocationExpression != null) { - invocationExpression.AcceptVisitor(this, null); - } else if (memberRefExpression != null) { - memberRefExpression.AcceptVisitor(this, null); - } - } - - /// - /// Determines whether the identifier refers to a field in the - /// current class. - /// - bool IsField(string name) - { - // Check the current method's parameters. - if (IsMethodParameter(name)) { - return false; - } - - // Check the current class's fields. - if (constructorInfo != null) { - foreach (FieldDeclaration field in constructorInfo.Fields) { - foreach (VariableDeclaration variable in field.Fields) { - if (variable.Name == name) { - return true; - } - } - } - } - return false; - } - - bool IsMethodParameter(string name) - { - foreach (ParameterDeclarationExpression param in methodParameters) { - if (param.ParameterName == name) { - return true; - } - } - return false; - } - - bool IsProperty(string name) - { - return propertyNames.Contains(name); - } - - /// - /// Creates an attach statement (i.e. button.Click += ButtonClick) - /// or remove statement (i.e. button.Click -= ButtonClick) - /// - object CreateHandlerStatement(Expression eventExpression, string addRemoveOperator, Expression eventHandlerExpression) - { - CreateEventReferenceExpression(eventExpression); - Append(" " + addRemoveOperator + " "); - CreateDelegateCreateExpression(eventHandlerExpression); - return null; - } - - /// - /// Converts an expression to a CodeEventReferenceExpression - /// (i.e. the "button.Click" part of "button.Click += ButtonClick". - /// - object CreateEventReferenceExpression(Expression eventExpression) - { - // Create event reference. - MemberReferenceExpression memberRef = eventExpression as MemberReferenceExpression; - memberRef.AcceptVisitor(this, null); - return null; - } - - /// - /// Creates an event handler expression - /// (i.e. the "ButtonClick" part of "button.Click += ButtonClick") - /// - object CreateDelegateCreateExpression(Expression eventHandlerExpression) - { - // Create event handler expression. - IdentifierExpression identifierExpression = eventHandlerExpression as IdentifierExpression; - ObjectCreateExpression objectCreateExpression = eventHandlerExpression as ObjectCreateExpression; - MemberReferenceExpression memberRefExpression = eventHandlerExpression as MemberReferenceExpression; - if (identifierExpression != null) { - Append("self." + identifierExpression.Identifier); - } else if (memberRefExpression != null) { - memberRefExpression.AcceptVisitor(this, null); - } else if (objectCreateExpression != null) { - CreateDelegateCreateExpression(objectCreateExpression.Parameters[0]); - } - return null; - } - - /// - /// Determines whether the assignment expression is actually an - /// event handler attach statement. - /// - static bool IsAddEventHandler(AssignmentExpression assignmentExpression) - { - return (assignmentExpression.Op == AssignmentOperatorType.Add) && - (assignmentExpression.Left is MemberReferenceExpression); - } - - /// - /// Determines whether the assignment expression is actually an - /// event handler remove statement. - /// - static bool IsRemoveEventHandler(AssignmentExpression assignmentExpression) - { - return (assignmentExpression.Op == AssignmentOperatorType.Subtract) && - (assignmentExpression.Left is MemberReferenceExpression); - } - - void Append(string code) - { - codeBuilder.Append(code); - } - - void AppendIndented(string code) - { - codeBuilder.AppendIndented(code); - } - - void AppendIndentedPassStatement() - { - AppendIndentedLine("pass"); - } - - void AppendIndentedLine(string code) - { - codeBuilder.AppendIndentedLine(code); - } - - void AppendLine() - { - codeBuilder.AppendLine(); - } - - void IncreaseIndent() - { - codeBuilder.IncreaseIndent(); - } - - void DecreaseIndent() - { - codeBuilder.DecreaseIndent(); - } - - void CreateConstructor(PythonConstructorInfo constructorInfo) - { - if (constructorInfo.Constructor != null) { - AppendIndented("def __init__"); - AddParameters(constructorInfo.Constructor); - methodParameters = constructorInfo.Constructor.Parameters; - } else { - AppendIndented("def __init__(self):"); - } - AppendLine(); - - // Add fields at start of constructor. - IncreaseIndent(); - AppendDocstring(xmlDocComments); - if (constructorInfo.Fields.Count > 0) { - foreach (FieldDeclaration field in constructorInfo.Fields) { - CreateFieldInitialization(field); - } - } - - if (!IsEmptyConstructor(constructorInfo.Constructor)) { - constructorInfo.Constructor.Body.AcceptVisitor(this, null); - AppendLine(); - } else if (constructorInfo.Fields.Count == 0) { - AppendIndentedPassStatement(); - } else { - AppendLine(); - } - - DecreaseIndent(); - } - - /// - /// Returns true if the constructor has no statements in its body. - /// - static bool IsEmptyConstructor(ConstructorDeclaration constructor) - { - if (constructor != null) { - return constructor.Body.Children.Count == 0; - } - return true; - } - - /// - /// Creates a field initialization statement. - /// - void CreateFieldInitialization(FieldDeclaration field) - { - foreach (VariableDeclaration variable in field.Fields) { - // Ignore field if it has no initializer. - if (FieldHasInitialValue(variable)) { - AddTypeToArrayInitializerIfMissing(variable); - - string oldVariableName = variable.Name; - variable.Name = "self._" + variable.Name; - VisitVariableDeclaration(variable, null); - variable.Name = oldVariableName; - } - } - } - - void AddTypeToArrayInitializerIfMissing(VariableDeclaration variable) - { - ArrayCreateExpression arrayCreate = variable.Initializer as ArrayCreateExpression; - if (IsArrayMissingTypeToCreate(arrayCreate)) { - arrayCreate.CreateType = variable.TypeReference; - } - } - - bool IsArrayMissingTypeToCreate(ArrayCreateExpression arrayCreate) - { - if (arrayCreate != null) { - return String.IsNullOrEmpty(arrayCreate.CreateType.Type); - } - return false; - } - - /// - /// Adds the method or constructor parameters. - /// - void AddParameters(ParametrizedNode method) - { - Append("("); - List parameters = method.Parameters; - if (parameters.Count > 0) { - if (!IsStatic(method)) { - Append("self, "); - } - for (int i = 0; i < parameters.Count; ++i) { - if (i > 0) { - Append(", "); - } - Append(parameters[i].ParameterName); - } - } else { - if (!IsStatic(method)) { - Append("self"); - } - } - Append("):"); - } - - bool IsStatic(ParametrizedNode method) - { - return (method.Modifier & Modifiers.Static) == Modifiers.Static; - } - - /// - /// Creates assignments of the form: - /// i = 1 - /// - object CreateSimpleAssignment(AssignmentExpression assignmentExpression, string op, object data) - { - assignmentExpression.Left.AcceptVisitor(this, data); - Append(" " + op + " "); - assignmentExpression.Right.AcceptVisitor(this, data); - return null; - } - - /// - /// Creates the rhs of expressions such as: - /// i = -1 - /// i = +1 - /// - object CreateUnaryOperatorStatement(string op, Expression expression) - { - Append(op); - expression.AcceptVisitor(this, null); - return null; - } - - /// - /// Converts a switch case statement to an if/elif/else in Python. - /// - /// This contains the item being tested in the switch. - /// This contains the switch section currently being converted. - /// True if the section is the first in the switch. If true then - /// an if statement will be generated, otherwise an elif will be generated. - void CreateSwitchCaseCondition(Expression switchExpression, SwitchSection section, bool firstSection) - { - bool firstLabel = true; - foreach (CaseLabel label in section.SwitchLabels) { - if (firstLabel) { - if (label.IsDefault) { - // Create else condition. - AppendIndented("else"); - } else if (firstSection) { - // Create if condition. - AppendIndented(String.Empty); - CreateSwitchCaseCondition("if ", switchExpression, label); - } else { - // Create elif condition. - AppendIndented(String.Empty); - CreateSwitchCaseCondition("elif ", switchExpression, label); - } - } else { - CreateSwitchCaseCondition(" or ", switchExpression, label); - } - firstLabel = false; - } - - Append(":"); - AppendLine(); - } - - /// - /// Creates the switch test condition - /// - /// This is a string which is either "if ", "elif ", "else " or " or ". - void CreateSwitchCaseCondition(string prefix, Expression switchExpression, CaseLabel label) - { - Append(prefix); - switchExpression.AcceptVisitor(this, null); - Append(" == "); - label.Label.AcceptVisitor(this, null); - } - - /// - /// Creates the statements inside a switch case statement. - /// - void CreateSwitchCaseBody(SwitchSection section) - { - int statementsAdded = 0; - foreach (INode node in section.Children) { - if (node is BreakStatement) { - // ignore. - } else { - statementsAdded++; - node.AcceptVisitor(this, null); - } - } - - // Check for empty body. - if (statementsAdded == 0) { - AppendIndentedLine("pass"); - } - } - - /// - /// Gets the supported language either C# or VB.NET - /// - static SupportedLanguage GetSupportedLanguage(string fileName) - { - string extension = Path.GetExtension(fileName.ToLowerInvariant()); - if (extension == ".vb") { - return SupportedLanguage.VBNet; - } - return SupportedLanguage.CSharp; - } - - /// - /// Saves the method declaration if it is a main entry point. - /// - void SaveMethodIfMainEntryPoint(MethodDeclaration method) - { - if (method.Name == "Main") { - entryPointMethods.Add(method); - } - } - - /// - /// Returns true if the object being created is a generic. - /// - static bool IsGenericType(ObjectCreateExpression expression) - { - return expression.CreateType.GenericTypes.Count > 0; - } - - /// - /// Appends the types used when creating a generic surrounded by square brackets. - /// - void AppendGenericTypes(ObjectCreateExpression expression) - { - Append("["); - List typeRefs = expression.CreateType.GenericTypes; - for (int i = 0; i < typeRefs.Count; ++i) { - if (i != 0) { - Append(", "); - } - TypeReference typeRef = typeRefs[i]; - if (typeRef.IsArrayType) { - Append("Array[" + GetTypeName(typeRef) + "]"); - } else { - Append(GetTypeName(typeRef)); - } - } - Append("]"); - } - - /// - /// If the type is String or Int32 then it returns "str" and "int". - /// - /// If the type is a keyword (e.g. uint) then the TypeRef.Type returns - /// the full type name. It returns the short type name if the type is not a keyword. So - /// this method will strip the namespace from the name. - /// - string GetTypeName(TypeReference typeRef) - { - string name = typeRef.Type; - if (name == typeof(String).FullName) { - return "str"; - } else if ((name == typeof(int).FullName) || ((name == typeof(int).Name))) { - return "int"; - } else if (typeRef.IsKeyword) { - // Remove namespace from type name. - int index = name.LastIndexOf('.'); - if (index > 0) { - return name.Substring(index + 1); - } - } - return name; - } - - /// - /// Gets the type name that defines the method. - /// - static string GetTypeName(MethodDeclaration methodDeclaration) - { - TypeDeclaration type = methodDeclaration.Parent as TypeDeclaration; - return type.Name; - } - - void AppendMultilineComment(Comment comment) - { - string[] lines = comment.CommentText.Split(new char[] {'\n'}); - for (int i = 0; i < lines.Length; ++i) { - string line = "# " + lines[i].Trim(); - if ((i == 0) && !comment.CommentStartsLine) { - codeBuilder.AppendToPreviousLine(" " + line); - } else { - AppendIndentedLine(line); - } - } - } - - void AppendSingleLineComment(Comment comment) - { - if (comment.CommentStartsLine) { - codeBuilder.AppendIndentedLine("#" + comment.CommentText); - } else { - codeBuilder.AppendToPreviousLine(" #" + comment.CommentText); - } - } - - void AppendDocstring(List xmlDocComments) - { - if (xmlDocComments.Count > 1) { - // Multiline docstring. - for (int i = 0; i < xmlDocComments.Count; ++i) { - string line = xmlDocComments[i].CommentText; - if (i == 0) { - AppendIndented(Docstring); - } else { - AppendIndented(String.Empty); - } - Append(line); - AppendLine(); - } - AppendIndentedLine(Docstring); - } else if (xmlDocComments.Count == 1) { - // Single line docstring. - AppendIndentedLine(Docstring + xmlDocComments[0].CommentText + Docstring); - } - } - - /// - /// Returns true if the node is a type declaration or a method since these can have - /// python docstrings. - /// - bool SupportsDocstring(INode node) - { - return (node is TypeDeclaration) || (node is MethodDeclaration) || (node is ConstructorDeclaration); - } - - void AppendPropertyDecorator(PropertyDeclaration propertyDeclaration) - { - string propertyName = propertyDeclaration.Name; - AppendIndented(propertyName); - Append(" = property("); - - bool addedParameter = false; - if (propertyDeclaration.HasGetRegion) { - Append("fget=get_" + propertyName); - addedParameter = true; - } - - if (propertyDeclaration.HasSetRegion) { - if (addedParameter) { - Append(", "); - } - Append("fset=set_" + propertyName); - } - Append(")"); - AppendLine(); - } - - void AppendBaseTypes(List baseTypes) - { - Append("("); - if (baseTypes.Count == 0) { - Append("object"); - } else { - for (int i = 0; i < baseTypes.Count; ++i) { - TypeReference typeRef = baseTypes[i]; - if (i > 0) { - Append(", "); - } - Append(GetTypeName(typeRef)); - } - } - Append("):"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs deleted file mode 100644 index b2b27952a97..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using Microsoft.Scripting; -using System; -using System.Collections.Generic; -using System.IO; - -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler; -using IronPython.Compiler.Ast; -using IronPython.Runtime; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Walks the python parse tree. - /// - public class PythonAstWalker : PythonWalker - { - PythonCompilationUnit compilationUnit; - IClass currentClass; - PythonModule module; - - /// - /// All classes in a file take the namespace of the filename. - /// - public PythonAstWalker(IProjectContent projectContent, string fileName) - { - compilationUnit = new PythonCompilationUnit(projectContent, fileName); - } - - /// - /// Returns the compilation unit created after the Walk method - /// has been called. - /// - public ICompilationUnit CompilationUnit { - get { return compilationUnit; } - } - - /// - /// Walks the python statement returned from the parser. - /// - public void Walk(Statement statement) - { - statement.Walk(this); - } - - public override bool Walk(ClassDefinition classDefinition) - { - if (classDefinition.Parent != null) { - PythonClass c = new PythonClass(compilationUnit, classDefinition); - WalkClassBody(c, classDefinition.Body); - } - return false; - } - - void WalkClassBody(IClass c, Statement classBody) - { - currentClass = c; - classBody.Walk(this); - currentClass = null; - } - - public override bool Walk(FunctionDefinition functionDefinition) - { - if (functionDefinition.Body == null) { - return false; - } - - IClass c = GetClassBeingWalked(); - - PythonMethodDefinition methodDefinition = new PythonMethodDefinition(functionDefinition); - PythonMethod method = methodDefinition.CreateMethod(c); - if (method is PythonConstructor) { - FindFields(c, functionDefinition); - } - return false; - } - - /// - /// If the current class is null then create a module so a method outside of a class can be - /// parsed. - /// - IClass GetClassBeingWalked() - { - if (currentClass == null) { - // Walking a method outside a class. - CreateModule(); - return module; - } - return currentClass; - } - - /// - /// Creates the module which will act as a class so it can hold any methods defined in the module. - /// - void CreateModule() - { - if (module == null) { - module = new PythonModule(compilationUnit); - } - } - - void FindFields(IClass c, FunctionDefinition functionDefinition) - { - PythonClassFields fields = new PythonClassFields(functionDefinition); - fields.AddFields(c); - } - - /// - /// Walks an import statement and adds it to the compilation unit's - /// Usings. - /// - public override bool Walk(ImportStatement node) - { - PythonImport import = new PythonImport(compilationUnit.ProjectContent, node); - compilationUnit.UsingScope.Usings.Add(import); - return false; - } - - public override bool Walk(FromImportStatement node) - { - PythonFromImport import = new PythonFromImport(compilationUnit.ProjectContent, node); - compilationUnit.UsingScope.Usings.Add(import); - return false; - } - - public override bool Walk(AssignmentStatement node) - { - if (currentClass != null) { - FindProperty(node); - return false; - } - return base.Walk(node); - } - - void FindProperty(AssignmentStatement node) - { - PythonPropertyAssignment propertyAssignment = new PythonPropertyAssignment(node); - propertyAssignment.CreateProperty(currentClass); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonBuiltInModuleMemberName.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonBuiltInModuleMemberName.cs deleted file mode 100644 index 93ef685e7e5..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonBuiltInModuleMemberName.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.PythonBinding -{ - public class PythonBuiltInModuleMemberName : MemberName - { - public const string PythonBuiltInModuleName = "__builtin__"; - - public PythonBuiltInModuleMemberName(string memberName) - : base(PythonBuiltInModuleName, memberName) - { - } - - public static bool IsBuiltInModule(string name) - { - return name == PythonBuiltInModuleName; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClass.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClass.cs deleted file mode 100644 index a9ca0aa2848..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClass.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonClass : DefaultClass - { - public PythonClass(ICompilationUnit compilationUnit, ClassDefinition classDefinition) - : base(compilationUnit, String.Empty) - { - GetFullyQualifiedName(classDefinition); - GetClassRegions(classDefinition); - AddBaseTypes(classDefinition.Bases); - - compilationUnit.Classes.Add(this); - } - - /// - /// Adds the namespace to the class name taken from the class definition. - /// - void GetFullyQualifiedName(ClassDefinition classDefinition) - { - string ns = CompilationUnit.UsingScope.NamespaceName; - FullyQualifiedName = String.Format("{0}.{1}", ns, classDefinition.Name); - } - - void GetClassRegions(ClassDefinition classDefinition) - { - GetRegion(classDefinition); - BodyRegion = PythonMethodOrClassBodyRegion.GetBodyRegion(classDefinition); - } - - /// - /// Gets the region of the scope statement (ClassDefinition). - /// - /// - /// A class region includes the body. - /// - void GetRegion(ScopeStatement statement) - { - Region = new DomRegion(statement.Start.Line, statement.Start.Column, statement.End.Line, statement.End.Column); - } - - /// - /// Looks for any base types for the class defined in the - /// list of expressions and adds them to the class. - /// - void AddBaseTypes(IList baseTypes) - { - foreach (Expression baseTypeExpression in baseTypes) { - AddBaseType(baseTypeExpression); - } - } - - void AddBaseType(Expression baseTypeExpression) - { - NameExpression nameExpression = baseTypeExpression as NameExpression; - MemberExpression memberExpression = baseTypeExpression as MemberExpression; - if (nameExpression != null) { - AddBaseType(nameExpression.Name); - } else if (memberExpression != null) { - AddBaseType(memberExpression); - } - } - - /// - /// Adds the named base type to the class. - /// - void AddBaseType(string name) - { - IReturnType returnType = CreateSearchClassReturnType(name); - BaseTypes.Add(returnType); - } - - void AddBaseType(MemberExpression memberExpression) - { - string name = PythonControlFieldExpression.GetMemberName(memberExpression); - AddBaseType(name); - } - - SearchClassReturnType CreateSearchClassReturnType(string name) - { - return new SearchClassReturnType(ProjectContent, this, 0, 0, name, 0); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassFields.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassFields.cs deleted file mode 100644 index 7570e357400..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassFields.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonClassFields : PythonWalker - { - FunctionDefinition functionDefinition; - IClass declaringType; - List fieldNamesAdded; - - public PythonClassFields(FunctionDefinition functionDefinition) - { - this.functionDefinition = functionDefinition; - } - - public void AddFields(IClass declaringType) - { - this.declaringType = declaringType; - fieldNamesAdded = new List(); - - functionDefinition.Body.Walk(this); - } - - public override bool Walk(AssignmentStatement node) - { - string fieldName = GetFieldName(node); - AddFieldToDeclaringType(fieldName); - return false; - } - - string GetFieldName(AssignmentStatement node) - { - string[] memberNames = PythonControlFieldExpression.GetMemberNames(node.Left[0] as MemberExpression); - return GetFieldName(memberNames); - } - - string GetFieldName(string[] memberNames) - { - if (memberNames.Length > 1) { - if (PythonSelfResolver.IsSelfExpression(memberNames[0])) { - return memberNames[1]; - } - } - return null; - } - - void AddFieldToDeclaringType(string fieldName) - { - if (fieldName != null) { - if (!fieldNamesAdded.Contains(fieldName)) { - DefaultField field = new DefaultField(declaringType, fieldName); - declaringType.Fields.Add(field); - fieldNamesAdded.Add(fieldName); - } - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassMembers.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassMembers.cs deleted file mode 100644 index d75d4bc47a7..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassMembers.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonClassMembers - { - List members; - - public PythonClassMembers(IClass declaringType) - { - members = GetMembers(declaringType); - } - - public IMember FindMember(string memberName) - { - foreach (IMember member in members) { - if (member.Name == memberName) { - return member; - } - } - return null; - } - - List GetMembers(IClass declaringType) - { - List members = new List(); - members.AddRange(declaringType.Events); - members.AddRange(declaringType.Fields); - members.AddRange(declaringType.Properties); - members.AddRange(declaringType.Methods); - return members; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassResolver.cs deleted file mode 100644 index 69e0fc0109a..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonClassResolver.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonClassResolver : IPythonResolver - { - PythonResolverContext resolverContext; - - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - IClass matchingClass = GetClass(resolverContext); - if (matchingClass != null) { - return CreateTypeResolveResult(matchingClass); - } - return null; - } - - public IClass GetClass(PythonResolverContext resolverContext) - { - string name = resolverContext.Expression; - return GetClass(resolverContext, name); - } - - public IClass GetClass(PythonResolverContext resolverContext, string name) - { - this.resolverContext = resolverContext; - - if (String.IsNullOrEmpty(name)) { - return null; - } - - IClass matchedClass = resolverContext.GetClass(name); - if (matchedClass != null) { - return matchedClass; - } - - matchedClass = GetClassFromImportedNames(name); - if (matchedClass != null) { - return matchedClass; - } - - matchedClass = GetClassFromNamespaceThatImportsEverything(name); - if (matchedClass != null) { - return matchedClass; - } - - return GetClassFromDottedImport(name); - } - - TypeResolveResult CreateTypeResolveResult(IClass c) - { - return new TypeResolveResult(null, null, c); - } - - IClass GetClassFromImportedNames(string name) - { - string moduleName = resolverContext.GetModuleForImportedName(name); - if (moduleName != null) { - name = resolverContext.UnaliasImportedName(name); - string fullyQualifiedName = GetQualifiedClassName(moduleName, name); - return resolverContext.GetClass(fullyQualifiedName); - } - return null; - } - - string GetQualifiedClassName(string namespacePrefix, string className) - { - return namespacePrefix + "." + className; - } - - IClass GetClassFromNamespaceThatImportsEverything(string name) - { - foreach (string moduleName in resolverContext.GetModulesThatImportEverything()) { - string fullyQualifiedName = GetQualifiedClassName(moduleName, name); - IClass matchedClass = resolverContext.GetClass(fullyQualifiedName); - if (matchedClass != null) { - return matchedClass; - } - } - return null; - } - - IClass GetClassFromDottedImport(string name) - { - string moduleName = resolverContext.FindStartOfDottedModuleNameInImports(name); - if (moduleName != null) { - string fullyQualifiedName = UnaliasClassName(moduleName, name); - return resolverContext.GetClass(fullyQualifiedName); - } - return null; - } - - string UnaliasClassName(string moduleName, string fullClassName) - { - string actualModuleName = resolverContext.UnaliasImportedModuleName(moduleName); - string lastPartOfClassName = fullClassName.Substring(moduleName.Length + 1); - return GetQualifiedClassName(actualModuleName, lastPartOfClassName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeBuilder.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeBuilder.cs deleted file mode 100644 index e239882f3cb..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeBuilder.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.ComponentModel; -using System.Text; -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonCodeBuilder : ScriptingCodeBuilder - { - bool insertedCreateComponentsContainer; - - public PythonCodeBuilder() - { - } - - public PythonCodeBuilder(int initialIndent) - : base(initialIndent) - { - } - - /// - /// Inserts the following line of code before all the other lines of code: - /// - /// "self._components = System.ComponentModel.Container()" - /// - /// This line will only be inserted once. Multiple calls to this method will only result in one - /// line of code being inserted. - /// - public void InsertCreateComponentsContainer() - { - if (!insertedCreateComponentsContainer) { - string text = String.Format("self._components = {0}()", typeof(Container).FullName); - InsertIndentedLine(text); - insertedCreateComponentsContainer = true; - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionBinding.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionBinding.cs deleted file mode 100644 index f8f5fd46df6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionBinding.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; -using System.Collections.Generic; - -namespace ICSharpCode.PythonBinding -{ - public class PythonCodeCompletionBinding : DefaultCodeCompletionBinding - { - public PythonCodeCompletionBinding() - { - base.insightHandler = new PythonInsightWindowHandler(); - } - - /// - /// Shows the code completion window if the keyword is handled. - /// - /// The keyword string. - /// true if the keyword is handled; otherwise false. - public override bool HandleKeyword(ITextEditor editor, string word) - { - if (word != null) { - switch (word.ToLowerInvariant()) { - case "import": - case "from": - return HandleImportKeyword(editor); - } - } - return false; - } - - bool HandleImportKeyword(ITextEditor editor) - { - AbstractCompletionItemProvider provider = CreateKeywordCompletionItemProvider(); - ShowCodeCompletionWindow(provider, editor); - return true; - } - - protected virtual AbstractCompletionItemProvider CreateKeywordCompletionItemProvider() - { - return new PythonCodeCompletionItemProvider(); - } - - protected virtual void ShowCodeCompletionWindow(AbstractCompletionItemProvider completionItemProvider, ITextEditor editor) - { - completionItemProvider.ShowCompletion(editor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionItemProvider.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionItemProvider.cs deleted file mode 100644 index 5c282abe2e2..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeCompletionItemProvider.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace ICSharpCode.PythonBinding -{ - public class PythonCodeCompletionItemProvider : CodeCompletionItemProvider - { - protected override DefaultCompletionItemList CreateCompletionItemList() - { - return new PythonCompletionItemList(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDeserializer.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDeserializer.cs deleted file mode 100644 index 8ac4ad8b333..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDeserializer.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Design; -using System.Drawing; -using System.Reflection; - -using ICSharpCode.Scripting; -using IronPython.Compiler; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Creates objects from python code. - /// - public class PythonCodeDeserializer - { - IComponentCreator componentCreator; - - public PythonCodeDeserializer(IComponentCreator componentCreator) - { - this.componentCreator = componentCreator; - } - - /// - /// Gets the arguments passed to the call expression. - /// - public List GetArguments(CallExpression expression) - { - List args = new List(); - foreach (Arg a in expression.Args) { - args.Add(Deserialize(a.Expression)); - } - return args; - } - - /// - /// Creates or gets the object specified in the python AST. - /// - /// - /// Null if the node cannot be deserialized. - /// - public object Deserialize(Node node) - { - if (node == null) { - throw new ArgumentNullException("node"); - } - - if (node is CallExpression) { - return Deserialize((CallExpression)node); - } else if (node is BinaryExpression) { - return Deserialize((BinaryExpression)node); - } else if (node is MemberExpression) { - return Deserialize((MemberExpression)node); - } else if (node is UnaryExpression) { - return Deserialize((UnaryExpression)node); - } else if (node is ConstantExpression) { - return Deserialize((ConstantExpression)node); - } else if (node is NameExpression) { - return Deserialize((NameExpression)node); - } - return null; - } - - /// - /// Deserializes expressions of the form: - /// - /// System.Windows.Form.AnchorStyles.Top | System.Windows.Form.AnchorStyles.Bottom - /// - public object Deserialize(BinaryExpression binaryExpression) - { - object lhs = Deserialize(binaryExpression.Left); - object rhs = Deserialize(binaryExpression.Right); - - int value = Convert.ToInt32(lhs) | Convert.ToInt32(rhs); - return Enum.ToObject(lhs.GetType(), value); - } - - /// - /// Deserializes expressions of the form: - /// - /// 1) System.Drawing.Color.FromArgb(0, 192, 0) - /// 2) System.Array[String](["a", "b"]) - /// - object Deserialize(CallExpression callExpression) - { - MemberExpression memberExpression = callExpression.Target as MemberExpression; - IndexExpression indexExpression = callExpression.Target as IndexExpression; - if (memberExpression != null) { - return DeserializeMethodCallExpression(callExpression, memberExpression); - } else if (indexExpression != null) { - return DeserializeCreateArrayExpression(callExpression, indexExpression); - } - return null; - } - - /// - /// Deserializes expressions of the form: - /// - /// 1) System.Windows.Forms.Cursors.AppStarting - /// - object Deserialize(MemberExpression memberExpression) - { - PythonControlFieldExpression field = PythonControlFieldExpression.Create(memberExpression); - Type type = GetType(field); - if (type != null) { - if (type.IsEnum) { - return Enum.Parse(type, field.MemberName); - } else { - BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance; - PropertyInfo propertyInfo = type.GetProperty(field.MemberName, propertyBindingFlags); - if (propertyInfo != null) { - return propertyInfo.GetValue(type, null); - } - } - } - return componentCreator.GetInstance(PythonControlFieldExpression.GetVariableName(field.MemberName)); - } - - /// - /// Deserializes expressions of the form: - /// - /// 1) self - /// - object Deserialize(NameExpression nameExpression) - { - string name = nameExpression.Name; - if ("self" == name.ToLowerInvariant()) { - return componentCreator.RootComponent; - } else { - bool result; - if (Boolean.TryParse(name, out result)) { - return result; - } - } - return componentCreator.GetInstance(name); - } - - Type GetType(PythonControlFieldExpression field) - { - string typeName = PythonControlFieldExpression.GetPrefix(field.FullMemberName); - return componentCreator.GetType(typeName); - } - - /// - /// Deserializes a call expression where the target is an array expression. - /// - /// System.Array[String](["a", "b"]) - /// - object DeserializeCreateArrayExpression(CallExpression callExpression, IndexExpression target) - { - ListExpression list = callExpression.Args[0].Expression as ListExpression; - Type arrayType = GetType(target.Index as MemberExpression); - Array array = Array.CreateInstance(arrayType, list.Items.Count); - for (int i = 0; i < list.Items.Count; ++i) { - Expression listItemExpression = list.Items[i]; - ConstantExpression constantExpression = listItemExpression as ConstantExpression; - MemberExpression memberExpression = listItemExpression as MemberExpression; - NameExpression nameExpression = listItemExpression as NameExpression; - CallExpression listItemCallExpression = listItemExpression as CallExpression; - if (constantExpression != null) { - array.SetValue(constantExpression.Value, i); - } else if (memberExpression != null) { - string name = PythonControlFieldExpression.GetVariableName(memberExpression.Name); - array.SetValue(componentCreator.GetComponent(name), i); - } else if (nameExpression != null) { - array.SetValue(componentCreator.GetInstance(nameExpression.Name), i); - } else if (listItemCallExpression != null) { - Type arrayInstanceType = GetType(listItemCallExpression.Target as MemberExpression); - object instance = componentCreator.CreateInstance(arrayInstanceType, GetArguments(listItemCallExpression), null, false); - array.SetValue(instance, i); - } - } - return array; - } - - Type GetType(MemberExpression memberExpression) - { - string typeName = PythonControlFieldExpression.GetMemberName(memberExpression); - return componentCreator.GetType(typeName); - } - - /// - /// Deserializes an expression of the form: - /// - /// System.Drawing.Color.FromArgb(0, 192, 0) - /// - object DeserializeMethodCallExpression(CallExpression callExpression, MemberExpression memberExpression) - { - PythonControlFieldExpression field = PythonControlFieldExpression.Create(memberExpression); - Type type = GetType(field); - if (type != null) { - foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - if (method.Name == field.MemberName) { - if (method.GetParameters().Length == callExpression.Args.Count) { - return method.Invoke(null, GetArguments(callExpression).ToArray()); - } - } - } - } else { - // Maybe it is a call to a constructor? - type = componentCreator.GetType(field.FullMemberName); - if (type != null) { - return componentCreator.CreateInstance(type, GetArguments(callExpression), null, false); - } - } - return null; - } - - object Deserialize(UnaryExpression expression) - { - object rhs = Deserialize(expression.Expression); - switch (expression.Op) { - case PythonOperator.Negate: - return Negate(rhs); - } - return rhs; - } - - object Negate(object value) - { - if (value is int) { - return -1 * (int)value; - } else if (value is double) { - return -1 * (double)value; - } - return value; - } - - object Deserialize(ConstantExpression expression) - { - return expression.Value; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs deleted file mode 100644 index e740ca3f00c..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; - -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Used to generate Python code after the form has been changed in the designer. - /// - public class PythonCodeDomSerializer : IScriptingCodeDomSerializer - { - PythonCodeBuilder codeBuilder; - string indentString = String.Empty; - string rootResourceName = String.Empty; - IDesignerSerializationManager serializationManager; - - public PythonCodeDomSerializer() - : this("\t") - { - } - - public PythonCodeDomSerializer(string indentString) - { - this.indentString = indentString; - } - - public string GenerateInitializeComponentMethodBody(IDesignerHost host, IDesignerSerializationManager serializationManager) - { - return GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 0); - } - - public string GenerateInitializeComponentMethodBody(IDesignerHost host, IDesignerSerializationManager serializationManager, string rootNamespace, int initialIndent) - { - codeBuilder = new PythonCodeBuilder(initialIndent); - codeBuilder.IndentString = indentString; - - CodeMemberMethod method = FindInitializeComponentMethod(host, serializationManager); - GetResourceRootName(rootNamespace, host.RootComponent); - AppendStatements(method.Statements); - - return codeBuilder.ToString(); - } - - CodeMemberMethod FindInitializeComponentMethod(IDesignerHost host, IDesignerSerializationManager serializationManager) - { - this.serializationManager = serializationManager; - object rootComponent = host.RootComponent; - TypeCodeDomSerializer serializer = serializationManager.GetSerializer(rootComponent.GetType(), typeof(TypeCodeDomSerializer)) as TypeCodeDomSerializer; - CodeTypeDeclaration typeDec = serializer.Serialize(serializationManager, rootComponent, host.Container.Components) as CodeTypeDeclaration; - foreach (CodeTypeMember member in typeDec.Members) { - CodeMemberMethod method = member as CodeMemberMethod; - if (method != null) { - if (method.Name == "InitializeComponent") { - return method; - } - } - } - return null; - } - - void AppendStatements(CodeStatementCollection statements) - { - foreach (CodeStatement statement in statements) { - AppendStatement(statement); - } - } - - void AppendStatement(CodeStatement statement) - { - if (statement is CodeExpressionStatement) { - AppendExpressionStatement((CodeExpressionStatement)statement); - } else if (statement is CodeCommentStatement) { - AppendCommentStatement((CodeCommentStatement)statement); - } else if (statement is CodeAssignStatement) { - AppendAssignStatement((CodeAssignStatement)statement); - } else if (statement is CodeVariableDeclarationStatement) { - AppendVariableDeclarationStatement((CodeVariableDeclarationStatement)statement); - } else if (statement is CodeAttachEventStatement) { - AppendAttachEventStatement((CodeAttachEventStatement)statement); - } else { - Console.WriteLine("AppendStatement: " + statement.GetType().Name); - } - } - - void AppendExpressionStatement(CodeExpressionStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Expression); - codeBuilder.AppendLine(); - } - - void AppendCommentStatement(CodeCommentStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - codeBuilder.Append("# "); - codeBuilder.Append(statement.Comment.Text); - codeBuilder.AppendLine(); - } - - void AppendExpression(CodeExpression expression) - { - if (expression is CodeMethodInvokeExpression) { - AppendMethodInvokeExpression((CodeMethodInvokeExpression)expression); - } else if (expression is CodePropertyReferenceExpression) { - AppendPropertyReferenceExpression((CodePropertyReferenceExpression)expression); - } else if (expression is CodeObjectCreateExpression) { - AppendObjectCreateExpression((CodeObjectCreateExpression)expression); - } else if (expression is CodePrimitiveExpression) { - AppendPrimitiveExpression((CodePrimitiveExpression)expression); - } else if (expression is CodeFieldReferenceExpression) { - AppendFieldReferenceExpression((CodeFieldReferenceExpression)expression); - } else if (expression is CodeThisReferenceExpression) { - AppendThisReferenceExpression(); - } else if (expression is CodeTypeReferenceExpression) { - AppendTypeReferenceExpression((CodeTypeReferenceExpression)expression); - } else if (expression is CodeArrayCreateExpression) { - AppendArrayCreateExpression((CodeArrayCreateExpression)expression); - } else if (expression is CodeVariableReferenceExpression) { - AppendVariableReferenceExpression((CodeVariableReferenceExpression)expression); - } else if (expression is CodeDelegateCreateExpression) { - AppendDelegateCreateExpression((CodeDelegateCreateExpression)expression); - } else if (expression is CodeCastExpression) { - AppendCastExpression((CodeCastExpression)expression); - } else if (expression is CodeBinaryOperatorExpression) { - AppendBinaryOperatorExpression((CodeBinaryOperatorExpression)expression); - } else { - Console.WriteLine("AppendExpression: " + expression.GetType().Name); - } - } - - /// - /// Appends a method call (e.g. "self.SuspendLayout()"); - /// - void AppendMethodInvokeExpression(CodeMethodInvokeExpression expression) - { - AppendMethodReferenceExpression(expression.Method); - AppendParameters(expression.Parameters); - } - - void AppendMethodReferenceExpression(CodeMethodReferenceExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.MethodName); - } - - void AppendParameters(CodeExpressionCollection parameters) - { - codeBuilder.Append("("); - bool firstParameter = true; - foreach (CodeExpression expression in parameters) { - if (firstParameter) { - firstParameter = false; - } else { - codeBuilder.Append(", "); - } - AppendExpression(expression); - } - codeBuilder.Append(")"); - } - - void AppendAssignStatement(CodeAssignStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Left); - codeBuilder.Append(" = "); - AppendExpression(statement.Right); - codeBuilder.AppendLine(); - } - - void AppendPropertyReferenceExpression(CodePropertyReferenceExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.PropertyName); - } - - void AppendObjectCreateExpression(CodeObjectCreateExpression expression) - { - AppendTypeReference(expression.CreateType); - AppendParameters(expression.Parameters); - } - - /// - /// Appends a constant (e.g. string or int). - /// - void AppendPrimitiveExpression(CodePrimitiveExpression expression) - { - codeBuilder.Append(PythonPropertyValueAssignment.ToString(expression.Value)); - } - - void AppendFieldReferenceExpression(CodeFieldReferenceExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - if (expression.FieldName != null) { - if (expression.TargetObject is CodeThisReferenceExpression) { - if (!IsInherited(expression.FieldName)) { - codeBuilder.Append("_"); - } - } - codeBuilder.Append(expression.FieldName); - } - } - - void AppendThisReferenceExpression() - { - codeBuilder.Append("self"); - } - - void AppendTypeReferenceExpression(CodeTypeReferenceExpression expression) - { - AppendTypeReference(expression.Type); - } - - void AppendTypeReference(CodeTypeReference typeRef) - { - string typeRefText = typeRef.BaseType.Replace('+', '.'); - codeBuilder.Append(typeRefText); - } - - /// - /// Creates an array expression: - /// - /// (System.Array[System.Object](\r\n" + - /// ["aaa", - /// "bbb", - /// "ccc\"])) - /// - void AppendArrayCreateExpression(CodeArrayCreateExpression expression) - { - codeBuilder.Append("System.Array["); - AppendTypeReference(expression.CreateType); - codeBuilder.Append("]"); - - AppendInitializers(expression.Initializers); - } - - /// - /// Appends initializers for an array. - /// - void AppendInitializers(CodeExpressionCollection initalizers) - { - codeBuilder.Append("("); - codeBuilder.AppendLine(); - codeBuilder.IncreaseIndent(); - codeBuilder.AppendIndented("["); - - bool firstInitializer = true; - foreach (CodeExpression expression in initalizers) { - if (firstInitializer) { - firstInitializer = false; - } else { - codeBuilder.Append(","); - codeBuilder.AppendLine(); - codeBuilder.AppendIndented(String.Empty); - } - AppendExpression(expression); - } - - codeBuilder.Append("])"); - codeBuilder.DecreaseIndent(); - } - - /// - /// Appends a local variable declaration. - /// - void AppendVariableDeclarationStatement(CodeVariableDeclarationStatement statement) - { - if (statement.Name == "resources") { - codeBuilder.AppendIndented("resources = System.Resources.ResourceManager(\""); - codeBuilder.Append(rootResourceName); - codeBuilder.Append("\", System.Reflection.Assembly.GetEntryAssembly())"); - codeBuilder.AppendLine(); - } else { - codeBuilder.AppendIndented(statement.Name); - codeBuilder.Append(" = "); - AppendExpression(statement.InitExpression); - codeBuilder.AppendLine(); - } - } - - void AppendVariableReferenceExpression(CodeVariableReferenceExpression expression) - { - codeBuilder.Append(expression.VariableName); - } - - void AppendAttachEventStatement(CodeAttachEventStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Event.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(statement.Event.EventName); - - codeBuilder.Append(" += "); - - AppendExpression(statement.Listener); - - codeBuilder.AppendLine(); - } - - void AppendDelegateCreateExpression(CodeDelegateCreateExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.MethodName); - } - - void GetResourceRootName(string rootNamespace, IComponent component) - { - rootResourceName = component.Site.Name; - if (!String.IsNullOrEmpty(rootNamespace)) { - rootResourceName = rootNamespace + "." + rootResourceName; - } - } - - void AppendCastExpression(CodeCastExpression expression) - { - AppendExpression(expression.Expression); - } - - bool IsInherited(string componentName) - { - return IsInherited(serializationManager.GetInstance(componentName)); - } - - static bool IsInherited(object component) - { - InheritanceAttribute attribute = GetInheritanceAttribute(component); - if (attribute != null) { - return attribute.InheritanceLevel != InheritanceLevel.NotInherited; - } - return false; - } - - static InheritanceAttribute GetInheritanceAttribute(object component) - { - if (component != null) { - AttributeCollection attributes = TypeDescriptor.GetAttributes(component); - return attributes[typeof(InheritanceAttribute)] as InheritanceAttribute; - } - return null; - } - - /// - /// Appends expressions like "AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top" - /// - void AppendBinaryOperatorExpression(CodeBinaryOperatorExpression expression) - { - AppendExpression(expression.Left); - AppendBinaryOperator(expression.Operator); - AppendExpression(expression.Right); - } - - void AppendBinaryOperator(CodeBinaryOperatorType operatorType) - { - codeBuilder.Append(" "); - switch (operatorType) { - case CodeBinaryOperatorType.BitwiseOr: - codeBuilder.Append("|"); - break; - } - codeBuilder.Append(" "); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilationUnit.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilationUnit.cs deleted file mode 100644 index ab8a9fc7c4d..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilationUnit.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonCompilationUnit : DefaultCompilationUnit - { - public PythonCompilationUnit(IProjectContent projectContent, string fileName) - : base(projectContent) - { - this.FileName = fileName; - this.UsingScope = new PythonUsingScope(fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs deleted file mode 100644 index e06447f2034..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using Microsoft.Scripting; -using System; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Saves information about a parser error reported by the - /// PythonCompilerSink. - /// - public class PythonCompilerError - { - string path = String.Empty; - string message = String.Empty; - string lineText = String.Empty; - SourceSpan location; - int errorCode; - Severity severity; - - public PythonCompilerError(string path, string message, string lineText, SourceSpan location, int errorCode, Severity severity) - { - this.path = path; - this.message = message; - this.lineText = lineText; - this.location = location; - this.errorCode = errorCode; - this.severity = severity; - } - - public override string ToString() - { - return String.Concat("[", errorCode, "][Sev:", severity.ToString(), "]", message, "\r\nLine: ", location.Start.Line, lineText, "\r\n", path, "\r\n"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs deleted file mode 100644 index f78a14b0345..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using Microsoft.Scripting; -using System; -using System.Collections.Generic; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Supresses exceptions thrown by the PythonParser when it - /// finds a parsing error. By default the simple compiler sink - /// throws an exception on a parsing error. - /// - public class PythonCompilerSink : ErrorSink - { - List errors = new List(); - - public PythonCompilerSink() - { - } - - public override void Add(SourceUnit source, string message, SourceSpan span, int errorCode, Severity severity) - { - int line = GetLine(span.Start.Line); - errors.Add(new PythonCompilerError(source.Path, message, source.GetCodeLine(line), span, errorCode, severity)); - } - - public List Errors { - get { return errors; } - } - - /// - /// Ensure the line number is valid. - /// - static int GetLine(int line) - { - if (line > 0) { - return line; - } - return 1; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompletionItemList.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompletionItemList.cs deleted file mode 100644 index ba8fecc1048..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompletionItemList.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace ICSharpCode.PythonBinding -{ - public class PythonCompletionItemList : DefaultCompletionItemList - { - public override CompletionItemListKeyResult ProcessInput(char key) - { - if (IsNormalKey(key)) { - return CompletionItemListKeyResult.NormalKey; - } - return base.ProcessInput(key); - } - - bool IsNormalKey(char key) - { - return (key == '*') || (key == '('); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs deleted file mode 100644 index 348febff58d..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalker.cs +++ /dev/null @@ -1,417 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.Reflection; -using System.Resources; -using System.Text; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Visits the code's Python AST and creates a Windows Form. - /// - public class PythonComponentWalker : PythonWalker, IComponentWalker - { - IComponent component; - PythonControlFieldExpression fieldExpression; - IComponentCreator componentCreator; - bool walkingAssignment; - string componentName = String.Empty; - PythonCodeDeserializer deserializer; - ClassDefinition classDefinition; - bool walkingInitializeComponentMethod; - - public PythonComponentWalker(IComponentCreator componentCreator) - { - this.componentCreator = componentCreator; - deserializer = new PythonCodeDeserializer(componentCreator); - } - - /// - /// Creates a control either a UserControl or Form from the python code. - /// - public IComponent CreateComponent(string pythonCode) - { - PythonParser parser = new PythonParser(); - PythonAst ast = parser.CreateAst(@"Control.py", new StringTextBuffer(pythonCode)); - ast.Walk(this); - - // Did we find the InitializeComponent method? - if (component == null) { - throw new PythonComponentWalkerException("Unable to find InitializeComponents method."); - } - return component; - } - - /// - /// Gets the fully qualified name of the base class. - /// - public static string GetBaseClassName(ClassDefinition classDefinition) - { - if (classDefinition.Bases.Count > 0) { - Expression baseClassExpression = classDefinition.Bases[0]; - NameExpression nameExpression = baseClassExpression as NameExpression; - MemberExpression memberExpression = baseClassExpression as MemberExpression; - if (nameExpression != null) { - return nameExpression.Name; - } - return PythonControlFieldExpression.GetMemberName(memberExpression); - } - return String.Empty; - } - - public override bool Walk(ClassDefinition node) - { - classDefinition = node; - componentName = node.Name; - node.Body.Walk(this); - return false; - } - - public override bool Walk(FunctionDefinition node) - { - if (IsInitializeComponentMethod(node)) { - Type type = GetComponentType(); - component = componentCreator.CreateComponent(type, componentName); - IResourceReader reader = componentCreator.GetResourceReader(CultureInfo.InvariantCulture); - if (reader != null) { - reader.Dispose(); - } - walkingInitializeComponentMethod = true; - node.Body.Walk(this); - walkingInitializeComponentMethod = false; - } - return false; - } - - public override bool Walk(AssignmentStatement node) - { - if (!walkingInitializeComponentMethod) { - return false; - } - - if (node.Left.Count > 0) { - MemberExpression lhsMemberExpression = node.Left[0] as MemberExpression; - NameExpression lhsNameExpression = node.Left[0] as NameExpression; - if (lhsMemberExpression != null) { - fieldExpression = PythonControlFieldExpression.Create(lhsMemberExpression); - WalkMemberExpressionAssignmentRhs(node.Right); - } else if (lhsNameExpression != null) { - CallExpression callExpression = node.Right as CallExpression; - if (callExpression != null) { - object instance = CreateInstance(lhsNameExpression.Name.ToString(), callExpression); - if (instance == null) { - ThrowCouldNotFindTypeException(callExpression.Target as MemberExpression); - } - } - } - } - return false; - } - - public override bool Walk(ConstantExpression node) - { - if (!walkingInitializeComponentMethod) { - return false; - } - - fieldExpression.SetPropertyValue(componentCreator, node.Value); - return false; - } - - public override bool Walk(CallExpression node) - { - if (!walkingInitializeComponentMethod) { - return false; - } - - if (walkingAssignment) { - WalkAssignmentRhs(node); - } else { - WalkMethodCall(node); - } - return false; - } - - public override bool Walk(NameExpression node) - { - if (!walkingInitializeComponentMethod) { - return false; - } - - fieldExpression.SetPropertyValue(componentCreator, node); - return false; - } - - /// - /// Walks a statement of the form: - /// - /// self.a += self.b - /// - public override bool Walk(AugmentedAssignStatement node) - { - if (!walkingInitializeComponentMethod) { - return false; - } - - MemberExpression eventExpression = node.Left as MemberExpression; - string eventName = eventExpression.Name.ToString(); - fieldExpression = PythonControlFieldExpression.Create(eventExpression); - - MemberExpression eventHandlerExpression = node.Right as MemberExpression; - string eventHandlerName = eventHandlerExpression.Name.ToString(); - - IComponent currentComponent = fieldExpression.GetObject(componentCreator) as IComponent; - - EventDescriptor eventDescriptor = TypeDescriptor.GetEvents(currentComponent).Find(eventName, false); - PropertyDescriptor propertyDescriptor = componentCreator.GetEventProperty(eventDescriptor); - propertyDescriptor.SetValue(currentComponent, eventHandlerName); - return false; - } - - /// - /// Walks the binary expression which is the right hand side of an assignment statement. - /// - void WalkAssignment(BinaryExpression binaryExpression) - { - object value = deserializer.Deserialize(binaryExpression); - fieldExpression.SetPropertyValue(componentCreator, value); - } - - /// - /// Walks the right hand side of an assignment to a member expression. - /// - void WalkMemberExpressionAssignmentRhs(Expression rhs) - { - MemberExpression rhsMemberExpression = rhs as MemberExpression; - if (rhsMemberExpression != null) { - object propertyValue = GetPropertyValueFromAssignmentRhs(rhsMemberExpression); - fieldExpression.SetPropertyValue(componentCreator, propertyValue); - } else { - walkingAssignment = true; - BinaryExpression binaryExpression = rhs as BinaryExpression; - if (binaryExpression != null) { - WalkAssignment(binaryExpression); - } else { - rhs.Walk(this); - } - walkingAssignment = false; - } - } - - static bool IsInitializeComponentMethod(FunctionDefinition node) - { - string name = node.Name.ToString().ToLowerInvariant(); - return name == "initializecomponent" || name == "initializecomponents"; - } - - /// - /// Adds a component to the list of created objects. - /// - void AddComponent(string name, object obj) - { - IComponent component = obj as IComponent; - if (component != null) { - string variableName = PythonControlFieldExpression.GetVariableName(name); - componentCreator.Add(component, variableName); - } - } - - /// - /// Gets the type for the control being walked. - /// - Type GetComponentType() - { - string baseClass = GetBaseClassName(classDefinition); - Type type = componentCreator.GetType(baseClass); - if (type != null) { - return type; - } - - if (baseClass.Contains("UserControl")) { - return typeof(UserControl); - } - return typeof(Form); - } - - /// - /// Gets the property value from the member expression. The member expression is taken from the - /// right hand side of an assignment. - /// - object GetPropertyValueFromAssignmentRhs(MemberExpression memberExpression) - { - return deserializer.Deserialize(memberExpression); - } - - /// - /// Walks the right hand side of an assignment where the assignment expression is a call expression. - /// Typically the call expression will be a constructor call. - /// - /// Constructor call: System.Windows.Forms.Form() - /// - void WalkAssignmentRhs(CallExpression node) - { - MemberExpression memberExpression = node.Target as MemberExpression; - if (memberExpression != null) { - string name = fieldExpression.GetInstanceName(componentCreator); - object instance = CreateInstance(name, node); - if (instance != null) { - if (!fieldExpression.SetPropertyValue(componentCreator, instance)) { - AddComponent(fieldExpression.MemberName, instance); - } - } else { - object obj = deserializer.Deserialize(node); - if (obj != null) { - fieldExpression.SetPropertyValue(componentCreator, obj); - } else if (IsResource(memberExpression)) { - fieldExpression.SetPropertyValue(componentCreator, GetResource(node)); - } else { - ThrowCouldNotFindTypeException(memberExpression); - } - } - } else if (node.Target is IndexExpression) { - WalkArrayAssignmentRhs(node); - } - } - - /// - /// Walks a method call. Typical method calls are: - /// - /// self._menuItem1.Items.AddRange(...) - /// - /// This method will execute the method call. - /// - void WalkMethodCall(CallExpression node) - { - // Try to get the object being called. Try the form first then - // look for other controls. - object member = PythonControlFieldExpression.GetMember(component, node); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(node); - if (member == null) { - member = field.GetMember(componentCreator); - } - - // Execute the method on the object. - if (member != null) { - object[] args = deserializer.GetArguments(node).ToArray(); - InvokeMethod(member, field.MethodName, args); - } - } - - void InvokeMethod(object obj, string name, object[] args) - { - Type type = obj.GetType(); - try { - type.InvokeMember(name, BindingFlags.InvokeMethod, Type.DefaultBinder, obj, args); - } catch (MissingMethodException ex) { - // Look for an explicitly implemented interface. - MethodInfo method = FindInterfaceMethod(type, name); - if (method != null) { - method.Invoke(obj, args); - } else { - throw ex; - } - } - } - - /// - /// Looks for an explicitly implemented interface. - /// - MethodInfo FindInterfaceMethod(Type type, string name) - { - string nameMatch = "." + name; - foreach (MethodInfo method in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { - if (method.Name.EndsWith(nameMatch)) { - return method; - } - } - return null; - } - - /// - /// Creates a new instance with the specified name. - /// - object CreateInstance(string name, CallExpression node) - { - MemberExpression memberExpression = node.Target as MemberExpression; - if (memberExpression != null) { - string typeName = PythonControlFieldExpression.GetMemberName(memberExpression); - Type type = componentCreator.GetType(typeName); - if (type != null) { - if (type.IsAssignableFrom(typeof(ComponentResourceManager))) { - return componentCreator.CreateInstance(type, new object[0], name, false); - } - List args = deserializer.GetArguments(node); - return componentCreator.CreateInstance(type, args, name, false); - } - } - return null; - } - - /// - /// Returns true if the expression is of the form: - /// - /// resources.GetObject(...) or - /// resources.GetString(...) - /// - bool IsResource(MemberExpression memberExpression) - { - string fullName = PythonControlFieldExpression.GetMemberName(memberExpression); - return fullName.StartsWith("resources.", StringComparison.InvariantCultureIgnoreCase); - } - - object GetResource(CallExpression callExpression) - { - IResourceReader reader = componentCreator.GetResourceReader(CultureInfo.InvariantCulture); - if (reader != null) { - using (ResourceSet resources = new ResourceSet(reader)) { - List args = deserializer.GetArguments(callExpression); - return resources.GetObject(args[0] as String); - } - } - return null; - } - - /// - /// Walks the right hand side of an assignment when the assignment is an array creation. - /// - void WalkArrayAssignmentRhs(CallExpression callExpression) - { - object array = deserializer.Deserialize(callExpression); - fieldExpression.SetPropertyValue(componentCreator, array); - } - - void ThrowCouldNotFindTypeException(MemberExpression memberExpression) - { - string typeName = PythonControlFieldExpression.GetMemberName(memberExpression); - throw new PythonComponentWalkerException(String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), typeName)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalkerException.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalkerException.cs deleted file mode 100644 index 1ef014daaf6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonComponentWalkerException.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Exception thrown by the PythonComponentWalker class. - /// - public class PythonComponentWalkerException : Exception - { - public PythonComponentWalkerException(string message) : base(message) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs deleted file mode 100644 index e5c66068f2d..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.IO; - -using ICSharpCode.Scripting; -using Microsoft.Scripting.Hosting.Shell; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConsole : ThreadSafeScriptingConsole, IConsole, IMemberProvider - { - IScriptingConsoleTextEditor textEditor; - IControlDispatcher dispatcher; - - public PythonConsole(IScriptingConsoleTextEditor textEditor, IControlDispatcher dispatcher) - : this(new ScriptingConsole(textEditor), dispatcher) - { - this.textEditor = textEditor; - } - - PythonConsole(ScriptingConsole console, IControlDispatcher dispatcher) - : base(console, dispatcher) - { - this.dispatcher = dispatcher; - console.MemberProvider = this; - } - - public ScriptingConsoleOutputStream CreateOutputStream() - { - return new ScriptingConsoleOutputStream(textEditor, dispatcher); - } - - public CommandLine CommandLine { get; set; } - - public TextWriter Output { - get { return null; } - set { } - } - - public TextWriter ErrorOutput { - get { return null; } - set { } - } - - /// - /// Gets the member names of the specified item. - /// - public IList GetMemberNames(string name) - { - return CommandLine.GetMemberNames(name); - } - - public IList GetGlobals(string name) - { - return CommandLine.GetGlobals(name); - } - - public void Write(string text, Style style) - { - base.Write(text, (ScriptingStyle)style); - } - - public void WriteLine(string text, Style style) - { - base.WriteLine(text, (ScriptingStyle)style); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs deleted file mode 100644 index 2f2e8499f1a..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleApplication.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Diagnostics; -using System.Text; -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConsoleApplication : ScriptingConsoleApplication - { - PythonAddInOptions options; - - public PythonConsoleApplication(PythonAddInOptions options) - { - this.options = options; - } - - public override string FileName { - get { return options.PythonFileName; } - } - - protected override void AddArguments(ScriptingCommandLineBuilder commandLine) - { - commandLine.AppendBooleanOptionIfTrue("-X:Debug", Debug); - commandLine.AppendQuotedStringIfNotEmpty(ScriptFileName); - commandLine.AppendStringIfNotEmpty(ScriptCommandLineArguments); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleHost.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleHost.cs deleted file mode 100644 index 60bebbca9d6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsoleHost.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Text; -using System.Threading; - -using ICSharpCode.Scripting; -using IronPython.Hosting; -using IronPython.Runtime; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConsoleHost : ConsoleHost, IScriptingConsoleHost - { - Thread thread; - PythonConsole pythonConsole; - - public PythonConsoleHost(IScriptingConsoleTextEditor textEditor, IControlDispatcher dispatcher) - { - pythonConsole = new PythonConsole(textEditor, dispatcher); - } - - public IScriptingConsole ScriptingConsole { - get { return pythonConsole; } - } - - protected override Type Provider { - get { return typeof(PythonContext); } - } - - /// - /// Runs the console host in its own thread. - /// - public void Run() - { - thread = new Thread(RunConsole); - thread.Start(); - } - - public void Dispose() - { - if (pythonConsole != null) { - pythonConsole.Dispose(); - } - - if (thread != null) { - thread.Join(); - } - } - - protected override CommandLine CreateCommandLine() - { - return new PythonCommandLine(); - } - - protected override OptionsParser CreateOptionsParser() - { - return new PythonOptionsParser(); - } - - /// - /// After the engine is created the standard output is replaced with our custom Stream class so we - /// can redirect the stdout to the text editor window. - /// This can be done in this method since the Runtime object will have been created before this method - /// is called. - /// - protected override IConsole CreateConsole(ScriptEngine engine, CommandLine commandLine, ConsoleOptions options) - { - ScriptingConsoleOutputStream stream = pythonConsole.CreateOutputStream(); - SetOutput(stream); - pythonConsole.CommandLine = commandLine; - return pythonConsole; - } - - protected virtual void SetOutput(ScriptingConsoleOutputStream stream) - { - Runtime.IO.SetOutput(stream, Encoding.UTF8); - } - - void RunConsole() - { - Run(new string[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsolePad.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsolePad.cs deleted file mode 100644 index 8c2a5a353f1..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsolePad.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConsolePad : ScriptingConsolePad - { - protected override IScriptingConsoleHost CreateConsoleHost(IScriptingConsoleTextEditor consoleTextEditor, - IControlDispatcher dispatcher) - { - return new PythonConsoleHost(consoleTextEditor, dispatcher); - } - - protected override string SyntaxHighlightingName { - get { return "Python"; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConstructor.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConstructor.cs deleted file mode 100644 index 2a3e8261bd8..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConstructor.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonConstructor : PythonMethod - { - public PythonConstructor(IClass declaringType, FunctionDefinition methodDefinition) - : base(declaringType, methodDefinition, "#ctor") - { - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs deleted file mode 100644 index e135ff8b1a8..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Reflection; -using System.Text; -using System.Windows.Forms; - -using ICSharpCode.Scripting; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Represents a member field expression in a Control or Form: - /// - /// self._textBox1 - /// self._textBox1.Name - /// - public class PythonControlFieldExpression - { - string memberName = String.Empty; - string fullMemberName = String.Empty; - string variableName = String.Empty; - string methodName = String.Empty; - bool selfReference; - - public PythonControlFieldExpression(string memberName, string variableName, string methodName, string fullMemberName) - { - this.memberName = memberName; - this.variableName = variableName; - this.methodName = methodName; - this.fullMemberName = fullMemberName; - selfReference = ContainsSelfReference(fullMemberName); - } - - /// - /// From a member expression of the form: self._textBox1.Name this property will return "Name". - /// - public string MemberName { - get { return memberName; } - } - - /// - /// From a member expression of the form: self._textBox1.Name this property will return "self._textBox1.Name". - /// - public string FullMemberName { - get { return fullMemberName; } - } - - /// - /// From a member expression of the form: self._textBox1.Name this property will return "textBox1". - /// - public string VariableName { - get { return variableName; } - } - - /// - /// Returns the method being called by the field reference. - /// - public string MethodName { - get { return methodName; } - } - - /// - /// Returns whether the variable is for a field or not. - /// - public bool IsSelfReference { - get { return selfReference; } - } - - public override string ToString() - { - return "[VariableName: " + variableName + " FullMemberName: " + fullMemberName + "]"; - } - - public override bool Equals(object obj) - { - PythonControlFieldExpression rhs = obj as PythonControlFieldExpression; - if (rhs != null) { - return rhs.fullMemberName == fullMemberName && rhs.variableName == variableName; - } - return false; - } - - public override int GetHashCode() - { - return fullMemberName.GetHashCode(); - } - - /// - /// Creates a PythonControlField from a member expression: - /// - /// self._textBox1 - /// self._textBox1.Name - /// - public static PythonControlFieldExpression Create(MemberExpression expression) - { - return Create(GetMemberNames(expression)); - } - - /// - /// Creates a PythonControlField from a call expression: - /// - /// self._menuItem1.Items.AddRange(...) - /// - public static PythonControlFieldExpression Create(CallExpression expression) - { - string[] allNames = GetMemberNames(expression.Target as MemberExpression); - - // Remove last member since it is the method name. - int lastItemIndex = allNames.Length - 1; - string[] memberNames = new string[lastItemIndex]; - Array.Copy(allNames, memberNames, lastItemIndex); - - PythonControlFieldExpression field = Create(memberNames); - field.methodName = allNames[lastItemIndex]; - return field; - } - - /// - /// From a name such as "System.Windows.Forms.Cursors.AppStarting" this method returns: - /// "System.Windows.Forms.Cursors" - /// - public static string GetPrefix(string name) - { - int index = name.LastIndexOf('.'); - if (index > 0) { - return name.Substring(0, index); - } - return name; - } - - /// - /// Removes the underscore from the variable name. - /// - public static string GetVariableName(string name) - { - if (!String.IsNullOrEmpty(name)) { - if (name.Length > 0) { - if (name[0] == '_') { - return name.Substring(1); - } - } - } - return name; - } - - /// - /// Gets the fully qualified name being referenced in the MemberExpression. - /// - public static string GetMemberName(MemberExpression expression) - { - return GetMemberName(GetMemberNames(expression)); - } - - /// - /// Gets the member names that make up the MemberExpression in order. - /// - public static string[] GetMemberNames(MemberExpression expression) - { - List names = new List(); - while (expression != null) { - names.Insert(0, expression.Name); - - NameExpression nameExpression = expression.Target as NameExpression; - expression = expression.Target as MemberExpression; - if (expression == null) { - if (nameExpression != null) { - names.Insert(0, nameExpression.Name); - } - } - } - return names.ToArray(); - } - - /// - /// Returns true if the variable has a property with the specified name. - /// - public bool HasPropertyValue(IComponentCreator componentCreator, string name) - { - object component = GetObject(componentCreator); - if (component != null) { - return TypeDescriptor.GetProperties(component).Find(name, true) != null; - } - return false; - } - - /// - /// Gets the name of the instance. If the name matches a property of the current component being created - /// then this method returns null. - /// - public string GetInstanceName(IComponentCreator componentCreator) - { - if (IsSelfReference) { - if (!HasPropertyValue(componentCreator, memberName)) { - return variableName; - } - } - return null; - } - - /// - /// Looks for a field in the component with the given name. - /// - public static object GetInheritedObject(string name, object component) - { - if (component != null) { - FieldInfo[] fields = component.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); - foreach (FieldInfo field in fields) { - if (String.Equals(name, field.Name, StringComparison.InvariantCultureIgnoreCase)) { - return field.GetValue(component); - } - } - } - return null; - } - - /// - /// Gets the object that the field expression variable refers to. - /// - /// - /// This method will also check form's base class for any inherited objects that match - /// the object being referenced. - /// - public object GetObject(IComponentCreator componentCreator) - { - if (variableName.Length > 0) { - object component = componentCreator.GetComponent(variableName); - if (component != null) { - return component; - } - return GetInheritedObject(variableName, componentCreator.RootComponent); - } - return componentCreator.RootComponent; - } - - /// - /// Returns the object that the property is defined on. This method may just return the object - /// passed to it if the property is defined on that object. - /// - /// The object parameter must be equivalent to the object referred to - /// by the variable name in this PythonControlFieldExpression - /// (e.g. button1 in self._button1.FlatAppearance.BorderSize). - public object GetObjectForMemberName(object component) - { - string[] members = fullMemberName.Split('.'); - int startIndex = GetMembersStartIndex(members); - - object currentComponent = component; - for (int i = startIndex; i < members.Length - 1; ++i) { - PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(currentComponent).Find(members[i], true); - if (propertyDescriptor == null) { - return null; - } - currentComponent = propertyDescriptor.GetValue(currentComponent); - } - return currentComponent; - } - - /// - /// Sets the property value that is referenced by this field expression. - /// - /// - /// This method checks that the name expression matches a created instance before - /// converting the name expression as a string and setting the property value. - /// - public bool SetPropertyValue(IComponentCreator componentCreator, NameExpression nameExpression) - { - object component = GetComponent(componentCreator); - PropertyDescriptor property = GetProperty(component, memberName); - if (property != null) { - string name = nameExpression.Name; - if (property.PropertyType != typeof(bool)) { - if ("self" == name) { - return SetPropertyValue(component, memberName, componentCreator.RootComponent); - } else { - object instance = componentCreator.GetInstance(name); - if (instance != null) { - return SetPropertyValue(component, memberName, instance); - } - } - } - return SetPropertyValue(component, memberName, name); - } - return false; - } - - /// - /// Sets the property value that is referenced by this field expression. - /// - /// - /// Checks the field expression to see if it references an class instance variable (e.g. self._treeView1) - /// or a variable that is local to the InitializeComponent method (e.g. treeNode1.BackColor) - /// - public bool SetPropertyValue(IComponentCreator componentCreator, object propertyValue) - { - object component = GetComponent(componentCreator); - return SetPropertyValue(component, memberName, propertyValue); - } - - /// - /// Converts the value to the property's type if required. - /// - public static object ConvertPropertyValue(PropertyDescriptor propertyDescriptor, object propertyValue) - { - if (propertyValue != null) { - Type propertyValueType = propertyValue.GetType(); - if (!propertyDescriptor.PropertyType.IsAssignableFrom(propertyValueType)) { - if (propertyDescriptor.Converter.CanConvertFrom(propertyValueType)) { - return propertyDescriptor.Converter.ConvertFrom(propertyValue); - } - TypeConverter converter = TypeDescriptor.GetConverter(propertyValue); - return converter.ConvertTo(propertyValue, propertyDescriptor.PropertyType); - } - } - return propertyValue; - } - - /// - /// Gets the member object that matches the field member. - /// - /// For a field: - /// - /// self._menuStrip.Items.AddRange() - /// - /// This method returns: - /// - /// Items - /// - public object GetMember(IComponentCreator componentCreator) - { - object obj = componentCreator.GetComponent(variableName); - if (obj == null) { - obj = componentCreator.GetInstance(variableName); - if (obj == null) { - obj = GetInheritedObject(memberName, componentCreator.RootComponent); - if ((obj == null) && !IsSelfReference) { - obj = componentCreator.GetInstance(fullMemberName); - } - } - } - - if (obj != null) { - string[] memberNames = fullMemberName.Split('.'); - int startIndex = GetMembersStartIndex(memberNames); - return GetMember(obj, memberNames, startIndex, memberNames.Length - 1); - } - return null; - } - - /// - /// Gets the member object that matches the field member. - /// - /// - /// The member names array should contain all items including self, for example: - /// - /// self - /// Controls - /// - public static object GetMember(object obj, CallExpression expression) - { - string[] memberNames = GetMemberNames(expression.Target as MemberExpression); - if (ContainsSelfReference(memberNames)) { - return GetMember(obj, memberNames, 1, memberNames.Length - 2); - } - return null; - } - - /// - /// Gets the member that matches the last item in the memberNames array. - /// - /// The point at which to start looking in the memberNames. - /// The last memberNames item to look at. - static object GetMember(object obj, string[] memberNames, int startIndex, int endIndex) - { - for (int i = startIndex; i <= endIndex; ++i) { - Type type = obj.GetType(); - string name = memberNames[i]; - - // Try class members excluding inherited members first. - BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly; - PropertyInfo property = type.GetProperty(name, propertyBindingFlags); - if (property == null) { - // Try inherited members. - propertyBindingFlags = propertyBindingFlags & ~BindingFlags.DeclaredOnly; - property = type.GetProperty(name, propertyBindingFlags); - } - - if (property != null) { - obj = property.GetValue(obj, null); - } else { - return null; - } - } - return obj; - } - - static string GetMemberName(string[] names) - { - return String.Join(".", names); - } - - /// - /// Gets the variable name from an expression of the form: - /// - /// self._textBox1.Name - /// - /// Returns "textBox1" - /// - /// - /// If there is no self part then the variable name is the first part of the name. - /// - static string GetVariableNameFromSelfReference(string name) - { - if (ContainsSelfReference(name)) { - name = name.Substring(5); - } - - int endIndex = name.IndexOf('.'); - if (endIndex > 0) { - return GetVariableName(name.Substring(0, endIndex)); - } else if (name.StartsWith("_")) { - return GetVariableName(name); - } - return String.Empty; - } - - static PythonControlFieldExpression Create(string[] memberNames) - { - string memberName = String.Empty; - if (memberNames.Length > 1) { - memberName = memberNames[memberNames.Length - 1]; - } - string fullMemberName = PythonControlFieldExpression.GetMemberName(memberNames); - return new PythonControlFieldExpression(memberName, GetVariableNameFromSelfReference(fullMemberName), String.Empty, fullMemberName); - } - - static bool ContainsSelfReference(string name) - { - return name.StartsWith("self.", StringComparison.InvariantCultureIgnoreCase); - } - - static bool ContainsSelfReference(string[] members) - { - if (members.Length > 0) { - return "self".Equals(members[0], StringComparison.InvariantCultureIgnoreCase); - } - return false; - } - - /// - /// Returns the index into the members array where the members actually start. - /// The "self" and variable name are skipped. - /// - int GetMembersStartIndex(string[] members) - { - if (ContainsSelfReference(members)) { - // Skip self over when searching for member. - return 2; - } - return 1; - } - - /// - /// Sets the value of a property on the component. - /// - bool SetPropertyValue(object component, string name, object propertyValue) - { - PropertyDescriptor property = GetProperty(component, name); - if (property != null) { - if (OverrideNameProperty(component, name)) { - propertyValue = variableName; - } else { - propertyValue = ConvertPropertyValue(property, propertyValue); - } - property.SetValue(component, propertyValue); - return true; - } - return false; - } - - /// - /// Override the name property with the instance variable name when the component is a - /// ToolStripSeparator to support BindingNavigator separators using the same value for the - /// name property. - /// - bool OverrideNameProperty(object component, string property) - { - if (property == "Name") { - return component is ToolStripSeparator; - } - return false; - } - - /// - /// Gets the component that this field refers to. - /// - object GetComponent(IComponentCreator componentCreator) - { - object component = null; - if (IsSelfReference) { - component = GetObject(componentCreator); - component = GetObjectForMemberName(component); - } else { - component = componentCreator.GetInstance(variableName); - } - return component; - } - - static PropertyDescriptor GetProperty(object component, string name) - { - return TypeDescriptor.GetProperties(component).Find(name, true); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs deleted file mode 100644 index 95c9323f2a7..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.CodeDom; -using System.CodeDom.Compiler; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Text; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Form's designer generator for the Python language. - /// - public class PythonDesignerGenerator : ScriptingDesignerGenerator - { - public PythonDesignerGenerator(ITextEditorOptions textEditorOptions) - : base(textEditorOptions) - { - } - - public override IScriptingCodeDomSerializer CreateCodeDomSerializer(ITextEditorOptions options) - { - return new PythonCodeDomSerializer(options.IndentationString); - } - - /// - /// Returns the generated event handler. - /// - public override string CreateEventHandler(string eventMethodName, string body, string indentation) - { - if (String.IsNullOrEmpty(body)) { - body = "pass"; - } - - StringBuilder eventHandler = new StringBuilder(); - - eventHandler.Append(indentation); - eventHandler.Append("def "); - eventHandler.Append(eventMethodName); - eventHandler.Append("(self, sender, e):"); - eventHandler.AppendLine(); - eventHandler.Append(indentation); - eventHandler.Append(TextEditorOptions.IndentationString); - eventHandler.Append(body); - - return eventHandler.ToString(); - } - - /// - /// Converts from the DOM region to a document region. - /// - public override DomRegion GetBodyRegionInDocument(IMethod method) - { - DomRegion bodyRegion = method.BodyRegion; - return new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine + 1, 1); - } - - public override int InsertEventHandler(IDocument document, string eventHandler) - { - int line = document.TotalNumberOfLines; - IDocumentLine lastLineSegment = document.GetLine(line); - int offset = lastLineSegment.Offset + lastLineSegment.Length; - - string newContent = "\r\n" + eventHandler; - if (lastLineSegment.Length > 0) { - // Add an extra new line between the last line and the event handler. - newContent = "\r\n" + newContent; - } - document.Insert(offset, newContent); - - // Set position so it points to the line - // where the event handler was inserted. - return line + 1; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoader.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoader.cs deleted file mode 100644 index e3809947de5..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoader.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Security.Permissions; -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Loads the form or control's code so the forms designer can - /// display it. - /// - [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] - [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] - public class PythonDesignerLoader : ScriptingDesignerLoader - { - public PythonDesignerLoader(IScriptingDesignerGenerator generator) - : base(generator) - { - } - - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return new PythonComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoaderProvider.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoaderProvider.cs deleted file mode 100644 index 11605962ff8..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerLoaderProvider.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.ComponentModel.Design.Serialization; -using ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonDesignerLoaderProvider : IDesignerLoaderProvider - { - public PythonDesignerLoaderProvider() - { - } - - public DesignerLoader CreateLoader(IDesignerGenerator generator) - { - return new PythonDesignerLoader(generator as IScriptingDesignerGenerator); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpression.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpression.cs deleted file mode 100644 index 72b6183fec6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpression.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using IronPython.Compiler; -using IronPython.Runtime; - -namespace ICSharpCode.PythonBinding -{ - public class PythonExpression - { - Tokenizer tokenizer; - Token currentToken; - - public PythonExpression(ScriptEngine engine, string expression) - { - Init(engine, expression); - } - - void Init(ScriptEngine engine, string expression) - { - PythonContext context = HostingHelpers.GetLanguageContext(engine) as PythonContext; - SourceUnit source = CreateSourceUnit(context, expression); - CreateTokenizer(source); - } - - SourceUnit CreateSourceUnit(PythonContext context, string expression) - { - StringTextContentProvider textProvider = new StringTextContentProvider(expression); - return context.CreateSourceUnit(textProvider, String.Empty, SourceCodeKind.SingleStatement); - } - - void CreateTokenizer(SourceUnit source) - { - PythonCompilerSink sink = new PythonCompilerSink(); - PythonCompilerOptions options = new PythonCompilerOptions(); - - tokenizer = new Tokenizer(sink, options); - tokenizer.Initialize(source); - } - - public Token GetNextToken() - { - currentToken = tokenizer.GetNextToken(); - return currentToken; - } - - public Token CurrentToken { - get { return currentToken; } - } - - public bool IsImportToken(Token token) - { - return token.Kind == IronPython.Compiler.TokenKind.KeywordImport; - } - - public bool IsFromToken(Token token) - { - return token.Kind == IronPython.Compiler.TokenKind.KeywordFrom; - } - - public bool IsDotToken(Token token) - { - return token.Kind == IronPython.Compiler.TokenKind.Dot; - } - - public bool IsNameToken(Token token) - { - return token.Kind == IronPython.Compiler.TokenKind.Name; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpressionFinder.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpressionFinder.cs deleted file mode 100644 index de4e58a0803..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonExpressionFinder.cs +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Finds python expressions for code completion. - /// - public class PythonExpressionFinder : IExpressionFinder - { - class ExpressionRange - { - public int Start; - public int End; - - public int Length { - get { return End - Start + 1; } - } - } - - ExpressionRange expressionRange = new ExpressionRange(); - - public PythonExpressionFinder() - { - } - - /// - /// Finds an expression around the current offset. - /// - /// - /// Currently not implemented. This method is used heavily - /// in refactoring. - /// - public ExpressionResult FindFullExpression(string text, int offset) - { - return new ExpressionResult(null); - } - - /// - /// Removes the last part of the expression. - /// - /// - /// "array[i]" => "array" - /// "myObject.Field" => "myObject" - /// "myObject.Method(arg1, arg2)" => "myObject.Method" - /// - public string RemoveLastPart(string expression) - { - MemberName memberName = new MemberName(expression); - return memberName.Type; - } - - /// - /// Finds an expression before the current offset. - /// - /// - /// The expression is found before the specified offset. The - /// offset is just before the current cursor position. For example, - /// if the user presses the dot character then the offset - /// will be just before the dot. All characters before the offset and - /// at the offset are considered when looking for - /// the expression. All characters afterwards are ignored. - /// - public ExpressionResult FindExpression(string text, int offset) - { - if (!IsValidFindExpressionParameters(text, offset)) { - return new ExpressionResult(null); - } - - expressionRange.End = offset - 1; - expressionRange.Start = FindExpressionStart(text, expressionRange.End); - - if (IsImportExpression(text)) { - ExtendRangeToStartOfLine(text); - return CreatePythonImportExpressionResult(text, expressionRange); - } - return CreateDefaultExpressionResult(text, expressionRange); - } - - bool IsValidFindExpressionParameters(string text, int offset) - { - return (text != null) && IsValidOffset(text, offset); - } - - /// - /// This checks that the offset passed to the FindExpression method is valid. Usually the offset is - /// just after the last character in the text. - /// - /// The offset must be: - /// - /// 1) Greater than zero. - /// 2) Be inside the string. - /// 3) Be just after the end of the text. - /// - bool IsValidOffset(string text, int offset) - { - return (offset > 0) && (offset <= text.Length); - } - - int FindExpressionStart(string text, int offset) - { - while (offset >= 0) { - char currentChar = text[offset]; - switch (currentChar) { - case '\n': - case '\r': - case '\t': - case ' ': - return offset + 1; - } - offset--; - } - return 0; - } - - bool IsImportExpression(string text) - { - if (PythonImportExpression.IsImportExpression(text, expressionRange.End)) { - return true; - } - - if (IsSpaceCharacterBeforeExpression(text, expressionRange)) { - if (PythonImportExpression.IsImportExpression(text, expressionRange.Start)) { - return true; - } - } - return false; - } - - bool IsSpaceCharacterBeforeExpression(string text, ExpressionRange range) - { - int characterBeforeExpressionOffset = range.Start - 1; - if (characterBeforeExpressionOffset >= 0) { - return text[characterBeforeExpressionOffset] == ' '; - } - return false; - } - - void ExtendRangeToStartOfLine(string text) - { - if (expressionRange.Start > expressionRange.End) { - expressionRange.Start = expressionRange.End; - } - expressionRange.Start = FindLineStart(text, expressionRange.Start); - } - - /// - /// Finds the start of the line in the text starting from the - /// offset and working backwards. - /// - int FindLineStart(string text, int offset) - { - while (offset >= 0) { - char currentChar = text[offset]; - switch (currentChar) { - case '\n': - return offset + 1; - } - --offset; - } - return 0; - } - - ExpressionResult CreatePythonImportExpressionResult(string text, ExpressionRange range) - { - return CreateExpressionResult(text, range, new PythonImportExpressionContext()); - } - - ExpressionResult CreateDefaultExpressionResult(string text, ExpressionRange range) - { - return CreateExpressionResult(text, range, ExpressionContext.Default); - } - - ExpressionResult CreateExpressionResult(string text, ExpressionRange range, ExpressionContext context) - { - string expression = Substring(text, range); - return new ExpressionResult(expression, context); - } - - /// - /// Gets the substring starting from the specified index and - /// finishing at the specified end index. The character at the - /// end index is included in the string. - /// - string Substring(string text, ExpressionRange range) - { - return text.Substring(range.Start, range.Length); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs deleted file mode 100644 index 91c30b42ebe..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.PythonBinding -{ - public class PythonFormattingStrategy : ScriptingFormattingStrategy - { - public override string LineComment { - get { return "#"; } - } - - protected override LineIndenter CreateLineIndenter(ITextEditor editor, IDocumentLine line) - { - return new PythonLineIndenter(editor, line); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormsDesignerDisplayBinding.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormsDesignerDisplayBinding.cs deleted file mode 100644 index 174f2bb21b3..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormsDesignerDisplayBinding.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Forms designer display binding for Python files. - /// - public class PythonFormsDesignerDisplayBinding : ISecondaryDisplayBinding - { - public PythonFormsDesignerDisplayBinding() - { - } - - /// - /// Returns true so that the CreateSecondaryViewContent method - /// is called after the LoadSolutionProjects thread has finished. - /// - public bool ReattachWhenParserServiceIsReady { - get { return true; } - } - - public bool CanAttachTo(IViewContent content) - { - ITextEditorProvider textEditorProvider = content as ITextEditorProvider; - if (textEditorProvider != null) { - if (IsPythonFile(content.PrimaryFileName)) { - ParseInformation parseInfo = GetParseInfo(content.PrimaryFileName, textEditorProvider.TextEditor.Document); - return IsDesignable(parseInfo); - } - } - return false; - } - - public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent) - { - ScriptingTextEditorViewContent textEditorView = new ScriptingTextEditorViewContent(viewContent); - return CreateSecondaryViewContent(viewContent, textEditorView.TextEditorOptions); - } - - public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent, ITextEditorOptions textEditorOptions) - { - foreach (IViewContent existingView in viewContent.SecondaryViewContents) { - if (existingView.GetType() == typeof(FormsDesignerViewContent)) { - return new IViewContent[0]; - } - } - - IDesignerLoaderProvider loader = new PythonDesignerLoaderProvider(); - IDesignerGenerator generator = new PythonDesignerGenerator(textEditorOptions); - return new IViewContent[] { new FormsDesignerViewContent(viewContent, loader, generator) }; - } - - /// - /// Gets the parse information from the parser service - /// for the specified file. - /// - protected virtual ParseInformation GetParseInfo(string fileName, ITextBuffer textContent) - { - return ParserService.ParseFile(fileName, textContent); - } - - /// - /// Determines whether the specified parse information contains - /// a class which is designable. - /// - protected virtual bool IsDesignable(ParseInformation parseInfo) - { - return FormsDesignerSecondaryDisplayBinding.IsDesignable(parseInfo); - } - - /// - /// Checks the file's extension represents a python file. - /// - static bool IsPythonFile(string fileName) - { - PythonParser parser = new PythonParser(); - return parser.CanParse(fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFromImport.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFromImport.cs deleted file mode 100644 index 874a6703e75..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFromImport.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonFromImport : DefaultUsing - { - FromImportStatement fromImport; - - public PythonFromImport(IProjectContent projectContent, FromImportStatement fromImport) - : base(projectContent) - { - this.fromImport = fromImport; - } - - public bool IsImportedName(string name) - { - if (String.IsNullOrEmpty(name)) { - return false; - } - - for (int i = 0; i < fromImport.Names.Count; ++i) { - string importedName = GetImportedAsNameIfExists(i); - if (importedName == name) { - return true; - } - } - return false; - } - - string GetImportedAsNameIfExists(int index) - { - if (fromImport.AsNames != null) { - string importedAsName = fromImport.AsNames[index]; - if (importedAsName != null) { - return importedAsName; - } - } - return fromImport.Names[index]; - } - - public string Module { - get { return fromImport.Root.MakeString(); } - } - - public string GetOriginalNameForAlias(string alias) - { - if (fromImport.AsNames == null) { - return null; - } - - int index = fromImport.AsNames.IndexOf(alias); - if (index >= 0) { - return fromImport.Names[index]; - } - return null; - } - - public bool ImportsEverything { - get { - return fromImport.Names[0] == "*"; - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImport.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImport.cs deleted file mode 100644 index e5b0011047d..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImport.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImport : DefaultUsing - { - ImportStatement importStatement; - - public PythonImport(IProjectContent projectContent, ImportStatement importStatement) - : base(projectContent) - { - this.importStatement = importStatement; - AddUsings(); - } - - void AddUsings() - { - for (int i = 0; i < importStatement.Names.Count; ++i) { - string name = GetImportedAsNameIfExists(i); - Usings.Add(name); - } - } - - string GetImportedAsNameIfExists(int index) - { - string name = importStatement.AsNames[index]; - if (name != null) { - return name; - } - return importStatement.Names[index].MakeString(); - } - - public string Module { - get { return importStatement.Names[0].MakeString(); } - } - - public string GetOriginalNameForAlias(string alias) - { - int index = importStatement.AsNames.IndexOf(alias); - if (index >= 0) { - return importStatement.Names[index].MakeString(); - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportCompletion.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportCompletion.cs deleted file mode 100644 index ba14cbd2fed..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportCompletion.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Reflection; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Modules; -using IronPython.Runtime; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImportCompletion - { - public static readonly NamespaceEntry ImportAll = new NamespaceEntry("*"); - - IProjectContent projectContent; - static readonly PythonStandardModules standardPythonModules = new PythonStandardModules(); - - public PythonImportCompletion(IProjectContent projectContent) - { - this.projectContent = projectContent; - } - - public List GetCompletionItems() - { - return GetCompletionItems(String.Empty); - } - - public List GetCompletionItems(string subNamespace) - { - List items = projectContent.GetNamespaceContents(subNamespace); - - if (String.IsNullOrEmpty(subNamespace)) { - AddStandardPythonModules(items); - } - return items; - } - - void AddStandardPythonModules(List items) - { - items.AddRange(standardPythonModules); - } - - public List GetCompletionItemsFromModule(string module) - { - List items = GetCompletionItemsFromStandardPythonModules(module); - if (items == null) { - items = projectContent.GetNamespaceContents(module); - } - items.Add(ImportAll); - return items; - } - - List GetCompletionItemsFromStandardPythonModules(string module) - { - PythonStandardModuleType type = standardPythonModules.GetModuleType(module); - if (type != null) { - return GetCompletionItemsFromModule(type); - } - return null; - } - - List GetCompletionItemsFromModule(PythonStandardModuleType type) - { - PythonModuleCompletionItems moduleItems = PythonModuleCompletionItemsFactory.Create(type); - List items = new List(moduleItems); - return items; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpression.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpression.cs deleted file mode 100644 index c330f2670b9..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpression.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Text; -using IronPython.Compiler; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImportExpression : PythonExpression - { - string module = String.Empty; - string identifier = String.Empty; - bool hasFromAndImport; - - public PythonImportExpression(string expression) - : this(Python.CreateEngine(), expression) - { - } - - public PythonImportExpression(ScriptEngine engine, string expression) - : base(engine, expression) - { - Parse(engine, expression); - } - - void Parse(ScriptEngine engine, string expression) - { - Token token = GetNextToken(); - if (IsImportToken(token)) { - ParseImportExpression(); - } else if (IsFromToken(token)) { - ParseFromExpression(); - } - } - - void ParseImportExpression() - { - GetModuleName(); - } - - void ParseFromExpression() - { - GetModuleName(); - - if (IsImportToken(CurrentToken)) { - hasFromAndImport = true; - GetIdentifierName(); - } - } - - void GetModuleName() - { - module = GetName(); - } - - string GetName() - { - StringBuilder name = new StringBuilder(); - Token token = GetNextToken(); - while (IsNameToken(token)) { - name.Append((string)token.Value); - token = GetNextToken(); - if (IsDotToken(token)) { - name.Append('.'); - token = GetNextToken(); - } - } - return name.ToString(); - } - - void GetIdentifierName() - { - identifier = GetName(); - } - - public bool HasFromAndImport { - get { return hasFromAndImport; } - } - - public string Module { - get { return module; } - } - - public string Identifier { - get { return identifier; } - } - - public bool HasIdentifier { - get { return !String.IsNullOrEmpty(identifier); } - } - - /// - /// Returns true if the expression is of the form: - /// - /// "import " - /// "from " - /// "import System" - /// "from System" - /// "from System import Console" - /// - public static bool IsImportExpression(string text, int offset) - { - if (!ValidIsImportExpressionParameters(text, offset)) { - return false; - } - - string previousWord = FindPreviousWord(text, offset); - if (IsImportOrFromString(previousWord)) { - return true; - } - - int previousWordOffset = offset - previousWord.Length + 1; - previousWord = FindPreviousWord(text, previousWordOffset); - return IsImportOrFromString(previousWord); - } - - static bool ValidIsImportExpressionParameters(string text, int offset) - { - if (String.IsNullOrEmpty(text) || (offset <= 0) || (offset >= text.Length)) { - return false; - } - return true; - } - - static string FindPreviousWord(string text, int offset) - { - int previousWordOffset = FindPreviousWordOffset(text, offset); - int length = offset - previousWordOffset + 1; - return text.Substring(previousWordOffset, length); - } - - static int FindPreviousWordOffset(string text, int offset) - { - bool ignoreWhitespace = true; - while (offset > 0) { - char ch = text[offset]; - if (Char.IsWhiteSpace(ch)) { - if (IsNewLineOrCarriageReturn(ch)) { - return offset; - } - if (!ignoreWhitespace) { - return offset; - } - } else { - ignoreWhitespace = false; - } - --offset; - } - return offset; - } - - static bool IsNewLineOrCarriageReturn(char ch) - { - return (ch == '\r') || (ch == '\n'); - } - - static bool IsImportOrFromString(string text) - { - return IsImportString(text) || IsFromString(text); - } - - static bool IsImportString(string text) - { - return text.Trim() == "import"; - } - - static bool IsFromString(string text) - { - return text.Trim() == "from"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpressionContext.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpressionContext.cs deleted file mode 100644 index 9c4d8e93510..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportExpressionContext.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImportExpressionContext : ExpressionContext - { - public bool HasFromAndImport { get; set; } - - public override bool ShowEntry(ICompletionEntry entry) - { - if (HasFromAndImport) { - return ShowEntryForImportIdentifier(entry); - } - return ShowEntryForImportModule(entry); - } - - bool ShowEntryForImportModule(ICompletionEntry entry) - { - return entry is NamespaceEntry; - } - - bool ShowEntryForImportIdentifier(ICompletionEntry entry) - { - if (entry is IMethod) { - return true; - } else if (entry is IField) { - return true; - } else if (entry is IClass) { - return true; - } else if (entry is NamespaceEntry) { - return IsImportAll(entry); - } - return false; - } - - bool IsImportAll(ICompletionEntry entry) - { - return PythonImportCompletion.ImportAll.Equals(entry); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportModuleResolveResult.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportModuleResolveResult.cs deleted file mode 100644 index f0769de4b33..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportModuleResolveResult.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImportModuleResolveResult : ResolveResult - { - PythonImportExpression expression; - - public PythonImportModuleResolveResult(PythonImportExpression expression) - : base(null, null, null) - { - this.expression = expression; - } - - public string Name { - get { return expression.Module; } - } - - public override List GetCompletionData(IProjectContent projectContent) - { - PythonImportCompletion completion = new PythonImportCompletion(projectContent); - if (expression.HasFromAndImport) { - if (expression.HasIdentifier) { - return new List(); - } else { - return completion.GetCompletionItemsFromModule(expression.Module); - } - } - return completion.GetCompletionItems(expression.Module); - } - - public override ResolveResult Clone() - { - return new PythonImportModuleResolveResult(expression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportResolver.cs deleted file mode 100644 index 8ae01c6cfe2..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonImportResolver.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonImportResolver : IPythonResolver - { - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - if (IsNamespace(resolverContext.ExpressionResult)) { - PythonImportExpression importExpression = new PythonImportExpression(resolverContext.Expression); - PythonImportExpressionContext context = resolverContext.ExpressionContext as PythonImportExpressionContext; - context.HasFromAndImport = importExpression.HasFromAndImport; - - return new PythonImportModuleResolveResult(importExpression); - } - return null; - } - - bool IsNamespace(ExpressionResult expressionResult) - { - return expressionResult.Context is PythonImportExpressionContext; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonInsightWindowHandler.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonInsightWindowHandler.cs deleted file mode 100644 index cde219a54b2..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonInsightWindowHandler.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace ICSharpCode.PythonBinding -{ - public class PythonInsightWindowHandler : IInsightWindowHandler - { - ITextEditor editor; - IInsightWindow insightWindow; - - public void InitializeOpenedInsightWindow(ITextEditor editor, IInsightWindow insightWindow) - { - this.editor = editor; - this.insightWindow = insightWindow; - int offset = insightWindow.StartOffset; - insightWindow.DocumentChanged += DocumentChanged; - } - - void DocumentChanged(object sender, TextChangeEventArgs e) - { - if (IsOutsideMethodCall()) { - insightWindow.Close(); - } - } - - bool IsOutsideMethodCall() - { - string text = GetTextInsideMethodCallUpToCursor(); - return TextContainsClosingBracketForMethod(text); - } - - string GetTextInsideMethodCallUpToCursor() - { - int insightStartOffset = insightWindow.StartOffset; - int currentOffset = editor.Caret.Offset; - int length = currentOffset - insightStartOffset; - if (length < 0) { - // Force completion window to close by returning the close bracket. - return ")"; - } - return editor.Document.GetText(insightStartOffset, length); - } - - bool TextContainsClosingBracketForMethod(string text) - { - int bracketCount = 1; - foreach (char ch in text) { - switch (ch) { - case '(': - bracketCount++; - break; - case ')': - bracketCount--; - if (bracketCount == 0) { - return true; - } - break; - } - } - return false; - } - - public bool InsightRefreshOnComma(ITextEditor editor, char ch, out IInsightWindow insightWindow) - { - insightWindow = null; - return false; - } - - public void HighlightParameter(IInsightWindow window, int index) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageBinding.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageBinding.cs deleted file mode 100644 index 74b190915cf..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageBinding.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.PythonBinding -{ - public class PythonLanguageBinding : DefaultLanguageBinding - { - public override IFormattingStrategy FormattingStrategy { - get { return new PythonFormattingStrategy(); } - } - - public override LanguageProperties Properties { - get { return PythonLanguageProperties.Default; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageProperties.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageProperties.cs deleted file mode 100644 index b8737351c9a..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLanguageProperties.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.CodeDom.Compiler; -using ICSharpCode.SharpDevelop.Dom; -using Microsoft.CSharp; - -namespace ICSharpCode.PythonBinding -{ - public class PythonLanguageProperties : LanguageProperties - { - static readonly PythonLanguageProperties defaultProperties = new PythonLanguageProperties(); - - public PythonLanguageProperties() : base(StringComparer.Ordinal) - { - } - - public static PythonLanguageProperties Default { - get { return defaultProperties; } - } - - public override CodeDomProvider CodeDomProvider { - get { return new CSharpCodeProvider(); } - } - - public override bool AllowObjectConstructionOutsideContext { - get { return true; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLineIndenter.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLineIndenter.cs deleted file mode 100644 index 98b7a442fd6..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLineIndenter.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.PythonBinding -{ - public class PythonLineIndenter : LineIndenter - { - public PythonLineIndenter(ITextEditor editor, IDocumentLine line) - : base(editor, line) - { - } - - protected override bool ShouldIncreaseLineIndent() - { - return PreviousLine.EndsWith(":"); - } - - protected override bool ShouldDecreaseLineIndent() - { - if (PreviousLine == "pass") { - return true; - } else if (PreviousLineIsReturnStatement()) { - return true; - } else if (PreviousLineIsRaiseStatement()) { - return true; - } else if (PreviousLine == "break") { - return true; - } - return false; - } - - bool PreviousLineIsReturnStatement() - { - return (PreviousLine == "return") || PreviousLine.StartsWith("return "); - } - - bool PreviousLineIsRaiseStatement() - { - return (PreviousLine == "raise") || PreviousLine.StartsWith("raise "); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableAssignment.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableAssignment.cs deleted file mode 100644 index ab0f58ac837..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableAssignment.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using IronPython.Compiler.Ast; - -namespace ICSharpCode.PythonBinding -{ - public class PythonLocalVariableAssignment - { - AssignmentStatement assignment; - string variableName = String.Empty; - string typeName = String.Empty; - - public PythonLocalVariableAssignment(AssignmentStatement assignment) - { - this.assignment = assignment; - ParseAssignment(); - } - - public string TypeName { - get { return typeName; } - } - - public string VariableName { - get { return variableName; } - } - - public bool IsLocalVariableAssignment() - { - return !String.IsNullOrEmpty(variableName); - } - - void ParseAssignment() - { - NameExpression nameExpression = assignment.Left[0] as NameExpression; - CallExpression callExpression = assignment.Right as CallExpression; - if ((nameExpression != null) && (callExpression != null)) { - variableName = nameExpression.Name; - typeName = GetTypeName(callExpression.Target); - } - } - - /// - /// Gets the fully qualified name of the type from the expression. - /// - /// - /// The expression is the first target of a call expression. - /// - /// A call expression is a method or constructor call (right hand side of expression below): - /// - /// a = Root.Test.Class1() - /// - /// So the expression passed to this method will be a field expression in the - /// above example which refers to Class1. The next target will be a field - /// expression referring to Test. The The last target will be a name expression - /// referring to Root. - /// - /// If we have - /// - /// a = Class1() - /// - /// then the expression will be a name expression referring to Class1. - /// - string GetTypeName(Expression expression) - { - NameExpression nameExpression = expression as NameExpression; - if (nameExpression != null) { - return nameExpression.Name; - } - return PythonControlFieldExpression.GetMemberName(expression as MemberExpression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableResolver.cs deleted file mode 100644 index 73c74eba0f5..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonLocalVariableResolver.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Text; - -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Dom; -using IronPython; -using IronPython.Compiler; -using IronPython.Compiler.Ast; -using IronPython.Hosting; -using IronPython.Runtime; -using IronPython.Runtime.Exceptions; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Runtime; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Determines the type of a variable. - /// - public class PythonLocalVariableResolver : PythonWalker, IPythonResolver - { - PythonClassResolver classResolver; - string variableName = String.Empty; - string typeName; - - public PythonLocalVariableResolver(PythonClassResolver classResolver) - { - this.classResolver = classResolver; - } - - /// - /// Resolves the type of the variable name specified. - /// - /// Name of the variable. - /// The python code containing the variable. - public string Resolve(string variableName, string code) - { - if (code != null) { - PythonParser parser = new PythonParser(); - PythonAst ast = parser.CreateAst("resolver.py", code); - return Resolve(variableName, ast); - } - return null; - } - - string Resolve(string variableName, PythonAst ast) - { - typeName = null; - this.variableName = variableName; - ast.Walk(this); - return typeName; - } - - public override bool Walk(AssignmentStatement node) - { - PythonLocalVariableAssignment localVariableAssignment = new PythonLocalVariableAssignment(node); - if (localVariableAssignment.IsLocalVariableAssignment()) { - if (localVariableAssignment.VariableName == variableName) { - typeName = localVariableAssignment.TypeName; - } - } - return base.Walk(node); - } - - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - return GetLocalVariable(resolverContext); - } - - /// - /// Tries to find the type that matches the local variable name. - /// - LocalResolveResult GetLocalVariable(PythonResolverContext resolverContext) - { - string code = GetLocalMethodCode(resolverContext); - string typeName = Resolve(resolverContext.Expression, code); - if (typeName != null) { - return CreateLocalResolveResult(typeName, resolverContext); - } - return null; - } - - string GetLocalMethodCode(PythonResolverContext resolverContext) - { - ScriptingLocalMethod localMethod = new ScriptingLocalMethod(resolverContext.FileContent); - int beginLine = resolverContext.ExpressionRegion.BeginLine; - return localMethod.GetCode(beginLine); - } - - LocalResolveResult CreateLocalResolveResult(string typeName, PythonResolverContext resolverContext) - { - IClass resolvedClass = classResolver.GetClass(resolverContext, typeName); - if (resolvedClass != null) { - string identifier = resolverContext.Expression; - return CreateLocalResolveResult(identifier, resolvedClass); - } - return null; - } - - LocalResolveResult CreateLocalResolveResult(string identifier, IClass resolvedClass) - { - DefaultMethod dummyMethod = CreateDummyMethod(); - DefaultField.LocalVariableField field = CreateLocalVariableField(identifier, resolvedClass, dummyMethod.DeclaringType); - return new LocalResolveResult(dummyMethod, field); - } - - DefaultField.LocalVariableField CreateLocalVariableField(string identifier, IClass resolvedClass, IClass callingClass) - { - return new DefaultField.LocalVariableField(resolvedClass.DefaultReturnType, - identifier, - DomRegion.Empty, - callingClass); - } - - DefaultMethod CreateDummyMethod() - { - DefaultClass dummyClass = new DefaultClass(DefaultCompilationUnit.DummyCompilationUnit, "Global"); - return new DefaultMethod(dummyClass, String.Empty); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMemberResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMemberResolver.cs deleted file mode 100644 index 29dfa8ccb69..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMemberResolver.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - /// - /// Resolves properties, events and fields. - /// - public class PythonMemberResolver : IPythonResolver - { - PythonClassResolver classResolver; - PythonLocalVariableResolver localVariableResolver; - PythonResolverContext resolverContext; - PythonSelfResolver selfResolver = new PythonSelfResolver(); - - public PythonMemberResolver(PythonClassResolver classResolver, PythonLocalVariableResolver localVariableResolver) - { - this.classResolver = classResolver; - this.localVariableResolver = localVariableResolver; - } - - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - IMember member = FindMember(resolverContext); - return CreateResolveResult(member); - } - - public IMember FindMember(PythonResolverContext resolverContext) - { - this.resolverContext = resolverContext; - return FindMember(); - } - - IMember FindMember() - { - return FindMember(resolverContext.Expression); - } - - IMember FindMember(string expression) - { - MemberName memberName = new MemberName(expression); - if (memberName.HasName) { - IClass c = FindClass(memberName.Type); - if (c != null) { - return FindMemberInClass(c, memberName.Name); - } else { - return FindMemberInParent(memberName); - } - } - return null; - } - - IClass FindClass(string className) - { - IClass c = FindClassFromClassResolver(className); - if (c != null) { - return c; - } - if (PythonSelfResolver.IsSelfExpression(className)) { - return FindClassFromSelfResolver(); - } - return FindClassFromLocalVariableResolver(className); - } - - IClass FindClassFromClassResolver(string className) - { - return classResolver.GetClass(resolverContext, className); - } - - IClass FindClassFromLocalVariableResolver(string localVariableName) - { - MemberName memberName = new MemberName(localVariableName); - if (!memberName.HasName) { - string typeName = localVariableResolver.Resolve(localVariableName, resolverContext.FileContent); - return FindClassFromClassResolver(typeName); - } - return null; - } - - IClass FindClassFromSelfResolver() - { - PythonResolverContext newContext = resolverContext.Clone("self"); - ResolveResult result = selfResolver.Resolve(newContext); - if (result != null) { - return result.ResolvedType.GetUnderlyingClass(); - } - return null; - } - - ResolveResult CreateResolveResult(IMember member) - { - if (member != null) { - if (member is IMethod) { - return new PythonMethodGroupResolveResult(member.DeclaringType, member.Name); - } - return new MemberResolveResult(null, null, member); - } - return null; - } - - IMember FindMemberInClass(IClass matchingClass, string memberName) - { - PythonClassMembers classMembers = new PythonClassMembers(matchingClass); - return classMembers.FindMember(memberName); - } - - IMember FindMemberInParent(MemberName memberName) - { - IMember parentMember = FindMember(memberName.Type); - if (parentMember != null) { - return FindMemberInParent(parentMember, memberName.Name); - } - return null; - } - - IMember FindMemberInParent(IMember parentMember, string memberName) - { - IReturnType returnType = parentMember.ReturnType; - if (returnType != null) { - IClass parentMemberClass = returnType.GetUnderlyingClass(); - return FindMemberInClass(parentMemberClass, memberName); - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethod.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethod.cs deleted file mode 100644 index 2945794bb71..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethod.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; -using Microsoft.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonMethod : DefaultMethod - { - public PythonMethod(IClass declaringType, FunctionDefinition methodDefinition) - : this(declaringType, methodDefinition, methodDefinition.Name) - { - } - - public PythonMethod(IClass declaringType, FunctionDefinition methodDefinition, string name) - : base(declaringType, name) - { - ReturnType = new DefaultReturnType(declaringType); - Modifiers = ModifierEnum.Public; - - GetMethodRegions(methodDefinition); - AddParameters(methodDefinition); - - declaringType.Methods.Add(this); - } - - void GetMethodRegions(FunctionDefinition methodDefinition) - { - GetBodyRegion(methodDefinition); - GetMethodRegion(methodDefinition); - } - - void GetBodyRegion(FunctionDefinition methodDefinition) - { - BodyRegion = PythonMethodOrClassBodyRegion.GetBodyRegion(methodDefinition); - } - - /// - /// Gets the region of a method. This does not include the body. - /// - void GetMethodRegion(FunctionDefinition methodDefinition) - { - SourceLocation start = methodDefinition.Start; - SourceLocation end = methodDefinition.Header; - Region = new DomRegion(start.Line, start.Column, end.Line, end.Column + 1); - } - - void AddParameters(FunctionDefinition methodDefinition) - { - bool ignoreFirstMethodParameter = !DeclaringTypeIsPythonModule; - AddParameters(methodDefinition, ignoreFirstMethodParameter); - } - - bool DeclaringTypeIsPythonModule { - get { return DeclaringType is PythonModule; } - } - - void AddParameters(FunctionDefinition methodDefinition, bool ignoreFirstMethodParameter) - { - foreach (IParameter parameter in ConvertParameters(methodDefinition.Parameters, ignoreFirstMethodParameter)) { - Parameters.Add(parameter); - } - } - - /// - /// Converts from Python AST expressions to parameters. - /// - /// If the parameters belong to a class method then the first - /// "self" parameter can be ignored. - IParameter[] ConvertParameters(IList parameters, bool ignoreFirstParameter) - { - int startingIndex = GetStartingIndex(ignoreFirstParameter); - return ConvertParameters(parameters, startingIndex); - } - - int GetStartingIndex(bool ignoreFirstParameter) - { - if (ignoreFirstParameter) { - return 1; - } - return 0; - } - - IParameter[] ConvertParameters(IList parameters, int startingIndex) - { - List convertedParameters = new List(); - for (int i = startingIndex; i < parameters.Count; ++i) { - DefaultParameter parameter = new DefaultParameter(parameters[i].Name, null, new DomRegion()); - convertedParameters.Add(parameter); - } - return convertedParameters.ToArray(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodDefinition.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodDefinition.cs deleted file mode 100644 index 20bac6c043c..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodDefinition.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; -using Microsoft.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public class PythonMethodDefinition - { - FunctionDefinition methodDefinition; - - public PythonMethodDefinition(FunctionDefinition methodDefinition) - { - this.methodDefinition = methodDefinition; - } - - public PythonMethod CreateMethod(IClass c) - { - if (IsConstructor) { - return new PythonConstructor(c, methodDefinition); - } - return new PythonMethod(c, methodDefinition); - } - - bool IsConstructor { - get { return methodDefinition.Name == "__init__"; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodGroupResolveResult.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodGroupResolveResult.cs deleted file mode 100644 index 8c1e8b2f80d..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodGroupResolveResult.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonMethodGroupResolveResult : MethodGroupResolveResult - { - public PythonMethodGroupResolveResult(IClass containingClass, string methodName) - : base(null, null, containingClass.DefaultReturnType, methodName) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodOrClassBodyRegion.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodOrClassBodyRegion.cs deleted file mode 100644 index 9500d900ebd..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodOrClassBodyRegion.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; -using Microsoft.Scripting; - -namespace ICSharpCode.PythonBinding -{ - public static class PythonMethodOrClassBodyRegion - { - /// - /// Gets the body region for a class or a method. - /// - /// - /// Note that SharpDevelop line numbers are zero based but the - /// DomRegion values are one based. IronPython columns and lines are one based. - /// - /// The body statement. - /// The location of the header. This gives the end location for the - /// method or class definition up to the colon. - public static DomRegion GetBodyRegion(Statement body, SourceLocation header) - { - int columnAfterColonCharacter = header.Column + 1; - SourceLocation bodyEnd = GetBodyEndLocation(body); - return new DomRegion(header.Line, columnAfterColonCharacter, bodyEnd.Line, bodyEnd.Column); - } - - static SourceLocation GetBodyEndLocation(Statement body) - { - if (body.Parent != null) { - return body.End; - } - return SourceLocation.Invalid; - } - - public static DomRegion GetBodyRegion(FunctionDefinition methodDefinition) - { - return GetBodyRegion(methodDefinition.Body, methodDefinition.Header); - } - - public static DomRegion GetBodyRegion(ClassDefinition classDefinition) - { - return GetBodyRegion(classDefinition.Body, classDefinition.Header); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodReturnValueResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodReturnValueResolver.cs deleted file mode 100644 index 6823ac919d4..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonMethodReturnValueResolver.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonMethodReturnValueResolver : IPythonResolver - { - PythonMemberResolver memberResolver; - - public PythonMethodReturnValueResolver(PythonMemberResolver memberResolver) - { - this.memberResolver = memberResolver; - } - - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - string methodName = GetMethodName(resolverContext.Expression); - if (methodName != null) { - PythonResolverContext newResolverContext = resolverContext.Clone(methodName); - IMember member = memberResolver.FindMember(newResolverContext); - return CreateResolveResult(member); - } - return null; - } - - string GetMethodName(string expression) - { - int methodParametersStartIndex = expression.IndexOf('('); - if ((methodParametersStartIndex > 0) && expression.EndsWith(")")) { - return expression.Substring(0, methodParametersStartIndex); - } - return null; - } - - MemberResolveResult CreateResolveResult(IMember member) - { - if (member != null) { - return new MemberResolveResult(null, null, member); - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModule.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModule.cs deleted file mode 100644 index 16cc7af6642..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModule.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonModule : DefaultClass - { - public PythonModule(ICompilationUnit compilationUnit) - : base(compilationUnit, compilationUnit.UsingScope.NamespaceName) - { - compilationUnit.Classes.Add(this); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItems.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItems.cs deleted file mode 100644 index 2a84976fd5e..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItems.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.ReflectionLayer; -using IronPython.Modules; -using IronPython.Runtime; -using Microsoft.Scripting.Runtime; - -namespace ICSharpCode.PythonBinding -{ - public class PythonModuleCompletionItems : List - { - DefaultCompilationUnit compilationUnit; - DefaultClass moduleClass; - DefaultProjectContent projectContent; - - static readonly BindingFlags PublicAndStaticBindingFlags = BindingFlags.Public | BindingFlags.Static; - - public PythonModuleCompletionItems(PythonStandardModuleType moduleType) - { - projectContent = new DefaultProjectContent(); - compilationUnit = new DefaultCompilationUnit(projectContent); - moduleClass = new DefaultClass(compilationUnit, moduleType.Name); - - AddCompletionItemsForType(moduleType.Type); - AddStandardCompletionItems(); - } - - void AddCompletionItemsForType(Type type) - { - foreach (MemberInfo member in type.GetMembers(PublicAndStaticBindingFlags)) { - if (!HasPythonHiddenAttribute(member)) { - ICompletionEntry item = CreateCompletionItem(member, moduleClass); - if (item != null) { - Add(item); - } - } - } - } - - void AddStandardCompletionItems() - { - AddField("__name__"); - AddField("__package__"); - } - - protected void AddField(string name) - { - DefaultField field = new DefaultField(moduleClass, name); - Add(field); - } - - bool HasPythonHiddenAttribute(MemberInfo memberInfo) - { - foreach (Attribute attribute in memberInfo.GetCustomAttributes(false)) { - Type type = attribute.GetType(); - if (type.Name == "PythonHiddenAttribute") { - return true; - } - } - return false; - } - - ICompletionEntry CreateCompletionItem(MemberInfo memberInfo, IClass c) - { - if (memberInfo is MethodInfo) { - return CreateMethodFromMethodInfo((MethodInfo)memberInfo, c); - } else if (memberInfo is FieldInfo) { - return CreateFieldFromFieldInfo((FieldInfo)memberInfo, c); - } else if (memberInfo is Type) { - return CreateClassFromType((Type)memberInfo); - } - return null; - } - - IMethod CreateMethodFromMethodInfo(MethodInfo methodInfo, IClass c) - { - DefaultMethod method = new DefaultMethod(c, methodInfo.Name); - method.Documentation = GetDocumentation(methodInfo); - method.ReturnType = CreateMethodReturnType(methodInfo); - method.Modifiers = ModifierEnum.Public; - - foreach (ParameterInfo paramInfo in methodInfo.GetParameters()) { - if (!IsCodeContextParameter(paramInfo)) { - IParameter parameter = ConvertParameter(paramInfo, method); - method.Parameters.Add(parameter); - } - } - - c.Methods.Add(method); - - return method; - } - - string GetDocumentation(MemberInfo memberInfo) - { - foreach (DocumentationAttribute documentation in GetDocumentationAttributes(memberInfo)) { - return documentation.Documentation; - } - return null; - } - - object[] GetDocumentationAttributes(MemberInfo memberInfo) - { - return memberInfo.GetCustomAttributes(typeof(DocumentationAttribute), false); - } - - IReturnType CreateMethodReturnType(MethodInfo methodInfo) - { - DefaultClass declaringType = new DefaultClass(compilationUnit, methodInfo.ReturnType.FullName); - return new DefaultReturnType(declaringType); - } - - bool IsCodeContextParameter(ParameterInfo paramInfo) - { - return paramInfo.ParameterType == typeof(CodeContext); - } - - IParameter ConvertParameter(ParameterInfo paramInfo, IMethod method) - { - DefaultClass c = new DefaultClass(compilationUnit, paramInfo.ParameterType.FullName); - DefaultReturnType returnType = new DefaultReturnType(c); - return new DefaultParameter(paramInfo.Name, returnType, DomRegion.Empty); - } - - IField CreateFieldFromFieldInfo(FieldInfo fieldInfo, IClass c) - { - return new DefaultField(c, fieldInfo.Name); - } - - IClass CreateClassFromType(Type type) - { - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - return new DefaultClass(unit, type.Name); - } - - public MethodGroup GetMethods(string name) - { - List methods = new List(); - foreach (object member in this) { - IMethod method = member as IMethod; - if (method != null) { - if (method.Name == name) { - methods.Add(method); - } - } - } - return new MethodGroup(methods); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItemsFactory.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItemsFactory.cs deleted file mode 100644 index 9a1785a0272..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonModuleCompletionItemsFactory.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using IronPython.Modules; - -namespace ICSharpCode.PythonBinding -{ - public static class PythonModuleCompletionItemsFactory - { - public static PythonModuleCompletionItems Create(PythonStandardModuleType moduleType) - { - if (IsSysModule(moduleType.Type)) { - return new SysModuleCompletionItems(moduleType); - } - return new PythonModuleCompletionItems(moduleType); - } - - static bool IsSysModule(Type type) - { - return type == typeof(SysModule); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonNamespaceResolver.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonNamespaceResolver.cs deleted file mode 100644 index 498bbec4f78..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonNamespaceResolver.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.PythonBinding -{ - public class PythonNamespaceResolver : IPythonResolver - { - PythonResolverContext resolverContext; - ExpressionResult expressionResult; - - public ResolveResult Resolve(PythonResolverContext resolverContext) - { - return Resolve(resolverContext, resolverContext.ExpressionResult); - } - - public ResolveResult Resolve(PythonResolverContext resolverContext, ExpressionResult expressionResult) - { - this.resolverContext = resolverContext; - this.expressionResult = expressionResult; - - if (resolverContext.HasImport(expressionResult.Expression)) { - return ResolveFullNamespace(); - } - return ResolvePartialNamespaceMatch(); - } - - ResolveResult ResolveFullNamespace() - { - string actualNamespace = resolverContext.UnaliasImportedModuleName(expressionResult.Expression); - return ResolveIfNamespaceExistsInProjectReferences(actualNamespace); - } - - ResolveResult ResolvePartialNamespaceMatch() - { - string fullNamespace = expressionResult.Expression; - if (resolverContext.IsStartOfDottedModuleNameImported(fullNamespace)) { - return ResolveIfPartialNamespaceExistsInProjectReferences(fullNamespace); - } else if (resolverContext.HasDottedImportNameThatStartsWith(fullNamespace)) { - return CreateNamespaceResolveResult(fullNamespace); - } - return null; - } - - ResolveResult ResolveIfNamespaceExistsInProjectReferences(string namespaceName) - { - if (resolverContext.NamespaceExistsInProjectReferences(namespaceName)) { - return CreateNamespaceResolveResult(namespaceName); - } - return null; - } - - ResolveResult ResolveIfPartialNamespaceExistsInProjectReferences(string namespaceName) - { - string actualNamespace = resolverContext.UnaliasStartOfDottedImportedModuleName(namespaceName); - if (resolverContext.PartialNamespaceExistsInProjectReferences(actualNamespace)) { - return CreateNamespaceResolveResult(actualNamespace); - } - return null; - } - - ResolveResult CreateNamespaceResolveResult(string namespaceName) - { - return new NamespaceResolveResult(null, null, namespaceName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml deleted file mode 100644 index 7f239747255..00000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - -