[svn] r6525: vs-plugin/trunk: ConsoleTest
ConsoleTest/ConsoleTest.csproj ConsoleTest/Program.cs ConsoleTes...
IT
svnadmin at nemerle.org
Wed Aug 16 05:39:23 CEST 2006
Log:
Initial submit.
Author: IT
Date: Wed Aug 16 05:38:15 2006
New Revision: 6525
Added:
vs-plugin/trunk/ConsoleTest/
vs-plugin/trunk/ConsoleTest/ConsoleTest.csproj
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/ConsoleTest/Properties/
vs-plugin/trunk/ConsoleTest/Properties/AssemblyInfo.cs
vs-plugin/trunk/Doc/
vs-plugin/trunk/Doc/Nemerle.VsIntegration.doc (contents, props changed)
vs-plugin/trunk/Interfaces/
vs-plugin/trunk/Interfaces/AssemblyInfo.cs
vs-plugin/trunk/Interfaces/EngineInterfaces.cs
vs-plugin/trunk/Interfaces/IConsoleText.cs
vs-plugin/trunk/Interfaces/Interfaces.csproj
vs-plugin/trunk/Interfaces/nemerle.snk (contents, props changed)
vs-plugin/trunk/Nemerle.Compiler.Utils/
vs-plugin/trunk/Nemerle.Compiler.Utils/AstBrowserForm.n
vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomHelper.n
vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomParser.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Const.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeCompletionEngineException.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GlyphType.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.overload.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Decl.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.ParseEvents.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.crud.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.utils.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/EngineState.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/InternalReference.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/MessageKind.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ParsedFile.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/ReferenceCollection.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1-2.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TraceWriter.n
vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeDomProvider.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Properties/
vs-plugin/trunk/Nemerle.Compiler.Utils/Properties/AssemblyInfo.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
vs-plugin/trunk/Nemerle.VSIP.sln
vs-plugin/trunk/Nemerle.VSIP.suo (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/
vs-plugin/trunk/Nemerle.VsIntegration.Tests/
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Nemerle.VsIntegration.Tests.csproj
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/AssemblyInfo.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/CodeDomParser.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/ParseHelper.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/Form1.n
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/Form2.n
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/Form3.n
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/Form4.n
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/Form5.n
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/TestEnum.cs
vs-plugin/trunk/Nemerle.VsIntegration/Automation.cs
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/class.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/ctor.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/for.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/foreach.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/if.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/match.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/unless.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/when.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/Snippets/while.snippet
vs-plugin/trunk/Nemerle.VsIntegration/CodeSnippets/SnippetsIndex.xml
vs-plugin/trunk/Nemerle.VsIntegration/ConfigurationPropertyPages.cs
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/Guids.h
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmd.ctc
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmdID.h
vs-plugin/trunk/Nemerle.VsIntegration/EditorFactory.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Analyzer.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Definitions.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Engine.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Inferred.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Locator.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfoCollection.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/Scope.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/ScopeNode.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/ScopeWalker.cs
vs-plugin/trunk/Nemerle.VsIntegration/Engine/TraceWriter.cs
vs-plugin/trunk/Nemerle.VsIntegration/ErrorHelper.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeClassElement.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeDomUtils.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeElementBase.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeNamespaceElement.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeTypeElement.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeTypeFunctionMember.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeTypeMemberElement.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/CodeTypeReferenceElement.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/NemerleCodeElements.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/NemerleFileCodeModel.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/NullTextPoint.cs
vs-plugin/trunk/Nemerle.VsIntegration/FileCodeModel/VoidCodeTypeRef.cs
vs-plugin/trunk/Nemerle.VsIntegration/HierarchyListener.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService.jpg (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Library.cs
vs-plugin/trunk/Nemerle.VsIntegration/LibraryNode.cs
vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj.user
vs-plugin/trunk/Nemerle.VsIntegration/NemerleCodeDomProvider.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleColorableItem.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleConfigProvider.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleDeclarations.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleFileNode.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleFileNodeProperties.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleLibraryManager.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleLibraryNode.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleMenus.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleMethods.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleScanner.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleScope.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleSink.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleSource.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleViewFilter.cs
vs-plugin/trunk/Nemerle.VsIntegration/ObjectModelExtenders/
vs-plugin/trunk/Nemerle.VsIntegration/ObjectModelExtenders/!Info.txt
vs-plugin/trunk/Nemerle.VsIntegration/ObjectModelExtenders/ReferenceContainerNodeEx.cs
vs-plugin/trunk/Nemerle.VsIntegration/ObjectModelExtenders/TokenProcessorEx.cs
vs-plugin/trunk/Nemerle.VsIntegration/Overview-Project.xml
vs-plugin/trunk/Nemerle.VsIntegration/Overview.xml
vs-plugin/trunk/Nemerle.VsIntegration/Parsing/
vs-plugin/trunk/Nemerle.VsIntegration/Parsing/NemerleAuthoringScope.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/
vs-plugin/trunk/Nemerle.VsIntegration/Project.jpg (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectFactory.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectFileConstants.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNode.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleProjectNodeProperties.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/OutputFileExtension.cs
vs-plugin/trunk/Nemerle.VsIntegration/ProjectBase/
vs-plugin/trunk/Nemerle.VsIntegration/ProjectBase/Diagrams/
vs-plugin/trunk/Nemerle.VsIntegration/ProjectBase/LangProj/
vs-plugin/trunk/Nemerle.VsIntegration/ProjectBase/Web/
vs-plugin/trunk/Nemerle.VsIntegration/ProjectBase/misc/
vs-plugin/trunk/Nemerle.VsIntegration/Properties/
vs-plugin/trunk/Nemerle.VsIntegration/Properties/AssemblyInfo.cs
vs-plugin/trunk/Nemerle.VsIntegration/PropertyPages.cs
vs-plugin/trunk/Nemerle.VsIntegration/RegisterSnippetsAttribute.cs
vs-plugin/trunk/Nemerle.VsIntegration/RegistrationAttributes/
vs-plugin/trunk/Nemerle.VsIntegration/Resources/
vs-plugin/trunk/Nemerle.VsIntegration/Resources.Designer.cs
vs-plugin/trunk/Nemerle.VsIntegration/Resources.cs
vs-plugin/trunk/Nemerle.VsIntegration/Resources.resx
vs-plugin/trunk/Nemerle.VsIntegration/Resources/Nemerle.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Resources/NemerleImageList.bmp (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/SelectionElementValueChangedListener.cs
vs-plugin/trunk/Nemerle.VsIntegration/SnippetsEnumerator.cs
vs-plugin/trunk/Nemerle.VsIntegration/TDD/
vs-plugin/trunk/Nemerle.VsIntegration/TDD/NemerleProject.UnitTest.csproj
vs-plugin/trunk/Nemerle.VsIntegration/TDD/NemerleProject.Unittest.sln
vs-plugin/trunk/Nemerle.VsIntegration/TDD/NemerleProject.Unittest.vsmdi
vs-plugin/trunk/Nemerle.VsIntegration/TDD/Properties/
vs-plugin/trunk/Nemerle.VsIntegration/TDD/Properties/AssemblyInfo.cs
vs-plugin/trunk/Nemerle.VsIntegration/TDD/TestNemerlePackage.cs
vs-plugin/trunk/Nemerle.VsIntegration/TDD/TestProjectFactory.cs
vs-plugin/trunk/Nemerle.VsIntegration/TDD/TestPropertyPages.cs
vs-plugin/trunk/Nemerle.VsIntegration/TDD/localtestrun.testrunconfig
vs-plugin/trunk/Nemerle.VsIntegration/Templates/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Class/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Class/Class.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Class/Class.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Class/Nemerle.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Form/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Form/Form.Designer.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Form/Form.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Form/Form.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Form/windowsform.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/ResX/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/ResX/Resource.resX
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/ResX/Resource.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/ResX/Resource_Resx.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Text/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Text/Text.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Text/TextFile.txt
vs-plugin/trunk/Nemerle.VsIntegration/Templates/ProjectItems/Text/TextFile.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/AssemblyInfo.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/Class1.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/ClassLibrary.nproj
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/ClassLibrary.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ClassLibrary/Nemerle.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/AssemblyInfo.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/Console.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/ConsoleApplication.nproj
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/ConsoleApplication.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/ConsoleApplication/Main.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/AssemblyInfo.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/Macro1.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/MacroLibrary.nproj
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/MacroLibrary.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/MacroLibrary/Nemerle.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/AssemblyInfo.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/Form1.Designer.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/Form1.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/Nemerle.ico (contents, props changed)
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/NemerleMacroLibrary.vstemplate
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/Program.n
vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WindowsApplication/WindowsApplication.nproj
vs-plugin/trunk/Nemerle.VsIntegration/TextLineEventListener.cs
vs-plugin/trunk/Nemerle.VsIntegration/Utils.cs
vs-plugin/trunk/Nemerle.VsIntegration/VSMDNemerleProvider.cs
vs-plugin/trunk/Nemerle.VsIntegration/nemerle.snk (contents, props changed)
vs-plugin/trunk/RSDN.Nemerle.Utils.sln
vs-plugin/trunk/RSDN.NemerleCodeDomTester/
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Form1.Designer.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Form1.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Form1.resx
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Program.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/AssemblyInfo.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/Resources.Designer.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/Resources.resx
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/Settings.Designer.cs
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Properties/Settings.settings
vs-plugin/trunk/RSDN.NemerleCodeDomTester/RSDN.NemerleCodeDomTester.csproj
vs-plugin/trunk/RSDN.NemerleCodeDomTester/Tests/
vs-plugin/trunk/Setup/
vs-plugin/trunk/Setup/Bitmaps/
vs-plugin/trunk/Setup/Bitmaps/New.ico (contents, props changed)
vs-plugin/trunk/Setup/Bitmaps/Up.ico (contents, props changed)
vs-plugin/trunk/Setup/Bitmaps/bannrbmp.bmp (contents, props changed)
vs-plugin/trunk/Setup/Bitmaps/dlgbmp.bmp (contents, props changed)
vs-plugin/trunk/Setup/Bitmaps/exclamic.ico (contents, props changed)
vs-plugin/trunk/Setup/Bitmaps/info.ico (contents, props changed)
vs-plugin/trunk/Setup/Integration.wxs
vs-plugin/trunk/Setup/License.rtf (contents, props changed)
vs-plugin/trunk/Setup/NemerleBinaries.wxs
vs-plugin/trunk/Setup/Product.wxs
vs-plugin/trunk/Setup/Variables.wxi
vs-plugin/trunk/Setup/buildSetup.bat
vs-plugin/trunk/VSIntegartion.nunit
Added: vs-plugin/trunk/ConsoleTest/ConsoleTest.csproj
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/ConsoleTest/ConsoleTest.csproj Wed Aug 16 05:38:15 2006
@@ -0,0 +1,54 @@
+ďťż<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{D5EB7C03-398D-4C41-91C9-4ED474CC1312}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ConsoleTest</RootNamespace>
+ <AssemblyName>ConsoleTest</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Nemerle.Compiler.Utils, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4c0f22444bf4088, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Nemerle.Compiler.Utils\bin\Debug\Nemerle.Compiler.Utils.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Wed Aug 16 05:38:15 2006
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tests;
+
+namespace ConsoleTest
+{
+ class Program
+ {
+ static void Main()
+ {
+ Test1 test = new Test1();
+ test.Init();
+
+ test.Complete_GlabalNs_in_NestedNs();
+ test.FindByLocation_Ns1_Ns2_Ns3_ClassInNestenNs();
+ test.FindByLocation_Method_Class2_Method();
+ test.CompleteIn_NestedUsing();
+ test.CompleteInType_1();
+ test.CompleteInUsing_1();
+ test.FindByLocation_Method_Main();
+ test.FindByLocation_Method_Main_2();
+ test.FindByLocation_Type_XStruct();
+ test.FindByLocation_using();
+ }
+ }
+}
Added: vs-plugin/trunk/ConsoleTest/Properties/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/ConsoleTest/Properties/AssemblyInfo.cs Wed Aug 16 05:38:15 2006
@@ -0,0 +1,33 @@
+ďťżusing System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("ConsoleTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("AO")]
+[assembly: AssemblyProduct("ConsoleTest")]
+[assembly: AssemblyCopyright("Copyright Š AO 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ff224d0c-7997-4c71-8f86-a9d0c9b4eea1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: vs-plugin/trunk/Doc/Nemerle.VsIntegration.doc
==============================================================================
Binary file. No diff available.
Added: vs-plugin/trunk/Interfaces/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Interfaces/AssemblyInfo.cs Wed Aug 16 05:38:15 2006
@@ -0,0 +1,36 @@
+ďťżusing System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("Interfaces")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Interfaces")]
+[assembly: AssemblyCopyright("Copyright Š Microsoft 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//VladD2: 8904dc7f-6a2a-4e04-8f91-da2ea89ac0d7 -> 52584A71-FAD7-4eb8-BE76-34D1E247C4F9
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("52584A71-FAD7-4eb8-BE76-34D1E247C4F9")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: vs-plugin/trunk/Interfaces/EngineInterfaces.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Interfaces/EngineInterfaces.cs Wed Aug 16 05:38:15 2006
@@ -0,0 +1,72 @@
+/***************************************************************************
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+This code is licensed under the Visual Studio SDK license terms.
+THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+
+***************************************************************************/
+
+using System;
+using System.Runtime.InteropServices;
+using System.IO;
+
+
+
+namespace Microsoft.Samples.VisualStudio.NemerleInterfaces
+{
+ //VladD2: 89B8BBD7-DBC0-46cc-B43E-9E8D9CB724D3 -> 13901BD5-8A68-406b-9592-C71066EF9C24
+ /// <summary>
+ /// Interface implemented by an engine object.
+ /// </summary>
+ [Guid("13901BD5-8A68-406b-9592-C71066EF9C24")]
+ [ComVisible(true)]
+ public interface IEngine
+ {
+ /// <summary>Gets the copyright information about the engine.</summary>
+ string Copyright { get;}
+ /// <summary>Evaluates an expression.</summary>
+ object Evaluate(string expression);
+ /// <summary>Executes a command.</summary>
+ void Execute(string text);
+ /// <summary>Executes the content of a file.</summary>
+ void ExecuteFile(string fileName);
+ /// <summary>Gets the value of a variable.</summary>
+ object GetVariable(string name);
+ ///// <summary>Gets or Sets the console used by the engine.</summary>
+ //IConsole MyConsole { get; set; }
+ /// <summary>Executes the commands in the console.</summary>
+ int RunInteractive();
+ /// <summary>Runs the content of a file.</summary>
+ int RunFile(string fileName);
+ /// <summary>Sets the value of a variable.</summary>
+ void SetVariable(string name, object value);
+ /// <summary>Sets the standard error for the engine.</summary>
+ Stream StdErr { set;}
+ /// <summary>Sets the standard input for the engine.</summary>
+ Stream StdIn { set; }
+ /// <summary>Sets the standard output for the engine.</summary>
+ Stream StdOut { set;}
+ /// <summary>Gets the version of the engine.</summary>
+ Version Version { get; }
+ }
+
+ //VladD2: 1106288e-9740-40ee-bab5-1e4e1c5f7252 -> 1D3380E7-581A-43ce-994D-49534D2417D9
+ //VladD2: Ęŕę ˙ ďîíčěŕţ âńĺ ýňč "console package" čäóň ëĺńîě.
+ /// <summary>
+ /// This is the definition of the interface exposed by the service defined by the
+ /// Nemerle console package.
+ /// </summary>
+ [Guid("1D3380E7-581A-43ce-994D-49534D2417D9")]
+ [ComVisible(true)]
+ public interface INemerleEngineProvider
+ {
+ /// <summary>Gets the instance of the engine shared between different components.</summary>
+ IEngine GetSharedEngine();
+ /// <summary>Creates a new instance of the engine.</summary>
+ IEngine CreateNewEngine();
+ }
+
+}
\ No newline at end of file
Added: vs-plugin/trunk/Interfaces/IConsoleText.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Interfaces/IConsoleText.cs Wed Aug 16 05:38:15 2006
@@ -0,0 +1,30 @@
+/***************************************************************************
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+This code is licensed under the Visual Studio SDK license terms.
+THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
+ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
+IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
+PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
+
+***************************************************************************/
+
+using System;
+
+namespace Microsoft.Samples.VisualStudio.NemerleInterfaces
+{
+ /// <summary>
+ /// Interface used to provide a way for other object to access the text
+ /// inside the console window.
+ /// </summary>
+ public interface IConsoleText
+ {
+ /// <summary>
+ /// Returns the text inside a line in the console up to a specific colums.
+ /// The skipReadOnly flag is used to specify if the text that is inside the
+ /// read-only region should be skipped from the return value.
+ /// </summary>
+ string TextOfLine(int line, int endColumn, bool skipReadOnly);
+ }
+
+}
Added: vs-plugin/trunk/Interfaces/Interfaces.csproj
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Interfaces/Interfaces.csproj Wed Aug 16 05:38:15 2006
@@ -0,0 +1,55 @@
+ďťż<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A16AE536-5272-4697-84F9-8FA9953BDD2D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Microsoft.Samples.VisualStudio.NemerleInterfaces</RootNamespace>
+ <AssemblyName>NemerleInterfaces</AssemblyName>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>nemerle.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="EngineInterfaces.cs" />
+ <Compile Include="IConsoleText.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="nemerle.snk" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: vs-plugin/trunk/Interfaces/nemerle.snk
==============================================================================
Binary file. No diff available.
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/AstBrowserForm.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/AstBrowserForm.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Drawing;
+using System.Reflection;
+using System.Windows.Forms;
+
+using Nemerle.Compiler;
+using Nemerle.Compiler.NamespaceTree.TypeInfoCache;
+using Nemerle.Completion2;
+
+namespace Nemerle.Compiler.Utils
+{
+ public class AstBrowserForm : Form
+ {
+ public this(namespaceTree : NamespaceTree.Node)
+ {
+ def FillTree(name, rootNode)
+ {
+ def name = name + match (rootNode.Value)
+ {
+ | No => " (No)"
+ | Cached => " (int type)"// { tycon : TypeInfo; }
+ | CachedAmbiguous => " (int types)"// { elems : list [TypeInfo] }
+ | NotLoaded => " (ext type)"// { e : ExternalType; }
+ | NotLoadedList => " (ext types)"// { elems : list [ExternalType] }
+ | MacroCall => " (macro)"// { m : IMacro; }
+ | NamespaceReference => " (namespace)"
+ };
+
+ def treeNode = if (rootNode.Children is null)
+ TreeNode(name);
+ else
+ {
+ def nodes = List();
+
+ foreach ((name, node) in rootNode.Children.KeyValuePairs)
+ nodes.Add(FillTree(name, node));
+
+ TreeNode(name, nodes.ToArray());
+ }
+
+ treeNode.Tag = rootNode.Value;
+ //Trace.WriteLine(treeNode.Tag is null);
+ treeNode
+ }
+
+ _namespaceTree = namespaceTree;
+
+ StartPosition = FormStartPosition.CenterParent;
+ def size = 700;
+ Size = Size(size, size);
+
+ def spliter = SplitContainer();
+ spliter.Dock = DockStyle.Fill;
+ spliter.Parent = this;
+ spliter.SplitterDistance = size / 2;
+
+ def tree = TreeView();
+ tree.Dock = DockStyle.Fill;
+ tree.Parent = spliter.Panel1;
+ ignore(tree.Nodes.Add(FillTree(namespaceTree.Name.ToString(), namespaceTree)));
+
+ def propDrid = PropertyGrid();
+ propDrid.Dock = DockStyle.Fill;
+ propDrid.Parent = spliter.Panel2;
+ _propDrid = propDrid;
+
+ //tree.AfterSelect += (_, e) => propDrid.SelectedObject = e.Node.Tag;
+ tree.AfterSelect += xxx;
+ }
+
+ mutable _propDrid : PropertyGrid;
+
+ xxx(_ : object, e : TreeViewEventArgs) : void
+ {
+ _propDrid.SelectedObject = e.Node.Tag
+ }
+
+ _namespaceTree : NamespaceTree.Node;
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomHelper.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomHelper.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,69 @@
+using System;
+using System.CodeDom;
+using System.Reflection;
+
+using Nemerle.Compiler;
+
+namespace Nemerle.Compiler.Utils
+{
+ public module CodeDomHelper
+ {
+ public IsPartial(attrs: NemerleAttributes): bool
+ {
+ attrs %&& NemerleAttributes.Partial
+ }
+
+ public GetMemberAttributes(attrs: NemerleAttributes, field: bool = false): MemberAttributes
+ {
+ mutable res: MemberAttributes;
+
+ when(attrs %&& NemerleAttributes.Static) res |= MemberAttributes.Static;
+ when(attrs %&& NemerleAttributes.Public) res |= MemberAttributes.Public;
+ when(attrs %&& NemerleAttributes.Private) res |= MemberAttributes.Private;
+
+ if(attrs %&& NemerleAttributes.Internal && attrs %&& NemerleAttributes.Protected)
+ res |= MemberAttributes.FamilyOrAssembly
+ else
+ {
+ when(attrs %&& NemerleAttributes.Internal) res |= MemberAttributes.FamilyAndAssembly;
+ when(attrs %&& NemerleAttributes.Protected) res |= MemberAttributes.Family;
+ }
+
+ when(field && !(attrs %&& NemerleAttributes.Mutable)) res |= MemberAttributes.Const;
+
+ when(attrs %&& NemerleAttributes.New) res |= MemberAttributes.New;
+ when(attrs %&& NemerleAttributes.Override) res |= MemberAttributes.Override;
+ when(attrs %&& NemerleAttributes.Sealed) res |= MemberAttributes.Final;
+ when(attrs %&& NemerleAttributes.Virtual) res |= MemberAttributes.VTableMask;
+
+ when(res == 0)
+ {
+ if(field)
+ res |= MemberAttributes.Private
+ else
+ res |= MemberAttributes.Assembly
+ }
+
+ res;
+ }
+
+ public GetTypeAttributes(attrs: NemerleAttributes): TypeAttributes
+ {
+ if(attrs == NemerleAttributes.None)
+ TypeAttributes.NotPublic;
+ else
+ {
+ mutable res: TypeAttributes =
+ if(attrs %&& NemerleAttributes.Public)
+ TypeAttributes.Public
+ else
+ TypeAttributes.NotPublic;
+
+ when(attrs %&& NemerleAttributes.Abstract) res |= TypeAttributes.Abstract;
+ when(attrs %&& NemerleAttributes.Sealed) res |= TypeAttributes.Sealed;
+ when(attrs %&& NemerleAttributes.SpecialName) res |= TypeAttributes.SpecialName;
+ res;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomParser.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/CodeDomParser.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,504 @@
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Generic;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Diagnostics;
+using System.Reflection;
+
+using Nemerle.Collections;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Completion;
+
+namespace Nemerle.Compiler.Utils
+{
+ internal class CodeDomParser : ICodeParser
+ {
+ namespaces: Dictionary.[string, CodeNamespace];
+
+ public this()
+ {
+ namespaces = Dictionary.[string, CodeNamespace]();
+ }
+
+ public Parse(codeReader: TextReader) : CodeCompileUnit
+ {
+ def code = codeReader.ReadToEnd();
+ def fileName = GetFileName(codeReader);
+
+ def engine = Engine();
+ // áĺç ýňîé ńňđîęč âŕëčňń˙ exception â Location.Init()
+ ManagerClass.Instance = engine;
+ engine.Init();
+
+ def location = Location(Location.AddFile(fileName), 1, 1);
+ def decls = MainParser.Parse(LexerString(engine, code, location));
+
+ CreateCodeCompileUnit(decls);
+ }
+
+ private GetFileName(rd: TextReader) : string
+ {
+ mutable fileName = $"<unknown $(DateTime.Now.Ticks)>";
+
+ when(rd is StreamReader)
+ {
+ def rd = rd:> StreamReader;
+ when(rd.BaseStream is FileStream)
+ fileName = (rd.BaseStream:> FileStream).Name;
+ }
+
+ fileName;
+ }
+
+ private CreateCodeCompileUnit(decls: list[TopDeclaration]) : CodeCompileUnit
+ {
+ def unit = CodeCompileUnit();
+
+ // parse top declaration in to the namespaces
+ foreach (decl in decls)
+ {
+ match(decl)
+ {
+ | TopDeclaration.Class as cls => CreateClass(cls);
+ | _ => Debug.WriteLine($"CodeDomParser ignore declaration: $decl : $(decl.Name)");
+ }
+ }
+
+ // adds namespaces to the compile unit
+ foreach(ns in namespaces)
+ _ = unit.Namespaces.Add(ns.Value);
+
+ unit;
+ }
+
+ private GetNamespace(name: string) : CodeNamespace
+ {
+ unless(namespaces.ContainsKey(name))
+ {
+ def ns = CodeNamespace(name);
+ namespaces.Add(name, ns);
+ }
+
+ namespaces[name];
+ }
+
+ private GetPropValue(target: object, props: list[string]): object
+ {
+ if(props.IsEmpty)
+ target;
+ else if(target != null)
+ {
+ def targetType = target.GetType();
+ def members = targetType.GetMember(props.Head, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
+ if(members != null && members.Length == 1)
+ {
+ def value = match(members[0])
+ {
+ | f is System.Reflection.FieldInfo => f.GetValue(target);
+ | p is System.Reflection.PropertyInfo when p.CanRead => p.GetValue(target, null);
+ | _ => null;
+ }
+ GetPropValue(value, props.Tail);
+ }
+ else
+ null;
+ }
+ else
+ null;
+ }
+
+ private AddToNamespace(decl: TopDeclaration, codeType: CodeTypeDeclaration) : void
+ {
+ def ns = decl.ParsedName.context.CurrentNamespace;
+ def nsName = if(ns.Name == null) "#default#" else ns.Name;
+ def _namespace = GetNamespace(nsName);
+
+ // äđóăîăî ďóňč íĺ íŕřĺë ęŕę ďîëó÷čňü usings.
+ def namespace_nodes = GetPropValue(decl.ParsedName.context, "nameTree"::"referenced_namespace_nodes"::[]):> System.Collections.Generic.List.[(list[NamespaceTree.Node] * Location)];
+ when(namespace_nodes != null && namespace_nodes.Count > 0)
+ {
+ def imports = Dictionary.[string, object]();
+
+ foreach(import is CodeNamespaceImport in _namespace.Imports)
+ imports.Add(import.Namespace, null);
+
+ foreach(item in namespace_nodes)
+ {
+ when(!String.IsNullOrEmpty(item[1].File) && !item[0].IsEmpty)
+ {
+ def import = item[0].Head.GetDisplayName ();
+
+ when(!imports.ContainsKey(import))
+ {
+ Debug.WriteLine($"namespace: $import");
+ imports.Add(import, null);
+ _namespace.Imports.Add(CodeNamespaceImport(import))
+ }
+ }
+ }
+ }
+
+ _ = _namespace.Types.Add(codeType);
+ }
+
+ mutable fields: Dictionary.[string, CodeMemberField];
+ mutable events: Dictionary.[string, CodeMemberEvent];
+ mutable methods: Dictionary.[string, CodeMemberMethod];
+ mutable props: Dictionary.[string, CodeMemberProperty];
+ mutable vars: Dictionary.[string, CodeVariableDeclarationStatement];
+
+ private CreateClass(cls: TopDeclaration.Class) : void
+ {
+ // creates class declaration
+ mutable codeClass = CodeTypeDeclaration(cls.Name);
+
+ // sets class access mofifiers
+ codeClass.IsPartial = CodeDomHelper.IsPartial(cls.Attributes);
+ codeClass.TypeAttributes = CodeDomHelper.GetTypeAttributes(cls.Attributes);
+ codeClass.Attributes = CodeDomHelper.GetMemberAttributes(cls.Attributes);
+
+ fields = Dictionary.[string, CodeMemberField]();
+ events = Dictionary.[string, CodeMemberEvent]();
+ methods = Dictionary.[string, CodeMemberMethod]();
+ props = Dictionary.[string, CodeMemberProperty]();
+
+ //TODO: adds custom attributes
+ // adds members
+ foreach(member in cls.decls)
+ {
+ def m = CreateMember(member);
+ match(m)
+ {
+ | m is CodeMemberField => fields.Add(m.Name, m);
+ | m is CodeMemberEvent => events.Add(m.Name, m);
+ | m is CodeMemberMethod => methods.Add(m.Name, m);
+ | m is CodeMemberProperty => props.Add(m.Name, m);
+ | _ => ();
+ }
+ _ = codeClass.Members.Add(m);
+ }
+
+ // parse statements for methods
+ foreach(member is CodeMemberMethod in codeClass.Members)
+ {
+ // adds statements
+ def body = member.UserData["body"] :> list[PExpr];
+
+ when(body != null)
+ {
+ vars = Dictionary.[string, CodeVariableDeclarationStatement]();
+ member.Statements.AddRange(CreateStatements(body));
+ }
+ }
+
+ // adds baseClass and interfaces
+ foreach(extend in cls.t_extends)
+ _ = codeClass.BaseTypes.Add(extend.ToString());
+
+ //TODO: adds usings directives
+
+ AddToNamespace(cls, codeClass);
+ }
+
+ private CreateMember(member: ClassMember) : CodeTypeMember
+ {
+ def CreateField(member)
+ {
+ mutable field = CodeMemberField(member.ty.ToString(), member.Name);
+ field.Attributes = CodeDomHelper.GetMemberAttributes(member.Attributes, true);
+ field;
+ }
+
+ match(member)
+ {
+ | ClassMember.Field as m => CreateField(m);
+ | ClassMember.Function as m => CreateFunction(m);
+ | _ => Debug.WriteLine($"CodeDomParser ignore declaration: $member : $(member.Name)"); null;
+ }
+ }
+
+ private CreateFunction(member: ClassMember.Function) : CodeMemberMethod
+ {
+ def CreateMemberMethod(member)
+ {
+ mutable method = CodeMemberMethod();
+ method.Name = member.Name;
+
+ mutable retType = member.header.ret_type.ToString().Trim();
+ when(String.Compare(retType, "void", StringComparison.InvariantCultureIgnoreCase) == 0)
+ retType = "System.Void";
+
+ method.ReturnType = CodeTypeReference(retType);
+ method;
+ }
+
+ mutable method: CodeMemberMethod = match(member.kind)
+ {
+ | FunKind.Constructor => CodeConstructor();
+ | FunKind.StaticConstructor => CodeTypeConstructor();
+ | _ when member.Name == ".ctor" =>
+ if(member.Attributes %&& NemerleAttributes.Static)
+ CodeTypeConstructor();
+ else
+ CodeConstructor();
+ | _ => CreateMemberMethod(member);
+ }
+
+ // sets attributes
+ method.Attributes = CodeDomHelper.GetMemberAttributes(member.Attributes);
+
+ // adds arguments
+ foreach (param in member.header.parms)
+ _ = method.Parameters.Add(CodeParameterDeclarationExpression(
+ param.ty.ToString(), param.Name));
+
+ match (member.body)
+ {
+ | FunBody.Parsed(expr) =>
+ match (expr)
+ { | <[ { .. $exprs } ]> => method.UserData["body"] = exprs;
+ | _ => method.UserData["body"] = [expr];
+ }
+ | _ => ();
+ }
+ method;
+ }
+
+ private GetName(obj: object): string
+ {
+ match(obj)
+ {
+ | null => "null";
+ | PExpr.Ref(name) => name.Id;
+ | Splicable.Name(body) => body.ToString();
+ | _ => obj.ToString();
+ }
+ }
+
+ private CreateExpressions(exprs: list[PExpr]): array[CodeExpression]
+ {
+ mutable items = CodeExpressionCollection();
+ foreach(expr in exprs)
+ _ = items.Add(CreateExpression(expr));
+
+ mutable arrExprs = array(items.Count);
+ items.CopyTo(arrExprs, 0);
+ arrExprs;
+ }
+
+ private IsField(name: string): bool
+ {
+ fields.ContainsKey(name);
+ }
+ private IsVar(name: string): bool
+ {
+ vars.ContainsKey(name);
+ }
+ private IsEvent(name: string): bool
+ {
+ events.ContainsKey(name);
+ }
+ private IsMethod(name: string): bool
+ {
+ methods.ContainsKey(name);
+ }
+
+ private ParseMember(m: PExpr.Member): CodeExpression
+ {
+ def res = match(m.obj)
+ {
+ | PExpr.This() =>
+
+ if(IsField(GetName(m.member)))
+ CodeFieldReferenceExpression(CreateExpression(m.obj), GetName(m.member))
+ else if(IsEvent(GetName(m.member)))
+ CodeEventReferenceExpression(CreateExpression(m.obj), GetName(m.member))
+ else if(IsMethod(GetName(m.member)))
+ CodeMethodReferenceExpression(CreateExpression(m.obj), GetName(m.member))
+ else
+ CodePropertyReferenceExpression(CreateExpression(m.obj), GetName(m.member))
+
+ | PExpr.Member as mem =>
+ {
+ def fullName = TypeNameFull(mem, []);
+
+ if(fullName.IsEmpty)
+ CodePropertyReferenceExpression(ParseMember(mem), GetName(m.member));
+ else
+ CodeFieldReferenceExpression(CodeTypeReferenceExpression(fullName.ToString(".")), GetName(m.member));
+ }
+ | PExpr.Ref =>
+ CodePropertyReferenceExpression(CreateExpression(m.obj), GetName(m.member))
+ |_ =>
+ CodeSnippetExpression(m.ToString());
+ }
+
+ Debug.WriteLine($"$m -> $res");
+ res;
+ }
+
+ private CanBeTypeName(expr: PExpr): bool
+ {
+ match (expr) {
+ | PExpr.Ref => !(IsField(GetName(expr)) || IsVar(GetName(expr)));
+ | <[ $expr . $_ ]>
+ | <[ $expr . [ .. $_ ] ]>
+ | <[ $expr [ .. $_ ] ]> =>
+ CanBeTypeName (expr)
+ | _ => false
+ }
+ }
+
+ private TypeNameFull(expr: PExpr, fullName: list[string]): list[string]
+ {
+ match (expr)
+ {
+ | <[ $expr . $(mem : dyn) ]> when CanBeTypeName (expr) =>
+ TypeNameFull(expr, GetName(mem) :: fullName);
+ | x when CanBeTypeName(x) => TypeNameFull(null, GetName(x) :: fullName);
+ | _ => fullName;
+ }
+ }
+
+ private CreateExpression(expr: PExpr): CodeExpression
+ {
+ def res = match(expr)
+ {
+ | PExpr.This() => CodeThisReferenceExpression();
+ | PExpr.Base() => CodeBaseReferenceExpression();
+ | PExpr.Literal(val) => CodePrimitiveExpression(val.AsObject());
+ | PExpr.Wildcard() => CodeVariableReferenceExpression("_");
+ | PExpr.Member as m => ParseMember(m);
+ | PExpr.Call as call => ParseMethod(call);
+ | PExpr.Ref(name) => CodeVariableReferenceExpression(GetName(name));
+ | PExpr.Typeof(ty) => CodeTypeOfExpression(GetName(ty));
+ | PExpr.TypeEnforcement(expr, ty) => CodeCastExpression(GetName(ty), CreateExpression(expr));
+ | PExpr.TypeConversion(expr, ty) => CodeCastExpression(GetName(ty), CreateExpression(expr));
+ | PExpr.Array(rank, args) =>
+
+ def arrayExp = match(args)
+ {
+ | PExpr.ListLiteral(elements) => CodeArrayCreateExpression("System.Object", CreateExpressions(elements));
+ | _ => CodeArrayCreateExpression("System.Object", CreateExpression(args));
+ }
+
+ when(rank != null)
+ arrayExp.SizeExpression = CreateExpression(rank);
+
+ when(arrayExp.Initializers.Count > 0)
+ {
+ arrayExp.CreateType = match(arrayExp.Initializers[0])
+ {
+ | l is CodePrimitiveExpression when(l.Value != null) =>
+ CodeTypeReference(l.Value.GetType());
+ | f is CodeFieldReferenceExpression when(fields[f.FieldName] != null) =>
+ fields[f.FieldName].Type;
+ | v is CodeVariableReferenceExpression when(vars[v.VariableName] != null)=>
+ vars[v.VariableName].Type;
+ | _ => CodeTypeReference("System.Object");
+ }
+ }
+
+ arrayExp;
+ | _ => Debug.WriteLine($"CodeDomParser ignore expression: $(expr.GetType()): $(expr)"); CodeSnippetExpression(expr.ToString());
+ }
+
+ Debug.WriteLine($"$expr -> $res");
+ res;
+ }
+
+ private ParseMethod(call: PExpr.Call): CodeExpression
+ {
+ def fullName = TypeNameFull(call.func, []);
+
+ if(fullName.IsEmpty)
+ {
+ match(call.func)
+ {
+ | PExpr.Member as m => CodeMethodInvokeExpression(CodeMethodReferenceExpression(CreateExpression(m.obj), GetName(m.member)), CreateExpressions(call.parms));
+ | _ => CodeSnippetExpression(call.ToString());
+ }
+ }
+ else
+ {
+ def ctorName = fullName.ToString(".");
+ def args = CreateExpressions(call.parms);
+ match(ctorName)
+ {
+ | "|" when args.Length == 2 =>
+ CodeBinaryOperatorExpression(args[0], CodeBinaryOperatorType.BitwiseOr, args[1]);
+ | "&" when args.Length == 2 =>
+ CodeBinaryOperatorExpression(args[0], CodeBinaryOperatorType.BitwiseAnd, args[1]);
+ | _ =>
+ CodeObjectCreateExpression(fullName.ToString("."), args);
+ }
+ }
+ }
+
+ private CreateStatements(seqs: list[PExpr]): CodeStatementCollection
+ {
+ mutable statements = CodeStatementCollection();
+ foreach (seq in seqs)
+ {
+ def statement = match(seq)
+ {
+ | PExpr.Assign(target, source) => CodeAssignStatement(CreateExpression(target), CreateExpression(source));
+ | PExpr.Call as call =>
+ GetStatement(CreateExpression(call));
+ | PExpr.DefMutable(name, val) =>
+ {
+ def var = CodeVariableDeclarationStatement("", GetName(name));
+
+ when(val != null)
+ var.InitExpression = CreateExpression(val);
+
+ var.Type = match(var.InitExpression)
+ {
+ | i is CodeObjectCreateExpression => i.CreateType;
+ | _ => CodeTypeReference("System.Object");
+ }
+
+ vars.Add(GetName(name), var);
+ var;
+ }
+ | _ => Debug.WriteLine($"CodeDomParser ignore statement: $(seq.GetType()): $seq"); CodeExpressionStatement(CreateExpression(seq));
+ }
+ _ = statements.Add(statement);
+ }
+ statements;
+ }
+ private GetStatement(expr: CodeExpression): CodeStatement
+ {
+ def GetCodeEventReferenceExpression(e)
+ {
+ match(e.Parameters[0])
+ {
+ | p is CodePropertyReferenceExpression =>
+ CodeEventReferenceExpression(p.TargetObject, p.PropertyName);
+ | f is CodeFieldReferenceExpression =>
+ CodeEventReferenceExpression(f.TargetObject, f.FieldName);
+ | v is CodeVariableReferenceExpression =>
+ CodeEventReferenceExpression(CodeThisReferenceExpression(), v.VariableName);
+ | _ =>
+ throw InvalidOperationException("Invalid CodeEventReferenceExpression.");
+ }
+ }
+
+ match(expr)
+ {
+ | e is CodeObjectCreateExpression
+ when e.CreateType.BaseType == "+=" && e.Parameters.Count == 2 =>
+ CodeAttachEventStatement(GetCodeEventReferenceExpression(e), e.Parameters[1]);
+
+ | e is CodeObjectCreateExpression
+ when e.CreateType.BaseType == "-=" && e.Parameters.Count == 2 =>
+ CodeRemoveEventStatement(GetCodeEventReferenceExpression(e), e.Parameters[1]);
+
+ | _ => CodeExpressionStatement(expr);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Const.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Const.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,10 @@
+using System;
+namespace Nemerle.Completion2
+{
+ public module Const
+ {
+ public DelegateType : Type = typeof(System.Delegate);
+ public VariantType : Type = typeof(Nemerle.Internal.VariantAttribute);
+ public VariantOptionType : Type = typeof(Nemerle.Internal.VariantOptionAttribute);
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj Wed Aug 16 05:38:15 2006
@@ -0,0 +1,97 @@
+ďťż<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <NoStdLib>true</NoStdLib>
+ <Nemerle Condition=" '$(Nemerle)' == '' ">$(ProgramFiles)\Nemerle</Nemerle>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>..\Nemerle.VsIntegration\nemerle.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DBC77173-9367-485F-B425-74E6D6AB3F82}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Nemerle.Compiler.Utils</RootNamespace>
+ <AssemblyName>Nemerle.Compiler.Utils</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="$(Nemerle)\Nemerle.dll" />
+ <Reference Include="$(Nemerle)\Nemerle.Compiler.dll" />
+ <Reference Include="$(Nemerle)\Nemerle.Macros.dll" />
+ <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CodeDomHelper.n" />
+ <Compile Include="CodeDomParser.n" />
+ <Compile Include="NemerleCodeDomProvider.n" />
+ <Compile Include="Properties\AssemblyInfo.n" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Nemerle.Completion2\CompilerMessage.n" />
+ <Compile Include="Nemerle.Completion2\MessageKind.n" />
+ <Compile Include="Nemerle.Completion2\EngineState.n" />
+ <Compile Include="Nemerle.Completion2\CodeCompletionEngineException.n" />
+ <Compile Include="Nemerle.Completion2\InternalReference.n" />
+ <Compile Include="Nemerle.Completion2\DefineCollection.n" />
+ <Compile Include="Nemerle.Completion2\ReferenceCollection.n" />
+ <Compile Include="Nemerle.Completion2\ParsedFile.n" />
+ <Compile Include="Nemerle.Completion2\SourceCollection.n" />
+ <Compile Include="AstBrowserForm.n" />
+ <Compile Include="Nemerle.Completion2\Decl.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine-main.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine.ParseEvents.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\CompileUnitCollection.n" />
+ <Compile Include="Nemerle.Completion2\Tests\Tests.n" />
+ <Compile Include="Nemerle.Completion2\TraceWriter.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\Project.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\Project.Using.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\Project.Namespace.n" />
+ <Compile Include="Nemerle.Completion2\Engine\CompletionElem.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine.Init.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine.Properties.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine.crud.n" />
+ <Compile Include="Nemerle.Completion2\Engine\Engine.utils.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\Project.Type.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\Project.overload.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\QuickTipInfo.n" />
+ <Compile Include="Nemerle.Completion2\CodeModel\GlyphType.n" />
+ <Compile Include="Const.n" />
+ <None Include="Nemerle.Completion2\Tests\Content\Class1-2.n" />
+ <None Include="Nemerle.Completion2\Tests\Content\Class1.n" />
+ <Compile Include="Utils.n" />
+ <Compile Include="Nemerle.Completion2\Tests\Tests.Init.n" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <Import Project="$(Nemerle)\Nemerle.MSBuild.targets" />
+</Project>
\ No newline at end of file
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeCompletionEngineException.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeCompletionEngineException.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,23 @@
+using System;
+using Nemerle.Assertions;
+using Nemerle.Collections;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+
+using Typed = Nemerle.Compiler.Typedtree;
+using SR = System.Reflection;
+
+namespace Nemerle.Completion2
+{
+ public class CodeCompletionEngineException : System.Exception
+ {
+ public mutable ParsingException : System.Exception;
+
+ public this (innerException : System.Exception)
+ {
+ ParsingException = innerException;
+ }
+ }
+}
+
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,69 @@
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+using SCG = System.Collections.Generic;
+
+namespace Nemerle.Completion2
+{
+ public class CompileUnitCollection
+ {
+ public this([NotNull] engine : Engine,
+ [NotNull] fileInfos : array[Decl.Namespace])
+ {
+ _engine = engine;
+ _fileInfos = fileInfos;
+ }
+
+ _engine : Engine;
+ _fileInfos : array[Decl.Namespace];
+
+
+ public GetFileIndex(filePath : string) : int
+ {
+ Location.GetFileIndex(filePath);
+ }
+
+ public Item[fileIndex : int] : Decl.Namespace
+ {
+ get
+ {
+ when (_fileInfos.Length < 0)
+ throw System.Exception($"File '$fileIndex' not exists in project.");
+
+ def fileInfo = _fileInfos[fileIndex];
+ when (fileInfo == null)
+ throw System.Exception($"File '$fileIndex' contain empty declaration list.");
+
+ fileInfo
+ }
+ }
+
+ public Item[filePath : string] : Decl.Namespace
+ {
+ get { this[GetFileIndex(filePath)]; }
+ }
+
+ public Count : int
+ {
+ //[Nemerle.Memoize]
+ get
+ {
+ mutable count = 0;
+
+ foreach (fileInfo in _fileInfos)
+ when (fileInfo != null)
+ count++;
+
+ count;
+ }
+ }
+
+ public GetEnumerator() : SCG.IEnumerator[Decl.Namespace]
+ {
+ foreach (fileInfo in _fileInfos)
+ when (fileInfo != null)
+ yield fileInfo;
+ }
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GlyphType.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GlyphType.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,30 @@
+namespace Nemerle.Completion2
+{
+ public enum GlyphType
+ {
+ | Class = 0
+ | Const = 6 * 1
+ | Delegate = 6 * 2
+ | Enum = 6 * 3
+ | EnumValue = 6 * 4
+ | Event = 6 * 5
+ | Field = 6 * 7
+ | Interface = 6 * 8
+ | Function = 6 * 12 //72
+ | Namespace = 6 * 15
+ | Property = 6 * 17
+ | Variant = 6 * 21
+ | VariantOption = 6 * 22
+ | Macro = 6 * 23
+ | Snippet = 205
+ }
+
+ public enum GlyphSubtype
+ {
+ | Public = 0
+ | Internal = 1
+ | ProtectedInternal = 2
+ | Protected = 3
+ | Private = 4
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Namespace.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,20 @@
+using System.Diagnostics;
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+using SCG = System.Collections.Generic;
+
+using Nemerle.Compiler.Utils;
+
+namespace Nemerle.Completion2
+{
+ public partial class Project
+ {
+ CompleteInNamespace(_ns : Decl.Namespace, _fileIndex : int, _line : int, _col : int,
+ _getText : GetText) : array[object]
+ {
+ _topKeywords
+ }
+ } // end class Project
+} // end namespace
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,165 @@
+using System;
+using System.Diagnostics;
+
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Compiler.Typedtree;
+using Nemerle.Utility;
+
+using SCG = System.Collections.Generic;
+
+using Nemerle.Compiler.Utils;
+
+namespace Nemerle.Completion2
+{
+ public partial class Project
+ {
+ /// Complete word inside the method.
+ CompleteInType(@type : Decl.Type, fileIndex : int, line : int, col : int,
+ getText : GetText) : array[object]
+ {
+ def typeBuilder = @type.Builder;
+ // Find member under cursor
+ def member = typeBuilder.GetActiveMember(fileIndex, line, col);
+
+ match (member)
+ {
+ | method is MethodBuilder =>
+ // Adjust the body location...
+ def loc = method.Body.Location;
+ // IT: ÷ňî ĺńëč čńďîëüçóĺňń˙ âŕđčŕíň ńčíňŕęńčńŕ áĺç ńęîáîę?
+ //
+ def colStart = loc.Column + 1; // exclude open brace
+ def colEnd = loc.EndColumn - 1; // exclude close brace
+ def loc = Location(loc.FileIndex, loc.Line, colStart, loc.EndLine, colEnd);
+
+ if (loc.Contains(line, col)) // completion in method body
+ {
+ def bodyCode = getText(loc.Line, colStart, loc.EndLine, colEnd);
+ def completionCode = getText(loc.Line, colStart, line, col);
+ def result = _engine.RunCompletionEngine(method, bodyCode, completionCode.Length);
+
+ if (result == null)
+ {
+ Trace.WriteLine("### RunCompletionEngine() return null!");
+ array(0);
+ }
+ else
+ {
+ Trace.WriteLine($"# RunCompletionEngine() return $(result.ObjectType)");
+ MakeOverloads(result).ToBase();
+ }
+ }
+ else
+ {
+ // Completin in AutoModule
+ if (member.DeclaringType.FullName == _autoModule)
+ {
+ _topKeywords;
+ }
+ else
+ {
+ Trace.WriteLine($"# Completion outside body");
+ array(0); // completion outside body (try conplete types)
+ }
+ }
+
+ | _ => throw System.Exception($"Unknown member type '$member'.");
+ }
+ }
+
+ private GetTypeQuickTip(
+ typeDecl : Decl.Type,
+ fileIndex : int,
+ line : int,
+ col : int,
+ getText : GetText) : QuickTipInfo
+ {
+ def typeBuilder = typeDecl.Builder;
+ def member = typeBuilder.GetActiveMember(fileIndex, line, col);
+
+ match (member)
+ {
+ | method is MethodBuilder =>
+
+ def location = method.Body.Location;
+
+ if (location.Contains(line, col)) // in method body
+ {
+ mutable bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
+
+ //when (bodyCode.StartsWith("{")) bodyCode = " " + bodyCode.Substring(1);
+ //when (bodyCode.EndsWith ("}")) bodyCode = bodyCode.Substring(0, bodyCode.Length - 1) + " ";
+
+ // This prevents inlining during the typifying.
+ //
+ bodyCode += "\n;*/; EERRRROORR";
+
+ def (pBody, tBody, _) = _engine.CompileMethod(method, bodyCode, location);
+
+ mutable ret = null;
+ mutable locationToFind;
+ mutable pExpr;
+
+ when (pBody != null)
+ {
+ def (loc, obj) = FindLocatedExpr(pBody.expr, line, col);
+
+ match (obj)
+ {
+ | PExpr.MacroCall as mc =>
+
+ locationToFind = loc;
+ pExpr = mc;
+
+ | _ => ()
+ }
+ }
+
+ when (ret == null && tBody != null)
+ {
+ def (loc, obj) = FindLocatedExpr(tBody.expr, line, col, locationToFind);
+
+ if (locationToFind != Location.Default)
+ {
+ match (pExpr)
+ {
+ | PExpr.MacroCall as mc => ret = QuickTipInfo(loc, mc, obj :> TExpr)
+ | _ => ()
+ }
+ }
+ else match (obj)
+ {
+ | lv is LocalValue => ret = QuickTipInfo(loc, lv);
+ | mm is IMember => ret = QuickTipInfo(loc, mm);
+ | tv is TyVar => ret = QuickTipInfo(loc, tv);
+ | fh is Typedtree.Fun_header => ret = QuickTipInfo(loc, fh);
+ | _ => ()
+ }
+ }
+
+ ret
+
+ }
+ else
+ {
+ /*
+ // Completin in AutoModule
+ if (member.DeclaringType.FullName == _autoModule)
+ {
+ //_topKeywords;
+ }
+ else
+ {
+ //Trace.WriteLine($"# Completion outside body");
+ //array(0); // completion outside body (try conplete types)
+ }
+ */
+ null
+ }
+ | _ => throw System.Exception($"Unknown member type '$member'.");
+ }
+ }
+ } // end class Project
+} // end namespace
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,220 @@
+using System;
+using System.Diagnostics;
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+using SCG = System.Collections.Generic;
+
+using Nemerle.Compiler.Utils;
+using Nemerle.Compiler.Utils.Parsing;
+
+namespace Nemerle.Completion2
+{
+ public partial class Project
+ {
+ static UsingLen : int = 5;
+
+ /// Complete word inside the using directive.
+ CompleteInUsing(us : Decl.Using, fileIndex : int, line : int, col : int,
+ getText : GetText) : array[object]
+ {
+ def loc = us.Location;
+
+ if (us.Name is []) // using directive with empty namspace name
+ {
+ if (loc.Line == line && col <= loc.Column + UsingLen)
+ array(0) // completion on the end of "using" keyword
+ else
+ us.BeforeEnv.CurrentNamespace.Children.Keys
+ .ToArrayFiltered(elem => elem != _autoModule).ToBase();
+ }
+ else
+ {
+ // Truncate name and locations lists if the compilation took place
+ // at the middle of namespace name
+ def (name, nameLocs) = Truncate(us.Name, us.NameLocations, fileIndex, line, col);
+ def (first, last) = (nameLocs.Head, nameLocs.Last);
+
+ // If the previous character is '.', the user is trying to get
+ // the list of all internal elements (types and namespaces).
+ // Otherwise consider him trying to complete the last element.
+ def text = getText(last.Line, last.Column, last.EndLine, last.EndColumn);
+ def completeLastName = text != ".";
+
+ // Completion befor namespace name
+ if (line < first.Line || line == first.Line && col < first.Column)
+ array(0)
+ // "using System.Text |;"
+ else if (completeLastName
+ && (line > last.EndLine || line == last.EndLine && col > last.EndColumn))
+ array(0)
+ else
+ {
+ // Try to open namespace (retrieve namespace object by its name)
+ def ns = OpenNs(name, us.BeforeEnv.NameTree.NamespaceTree, completeLastName);
+ // Convert namsespace content to CompletionElems (with filtering)
+ if (ns.Children == null)
+ array(0)
+ else
+ GetCompletionElems(ns, if (completeLastName) name.Last else null,
+ !string.IsNullOrEmpty(us.Alias));
+ }
+ }
+ }
+
+ static Truncate(
+ name : list[string],
+ locs : list[Location],
+ fileIndex : int,
+ line : int,
+ col : int) : list[string] * list[Location]
+ {
+ match (locs)
+ {
+ | nameLoc :: dotLoc :: tail =>
+ if (nameLoc.Contains(fileIndex, line, col))
+ ([name.Head], [nameLoc])
+ else if (dotLoc.Contains(fileIndex, line, col))
+ ([name.Head], [nameLoc, dotLoc])
+ else
+ {
+ def (name2, locs2) = Truncate(name.ChopFirstN(1), tail, fileIndex, line, col);
+ (name.Head :: name2, nameLoc :: dotLoc :: locs2)
+ }
+ | nameLoc :: [] => ([name.Head], [nameLoc])
+ | [] => ([], [])
+ }
+ }
+
+ static OpenNs(name : list[string], ns : NamespaceTree.Node, completeLastName : bool) : NamespaceTree.Node
+ {
+ if (ns.Children == null)
+ ns
+ else match (name)
+ {
+ | _ :: [] when completeLastName => ns // The end element of name
+ | head :: tail =>
+ match (ns.Children.Get(head))
+ {
+ | Some(subNs) => OpenNs(tail, subNs, completeLastName)
+ | None() => ns
+ }
+ | [] => ns
+ }
+ }
+
+ /// Returns array which contains namespace elements. If lastName is not null,
+ /// filter content by prefix is contained in lastName.
+ static GetCompletionElems(
+ ns : NamespaceTree.Node,
+ lastName : string,
+ isAlias : bool
+ ) : array[object]
+ {
+ def resalt = SCG.List.[object]();
+
+ def fitForAliace(typeInfo : NamespaceTree.TypeInfoCache)
+ {
+ | Cached => true
+ | CachedAmbiguous => true
+ | NotLoaded(externalType) => !externalType.SystemType.IsNotPublic
+ | NotLoadedList => true
+ | NamespaceReference => true
+ | No | MacroCall => false
+ }
+
+ def fitForNsOpen(typeInfo : NamespaceTree.TypeInfoCache)
+ {
+ // interface & delegate can't contains static member (it can't be open)
+ | Cached(ty) => !(ty.IsInterface || ty.IsDelegate)
+
+ | CachedAmbiguous(typeInfos) => typeInfos.Exists(ty : TypeInfo => !(ty.IsInterface || ty.IsDelegate))
+ | NotLoaded(externalType) => // TypeInfo of external type not yet loaded
+ def sType = externalType.SystemType;
+ // interface & delegate can't contains static member (it can't be open)
+ !sType.IsNotPublic && !(sType.IsSubclassOf(Const.DelegateType) || sType.IsInterface)
+
+ | NotLoadedList(_externalTypes) => true
+ | NamespaceReference => true
+ | No | MacroCall => false
+ }
+
+ def fitForCompletion =
+ if (lastName == null)
+ if (isAlias) (_, typeInfo) => fitForAliace(typeInfo) else (_, typeInfo) => fitForNsOpen(typeInfo)
+ else
+ {
+ def f(name, typeInfo, fitFor)
+ {
+ name.StartsWith(lastName, StringComparison.InvariantCultureIgnoreCase)
+ && fitFor(typeInfo);
+ }
+ if (isAlias) f(_, _, fitForNsOpen) else f(_, _, fitForNsOpen)
+ };
+
+ foreach ((name, node) when fitForCompletion(name, node.Value) in ns.Children.KeyValuePairs)
+ resalt.Add(CompletionElem(name, node));
+
+ resalt.ToArray();
+ }
+
+ private Contains(locations : list[Location], fileIndex : int, line : int, col : int) : bool
+ {
+ match (locations)
+ {
+ | [] => false
+ | first :: [] => first.Contains(fileIndex, line, col)
+ | first :: tail => (first + tail.Last).Contains(fileIndex, line, col)
+ }
+ }
+
+ private GetUsingQuickTip(
+ usingDecl : Decl.Using,
+ fileIndex : int,
+ line : int,
+ col : int) : QuickTipInfo
+ {
+ if (Contains(usingDecl.NameLocations, fileIndex, line, col))
+ {
+ def (names, locs) = Truncate(usingDecl.Name, usingDecl.NameLocations, fileIndex, line, col);
+
+ def node = OpenNs(names /*usingDecl.Name*/, usingDecl.BeforeEnv.CurrentNamespace, false);
+
+ def prefix = match (node.Value)
+ {
+ | NamespaceReference => "namespace"
+ | Cached(ti) =>
+ if (ti.IsInterface) "interface"
+ else if (ti.IsDelegate) "delegate"
+ else "class"
+ | CachedAmbiguous => "ambiguous"
+ | NotLoaded(ti) =>
+ def st = ti.SystemType;
+ if (st.IsInterface) "interface"
+ else "class"
+ | _ => null
+ }
+
+ if (prefix != null)
+ {
+ Debug.WriteLine("*** Using QuickTip found.");
+ QuickTipInfo(
+ prefix,
+ names,
+ $[ l | l in locs, l.Line > line || l.Contains(line, col)])
+ }
+ else
+ {
+ Debug.WriteLine("*** Using QuickTip almost found.");
+ null
+ }
+ }
+ else
+ {
+ Debug.WriteLine("*** Using QuickTip not found.");
+ null
+ }
+ }
+ } // end class Project
+} // end namespace
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,655 @@
+using System.Diagnostics;
+using SCG = System.Collections.Generic;
+
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+using Nemerle.Imperative;
+using Nemerle.Compiler.Typedtree;
+
+using Nemerle.Compiler.Utils;
+
+namespace Nemerle.Completion2
+{
+ public delegate GetText(line : int, col : int, lineEnd : int, colEnd : int) : string;
+
+ [Record]
+ public partial class Project
+ {
+ [Accessor] _engine : Engine;
+ [Accessor] _compileUnits : CompileUnitCollection;
+ [Accessor] _namespaceTree : NamespaceTree.Node;
+
+ public CompleteWord(
+ [NotNull] filePath : string,
+ line : int,
+ col : int,
+ [NotNull] getText : GetText
+ ) : array[object]
+ {
+ def fileIndex = _compileUnits.GetFileIndex(filePath);
+ // Find the declaration under text cursor.
+ def decl = GetActiveDecl(fileIndex, line, col);
+
+ match (decl)
+ {
+ | GlobalAttribute => array(0)
+ | Using as us => CompleteInUsing(us, fileIndex, line, col, getText);
+ | Namespace as ns => CompleteInNamespace(ns, fileIndex, line, col, getText);
+ | Type as ty => CompleteInType(ty, fileIndex, line, col, getText);
+ | None => throw System.Exception(); //array(0)
+ }
+ }
+
+ static _topKeywords : array[object] =
+ array["using" : object, "class", "struct", "variant", "namespace", "enum"];
+
+ static _autoModule = "_N_AutoModule";
+
+ /// Íŕőîäčň ńŕěóţ âëîćĺííóţ ęîńňđóęöčţ âĺđőíĺăî (ďđîńňđŕńňâî čěĺí, ęëŕńń,
+ /// using čëč ŕňđčáóň) óđîâí˙ â ôŕéëĺ âíóňđü ęîňîđîé óęŕçűâŕţň ńňđîęŕ
+ /// č ęîëîíęŕ (line, col).
+ public GetActiveDecl(
+ fileIndex : int,
+ line : int,
+ col : int
+ ) : Decl
+ {
+ def find_decl(decl : Decl)
+ {
+ def find(decls : list[Decl])
+ {
+ | decl2 :: tail =>
+ match (find_decl(decl2))
+ {
+ | Decl.None => find(tail)
+ | x => x
+ }
+ | [] => decl
+ }
+
+ if (decl.Location.Contains(line, col))
+ match (decl)
+ {
+ | Namespace as ns2 => find(ns2.Decls)
+ | _ => decl
+ }
+ else
+ Decl.None(Location.Default)
+ }
+
+ find_decl(_compileUnits[fileIndex])
+ }
+
+ /// Finds the innermost top level construction (namespace, class,
+ /// using, attribute) located at filePath, line, and col.
+ public GetActiveDecl(
+ [NotNull] filePath : string,
+ line : int,
+ col : int)
+ : Decl
+ {
+ GetActiveDecl(_compileUnits.GetFileIndex(filePath), line, col)
+ }
+
+ public GetQuickTipInfo([NotNull] filePath : string, line : int, col : int, getText : GetText) : QuickTipInfo
+ {
+ def fileIndex = _compileUnits.GetFileIndex(filePath);
+ def decl = GetActiveDecl(fileIndex, line, col);
+
+ match (decl)
+ {
+ | Using as us => GetUsingQuickTip(us, fileIndex, line, col)
+ | Type as tp => GetTypeQuickTip (tp, fileIndex, line, col, getText);
+ | None => throw System.Exception()
+ | _ => null
+ }
+ }
+
+ private FindLocatedExpr(
+ root : PExpr,
+ line : int,
+ col : int)
+ : (Location * object)
+ {
+ Trace.WriteLine($"\nStart looking at: $line:$col.");
+
+ def Print[T](ex : T) : void
+ {
+ Trace.WriteLine($"Unknown expression $(ex.GetType().FullName) : $ex.");
+ }
+
+ def IsIn(location)
+ {
+ location.Contains(line, col);
+ }
+
+ mutable counter = 0;
+ mutable curLocation = root.Location;
+ mutable stop = false;
+ mutable retObject;
+ mutable retLocation;
+
+ def Print2(ex)
+ {
+ mutable s = "";
+
+ for (mutable i = 0; i < counter; i++)
+ s += " ";
+
+ Trace.WriteLine(s + $"$(ex.GetType().FullName) $(ex.loc.Line):$(ex.loc.Column):$(ex.loc.EndLine):$(ex.loc.EndColumn) cur:$(curLocation.Line):$(curLocation.Column):$(curLocation.EndLine):$(curLocation.EndColumn).");
+ Trace.WriteLine(s + ex.ToString().Replace("\n", "\n" + s));
+ Trace.WriteLine("");
+ }
+
+ def Go(expression : PExpr)
+ {
+ def not_impl() { Print(expression) }
+
+ def checkObject(location : Location, obj : object)
+ {
+ unless (stop)
+ {
+ if (IsIn(location))
+ {
+ stop = true;
+ retObject = obj;
+ retLocation = Parsing.Intersect(curLocation, location);
+ }
+ else
+ {
+ curLocation = curLocation.Trim(location, line, col);
+ }
+ }
+ }
+
+ def checkLocated(obj : Located)
+ {
+ checkObject(obj.Location, obj);
+ }
+
+ def DoSyntaxElement(syntaxElement : SyntaxElement)
+ {
+ when (stop || !IsIn(curLocation))
+ return;
+
+ match (syntaxElement)
+ {
+ | Expression(expr) // { body : PExpr; }
+ | TType (expr) => // { body : PExpr; }
+
+ Go(expr)
+
+ | MatchCase(mc) => // { body : Parsetree.MatchCase; }
+
+ mc.patterns.Iter(Go);
+ Go(mc.body);
+
+ | Function // { body : Function_decl; }
+ | Parameter // { body : Fun_parm; }
+ | RawToken // { body : Token; }
+ | ClassMember // { body : Parsetree.ClassMember; }
+ | TypeBuilder // { body : Compiler.TypeBuilder; }
+ | FieldBuilder // { body : Compiler.FieldBuilder; }
+ | MethodBuilder // { body : Compiler.MethodBuilder; }
+ | PropertyBuilder // { body : Compiler.PropertyBuilder; }
+ | EventBuilder // { body : Compiler.EventBuilder; }
+ | ParameterBuilder => // { body : Typedtree.Fun_parm; }
+
+ Print(syntaxElement);
+
+ }
+ }
+
+ when (stop || !IsIn(curLocation))
+ return;
+
+ Print2(expression);
+ counter++;
+
+ match (expression)
+ {
+ | Tuple (lst) // { args : list [PExpr]; }
+ | ListLiteral(lst) // { elements : list [PExpr]; }
+ | Sequence (lst) => // { body : list [PExpr]; }
+
+ lst.Iter(Go);
+
+ | MacroCall(_, _, elems) => // { name : Name; ns : NamespaceTree.Node; parms : list [SyntaxElement]; }
+
+ checkLocated(expression);
+ elems.Iter(DoSyntaxElement);
+
+ | Call(func, parms) => // { func : PExpr; parms : list [PExpr]; }
+
+ parms.Iter(Go);
+ Go(func);
+
+ | Ref (obj : object) // { name : Name; }
+ | Literal(obj : object) => // { val : Nemerle.Compiler.Literal; }
+
+ checkObject(expression.Location, obj);
+
+ | TypeConversion (e1, e2) // { expr : PExpr; ty : PExpr; } // (expr :> ty)
+ | TypeEnforcement(e1, e2) // { expr : PExpr; ty : PExpr; } // (expr : ty)
+ | Assign (e1, e2) // { target : PExpr; source : PExpr; }
+ | Define (e2, e1) => // { pattern : PExpr; val : PExpr; }
+
+ Go(e2);
+ Go(e1);
+
+ | Error => // placeholder of missing tree (where some errors occured)
+
+ ();
+
+ | Typeof(obj) // { ty : PExpr; }
+ | Member(obj, _mem) => // { obj : PExpr; member : Splicable; }
+
+ Go(obj);
+ //checkObject(expression.Location, mem);
+
+ | Wildcard => // `_' used mainly in patterns, but also in `_ = ignored'
+
+ checkLocated(expression)
+
+ | Void // `void' used only in types
+ | As // { pat : PExpr; name : Splicable; }
+ | Is // { pat : PExpr; ty : PExpr; }
+ | Where // { name : PExpr; fields : PExpr; }
+ | Match // { expr : PExpr; cases : list [MatchCase]; }
+ | GenericSpecifier // { func : PExpr; generic_parms : list [PExpr]; }
+ | DefMutable // { name : PExpr; val : PExpr; }
+ | DefFunctions // { funs : list [Function_decl]; }
+ | Lambda // { decl : Function_decl; }
+ | Throw // { exn : PExpr; }
+ | Try // { body : PExpr; cases : list [TryCase]; }
+ | TryFinally // { body : PExpr; handler : PExpr; }
+ | This
+ | Base
+ | Array // { rank : PExpr; args : PExpr; }
+ | EmptyArray // { sizes : list [PExpr]; }
+ | Indexer // { obj : PExpr; args : list [PExpr]; }
+ | ParmByRef // { parm : PExpr; }
+ | ParmOut // { parm : PExpr; }
+ | Quoted // { body : SyntaxElement; }
+ | Spliced // { body : PExpr; }
+ | ToComplete // { body : Name; }
+ | Ellipsis // { body : PExpr; }
+ | Typed // { body : Typedtree.TExpr; }
+ | TypedPattern // { body : Typedtree.Pattern; }
+ | TypedType // { body : TyVar; }
+ | _ =>
+
+ not_impl();
+
+ }
+
+ counter--;
+ }
+
+ Go(root);
+
+ (retLocation, retObject)
+ }
+
+ private FindLocatedExpr(
+ root : TExpr,
+ line : int,
+ col : int,
+ locationToFind : Location)
+ : (Location * object)
+ {
+ Trace.WriteLine($"\nStart looking at: $line:$col, $locationToFind.");
+
+ def Print[T](ex : T) : void
+ {
+ Trace.WriteLine($"Unknown expression $(ex.GetType().FullName) : $ex.");
+ }
+
+ def IsIn(location)
+ {
+ location.Contains(line, col);
+ }
+
+ mutable counter = 0;
+ mutable curLocation = root.Location;
+ mutable stop = false;
+ mutable retObject;
+ mutable retLocation;
+
+ def Print2(ex : Located)
+ {
+ mutable s = "";
+
+ for (mutable i = 0; i < counter; i++)
+ s += " ";
+
+ Trace.WriteLine(s + $"$(ex.GetType().FullName) $(ex.loc.Line):$(ex.loc.Column):$(ex.loc.EndLine):$(ex.loc.EndColumn) cur:$(curLocation.Line):$(curLocation.Column):$(curLocation.EndLine):$(curLocation.EndColumn).");
+ Trace.WriteLine(s + ex.ToString().Replace("\n", "\n" + s));
+ Trace.WriteLine("");
+ }
+
+ def Go(expression : TExpr)
+ {
+ def not_impl() { Print(expression) }
+
+ def checkObject(location : Location, obj : object)
+ {
+ unless (stop)
+ {
+ if (IsIn(location))
+ {
+ stop = true;
+ retObject = obj;
+ retLocation = Parsing.Intersect(curLocation, location);
+ }
+ else
+ {
+ curLocation = curLocation.Trim(location, line, col);
+ }
+ }
+ }
+
+ def checkLocated(obj : Located)
+ {
+ checkObject(obj.Location, obj);
+ }
+
+ def DoPattern(pattern : Pattern)
+ {
+ when (stop || !IsIn(curLocation))
+ return;
+
+ Print2(pattern);
+ counter++;
+
+ match (pattern)
+ {
+ | Wildcard =>
+
+ ()
+
+ | Error =>
+
+ stop = stop || IsIn(expression.Location);
+
+ | Application as app => // { name : TypeInfo; arg : Pattern; }
+
+ checkObject(pattern.Location, app.name);
+ DoPattern(app.arg);
+
+ | Record(args) => // { args : list [IMember * Pattern]; }
+
+ foreach ((_member, pattern) in args)
+ DoPattern(pattern);
+
+ | As(pat, decl) => // { pat : Pattern; decl : LocalValue; }
+
+ DoPattern(pat);
+ checkLocated(decl);
+
+ | HasType as ht => // { typ : MType; }
+
+ checkObject(pattern.Location, ht.typ);
+
+ | Literal(Literal.Enum(_, ty)) => // { lit : Nemerle.Compiler.Literal; }
+
+ checkObject(pattern.Location, ty);
+
+ | Literal => // { val : Nemerle.Compiler.Literal; }
+
+ when (!typeof(void).Equals(pattern.SystemType))
+ checkLocated(pattern);
+
+ | Tuple(args) => // { args : list [Pattern]; }
+
+ args.Iter(DoPattern);
+
+ | Enum => // { fld : IField; val : Nemerle.Compiler.Literal; }
+
+ Print(pattern);
+
+ }
+
+ counter--;
+ }
+
+ when (stop || !IsIn(curLocation))
+ return;
+
+ Print2(expression);
+ counter++;
+
+ when (locationToFind.IsEqualExcludingFile(expression.Location))
+ {
+ stop = true;
+ retObject = expression;
+ retLocation = locationToFind;
+
+ return;
+ }
+
+ match (expression)
+ {
+ | StaticRef (_, mem : IMember, _) // { from : MType.Class; mem : IMember; type_parms : list [TyVar]; }
+ | ConstantObjectRef(_, mem : IMember) // { from : MType.Class; mem : IField; }
+ | StaticPropertyRef(_, mem : IMember) // { from : MType.Class; prop : IProperty; }
+ | StaticEventRef (_, mem : IMember) // { from : MType.Class; ev : IEvent; }
+ | Base (mem : IMember) => // { base_ctor : IMethod; }
+
+ checkObject(expression.Location, mem);
+
+ | LocalFunRef(lv, _) // { decl : LocalValue; type_parms : list [TyVar]; }
+ | LocalRef (lv) => // { decl : LocalValue; }
+
+ checkObject(expression.Location, lv)
+
+ | Literal(Literal.Enum(_, ty)) =>
+
+ checkObject(expression.Location, ty);
+
+ | Literal => // { val : Nemerle.Compiler.Literal; }
+
+ when (!typeof(void).Equals(expression.SystemType))
+ checkLocated(expression);
+
+ | Error
+ | ImplicitValueTypeCtor
+ | DefaultValue
+ | Goto // { target : int; mutable try_block : int; }
+ | This
+ | OpCode => // { name : string; }
+
+ stop = stop || IsIn(expression.Location);
+
+ | MethodRef (obj, mem : IMember, _, _) // { obj : TExpr; meth : IMethod; type_parms : list [TyVar]; notvirtual : bool; }
+ | EventMember (obj, mem : IMember) // { obj : TExpr; ev : IEvent; }
+ | FieldMember (obj, mem : IMember) // { obj : TExpr; fld : IField; }
+ | PropertyMember(obj, mem : IMember) => // { obj : TExpr; prop : IProperty; }
+
+ Go(obj);
+
+ when (!stop && IsIn(expression.Location))
+ checkObject(expression.Location, mem);
+
+ | Block (_, e) // { jump_out : LocalValue; body : TExpr; }
+ | Throw (e) // { exn : TExpr; }
+ | TypeConversion(e, _, _) // { mutable expr : TExpr; target_type : TyVar; kind : ConversionKind; }
+ | Label (_, e) => // { id : int; body : TExpr; }
+
+ Go(e);
+
+ | Call as call => // { mutable func : TExpr; mutable parms : list [Parm]; mutable is_tail : bool; }
+
+ foreach (parm in call.parms)
+ Go(parm.expr);
+
+ Go(call.func);
+
+ | Try(body, cases) => // { body : TExpr; mutable cases : list [Try_case]; }
+
+ def walkTry_case(cases)
+ {
+ | Try_case.Fault(handler) :: tail // { handler : TExpr; }
+ | Catch(_, handler) :: tail => // { exn : LocalValue; handler : TExpr; }
+
+ Go(handler);
+ walkTry_case(tail)
+
+ | Filter(_, filter, handler) :: tail => // { exn : LocalValue; filter : TExpr; handler : TExpr; }
+
+ Go(filter);
+ Go(handler);
+ walkTry_case(tail)
+
+ | [] => ()
+ }
+
+ Go(body);
+ walkTry_case(cases);
+
+ | DefValIn(name, val, body) => // { name : LocalValue; val : TExpr; mutable body : TExpr; }
+
+ Go(val);
+ checkLocated(name);
+
+ unless (body == null)
+ Go(body);
+
+ | Assign (e1, e2) // { target : TExpr; source : TExpr; }
+ | TryFinally(e1, e2) // { body : TExpr; handler : TExpr; }
+ | Sequence (e1, e2) => // { mutable e1 : TExpr; mutable e2 : TExpr; }
+
+ Go(e1);
+ Go(e2);
+
+ | Tuple(args) => // { args : list [TExpr]; }
+
+ args.Iter(Go);
+
+ | Array(args, dim) => // { args : list [TExpr]; dimensions : list [TExpr]; }
+
+ args.Iter(Go);
+ dim. Iter(Go);
+
+ | ArrayIndexer(obj, args) => // { obj : TExpr; args : list [TExpr]; }
+
+ Go(obj);
+ args.Iter(Go);
+
+ | TupleIndexer(obj, _, _) => // { obj : TExpr; pos : int; len : int; } // 0-based
+
+ Go(obj);
+
+ //// invalid after T2
+ | Delayed(susp) => // { susp : Typer.DelayedTyping; }
+
+ unless (susp.IsResolved)
+ susp.Resolve();
+
+ when (susp.IsResolved)
+ Go(susp.ResolutionResult);
+
+ //// invalid after T3
+ | DefFunctionsIn as dfun => // { funs : list [Fun_header]; mutable body : TExpr; }
+
+ foreach (f in dfun.funs)
+ {
+ if (IsIn(f.Location))
+ {
+ foreach (p in f.parms)
+ checkObject(p.Location, p.decl);
+
+ checkLocated(f);
+ }
+ else
+ {
+ match (f.body)
+ {
+ | Typed(expr) => Go(expr);
+ | _ => ();
+ }
+ }
+
+ when (stop)
+ break;
+ }
+
+ unless (stop)
+ Go(dfun.body);
+
+ | Match as m => // { expr : TExpr; cases : list [Match_case]; }
+
+ Go(m.expr);
+
+ unless (stop) foreach (c in m.cases)
+ {
+ foreach ((pattern, pexpr, assigns) in c.patterns)
+ {
+ DoPattern(pattern);
+
+ unless (stop)
+ {
+ Go(pexpr);
+
+ foreach ((_localValue, aexpr) in assigns)
+ Go(aexpr);
+ }
+
+ when (stop)
+ break;
+ }
+
+ Go(c.body);
+
+ when (stop)
+ break;
+ }
+
+ | If as eif => // { cond : TExpr; e_then : TExpr; e_else : TExpr; }
+
+ Go(eif.cond);
+ Go(eif.e_then);
+ Go(eif.e_else);
+
+ | Switch as e_switch => // { indexing_expr : TExpr; default : option [TExpr]; cases : list [int * TExpr]; }
+
+ Go(e_switch.indexing_expr);
+
+ match (e_switch.default)
+ {
+ | Some(expr) => Go(expr)
+ | _ => ()
+ }
+
+ foreach ((_, expr) in e_switch.cases)
+ Go(expr);
+
+ | HasType as ht => // { expr : TExpr; test_ty : MType; }
+
+ Go(ht.expr);
+ checkObject(ht.Location, ht.test_ty);
+
+ | TypeOf as to => // { target_type : TyVar; }
+
+ checkObject(to.Location, to.target_type);
+
+ | SelfTailCall // { parms : list [Parm]; }
+ | MethodAddress // { from : TyVar; meth : IMethod; is_virt : bool; type_parms : list [TyVar]; }
+ | MultipleAssign // { assigns : list [LocalValue * TExpr]; }
+ | _ =>
+
+ not_impl();
+
+ }
+
+ counter--;
+ }
+
+ Go(root);
+
+ (retLocation, retObject)
+ }
+ } // end class Project
+} // end namespace
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.overload.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.overload.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,168 @@
+using System.Diagnostics;
+using Nemerle.Assertions;
+using Nemerle.Collections;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+using SCG = System.Collections.Generic;
+
+using Nemerle.Compiler.Utils;
+//using Nemerle.Completion2;
+
+namespace Nemerle.Completion2
+{
+ public partial class Project
+ {
+ public static MakeOverloads(result : CompletionResult)
+ : array[object]
+ {
+ def IsPropertyAccessor(name)
+ {
+ name.StartsWith("get_") || name.StartsWith("set_")
+ }
+
+ def IsEventAccessor(name)
+ {
+ name.StartsWith("add_") || name.StartsWith("remove_")
+ }
+
+ def IsOperator(name)
+ {
+ name.StartsWith("op_")
+ }
+
+ def IsSpecialName(name)
+ {
+ name.StartsWith("value__")
+ }
+
+ def IsValid(member)
+ {
+ def name = member.Name.ToString();
+ !IsPropertyAccessor(name) && !IsEventAccessor(name)
+ && !IsOperator(name) && !IsSpecialName(name)
+ }
+
+ def overloadsMap = Hashtable.[string, SCG.List[IMember]]();
+ def overloads = SCG.List();
+
+ foreach (elem in result.Elems)
+ {
+ | Local (value) =>
+ def v = value;
+ def valKind = match (v.ValKind)
+ {
+ | Plain => "local variable"
+ | Function(_header, _uses_closure_of) => "function"//: Fun_header, list[Fun_header];
+ | FunParm(kind) =>
+ (if (kind == Typedtree.ParmKind.Normal) "" else kind.ToString().ToLower() + " ")
+ + "parametr"
+ | ExceptionValue => "exception value"
+ | PatternVariable => "pattern variable"
+ | BlockReturn => "block"
+ | ClosurisedThisPointer => "captured by closure"
+ | MacroRedirection => "macro" //{ subst : Parsetree.PExpr; }
+ };
+
+ def mutability = if (v.IsMutable) "mutable " else "";
+ def typeName = Engine.GetNameFromType(v.Type);
+
+ overloads.Add(CompletionElem(
+ (if (v.IsMutable) GlyphType.Field else GlyphType.Const) :> int,
+ value.Name,
+ $"$mutability$valKind of '$typeName' type",
+ null));
+
+ | Node (name, node) =>
+ overloads.Add(CompletionElem(name, node));
+
+ | Overloads (values) =>
+ foreach (overload in values)
+ {
+ def member = overload.Member;
+ when (IsValid(member))
+ {
+ def name = match (member.MemberType)
+ {
+ | Constructor => Engine.ReplaceSpecialName(member.DeclaringType.Name)
+ | _ => member.Name
+ }
+
+ def members = overloadsMap.GetValueOrDefault(name, () => SCG.List());
+ members.Add(member);
+ overloadsMap[name] = members;
+ }
+ }
+ }
+
+ //TODO: Đĺŕëčçîâŕňü ęîěëĺéřîí äë˙ ďđîńňđŕíńňâ čěĺí.
+ //TODO: Ďîďđŕâčňü ęîěďëĺéřîí äë˙ ęîíńňđóęňîđîâ.
+
+ foreach (x in overloadsMap)
+ overloads.Add(CompletionElem(GetGlyphIndex(x.Value[0]), x.Key, "", x.Value.ToArray()));
+
+ overloads.ToArray()
+ }
+
+ public static GetGlyphIndex(member : IMember) : int
+ {
+ def glyphType = match (member.GetKind ())
+ {
+ | Field => GlyphType.Field // IField
+ | Method(method) => // IMethod
+ match (method.GetFunKind())
+ {
+ | Method | BoundMethod | Function => GlyphType.Function
+ | Constructor | StaticConstructor => GlyphType.Class
+ }
+
+ | Property => GlyphType.Property // IProperty
+ | Type => GlyphType.Class // TypeInfo
+ | Event => GlyphType.Event // IEvent
+ | _ => GlyphType.Class
+ };
+
+ glyphType :> int;
+ }
+
+ //public static GetImageIndex([NotNull] member : IMember) : int
+ //{
+ // | _ is IField => (int)
+ // | _ is IEvent =>
+ // | _ is IMethod =>
+ // | _ is IProperty =>
+ // | _ is TypeInfo =>
+ // | _ => System.Exception("Invalid member type: " + member.GetType().Name);
+ //}
+
+ public static MakeName(overloadPossibility : OverloadPossibility)
+ : string
+ {
+ // Base copmletion logic
+ def MakeNameFromMember(member : IMember)
+ {
+ def name = match (member.MemberType)
+ {
+ | MemberTypes.Field => member.DeclaringType.Name.ToString()
+ | _ => member.Name.ToString();
+ }
+
+ match (member)
+ {
+ | typeInfo is TypeInfo => Engine.GetNameFromType(typeInfo.GetMemType())
+ | _ =>
+ if (name == ".ctor" || name == ".cctor")
+ member.DeclaringType.Name.ToString()
+ else
+ name
+ }
+ }
+
+ match (overloadPossibility)
+ {
+ | local is LocalValueCompletionPossibility => local.Value.Name
+ | _ => MakeNameFromMember(overloadPossibility.Member)
+ }
+ }
+ } // end class Project
+} // end namespace
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,248 @@
+using System;
+
+using Nemerle.Utility;
+using Nemerle.Compiler;
+using Nemerle.Imperative;
+using Nemerle.Compiler.Typedtree;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.IO;
+
+namespace Nemerle.Completion2
+{
+ //[Record]
+ public class QuickTipInfo
+ {
+ [Accessor] mutable _text : string;
+ [Accessor] mutable _lineStart : int;
+ [Accessor] mutable _lineEnd : int;
+ [Accessor] mutable _colStart : int;
+ [Accessor] mutable _colEnd : int;
+
+ public this(prefix : string, names : list[string], locations : list[Location])
+ {
+ _text = prefix + " " + names.ToString(".");
+
+ match (locations)
+ {
+ | [] => ()
+ | first :: [] => SetLocation (first);
+ | first :: tail => SetStartEndLocation(first, tail.Last);
+ }
+ }
+
+ public this(location : Location, member : IMember)
+ {
+ SetLocation (location);
+ SetMemberText(member);
+ }
+
+ public this(location : Location, value : LocalValue)
+ {
+ SetLocation(location);
+ SetText (value);
+ }
+
+ public this(location : Location, tv : TyVar)
+ {
+ SetLocation(location);
+
+ match (tv)
+ {
+ | mt is MType => SetText(mt);
+ | _ => _text = tv.ToString();
+ }
+ }
+
+ public this(location : Location, fh : Typedtree.Fun_header)
+ {
+ match (fh.parms)
+ {
+ | head :: _ => SetStartStartLocation(location, head.Location);
+ | [] => SetLocation (location);
+ }
+
+ _text = sprintf("(%s) %s(", GetKindText(fh.decl), fh.name);
+ _text += fh.parms.Map(p => p.Name + " : " + p.ty.ToDisplayString()).ToString(", ");
+ _text += ") : " + fh.ret_type.ToDisplayString();
+ }
+
+ public this(location : Location, mc : PExpr.MacroCall, texpr : TExpr)
+ {
+ SetLocation(location);
+
+ _text = "macro " + mc.ns.GetDisplayName ();
+
+ match (mc.ns.Value)
+ {
+ | MacroCall(m) =>
+
+ match (m.Keywords)
+ {
+ | [] => ()
+ | _ => _text += "\n\nKeywords:\n " + m.Keywords.ToString(", ");
+ }
+ | _ => ()
+ }
+
+ _text += "\n\n" + texpr.ToString();
+ }
+
+ private SetLocation(location : Location) : void
+ {
+ _lineStart = location.Line - 1;
+ _colStart = location.Column - 1;
+ _lineEnd = location.EndLine - 1;
+ _colEnd = location.EndColumn - 1;
+ }
+
+ private SetStartEndLocation(l1 : Location, l2 : Location) : void
+ {
+ _lineStart = l1.Line - 1;
+ _colStart = l1.Column - 1;
+ _lineEnd = l2.EndLine - 1;
+ _colEnd = l2.EndColumn - 1;
+ }
+
+ private SetStartStartLocation(l1 : Location, l2 : Location) : void
+ {
+ _lineStart = l1.Line - 1;
+ _colStart = l1.Column - 1;
+ _lineEnd = l2.Line - 1;
+ _colEnd = l2.Column - 1;
+ }
+
+ private GetKindText(value : LocalValue) : string
+ {
+ mutable kind = value.ValKind.ToString();
+
+ when (kind.StartsWith("a "))
+ kind = kind.Substring(2);
+
+ when (value.IsMutable)
+ kind = "mutable " + kind;
+
+ return kind;
+ }
+
+ private GetAttributeText(attrs : NemerleAttributes) : string
+ {
+ mutable s = "";
+
+ when (attrs %&& NemerleAttributes.Public) s += "public ";
+ when (attrs %&& NemerleAttributes.Private) s += "private ";
+ when (attrs %&& NemerleAttributes.Protected) s += "protected ";
+ when (attrs %&& NemerleAttributes.Internal) s += "internal ";
+ when (attrs %&& NemerleAttributes.New) s += "new ";
+ when (attrs %&& NemerleAttributes.Abstract) s += "abstract ";
+ when (attrs %&& NemerleAttributes.Virtual) s += "virtual ";
+ when (attrs %&& NemerleAttributes.Override) s += "override ";
+ when (attrs %&& NemerleAttributes.Sealed) s += "sealed ";
+ when (attrs %&& NemerleAttributes.Static) s += "static ";
+
+ /*
+ | Mutable = 0x00100
+ | Struct = 0x01000
+ | Macro = 0x02000
+ | Volatile = 0x04000
+ | SpecialName = 0x08000
+ | Partial = 0x10000
+ | Extern = 0x20000
+ | CompilerMutable = 0x40000 // field is immutable, but compiler overrides it and can assign something
+ */
+
+ return s;
+ }
+
+ private GetLocationText(location : Location) : string
+ {
+ if (string.IsNullOrEmpty(location.File))
+ ""
+ else if (location.Line == 0)
+ "\n\n" + location.File
+ else
+ "\n\n" + location.ToString();
+ }
+
+ private SetMemberText(member : IMember) : void
+ {
+ mutable name = match (member)
+ {
+ | ti is TypeInfo => match (ti.GetTydecl())
+ {
+ | VariantOption => "variant option "
+ | Variant => "variant "
+ | _ => ""
+ }
+ | _ => ""
+ }
+
+ name += member.ToString();
+
+ when (name.IndexOf(" `") > 0)
+ {
+ name = name.Replace(" `", " ");
+
+ when (name.EndsWith("'"))
+ name = name.Substring(0, name.Length - 1);
+ }
+
+ _text = GetAttributeText(member.Attributes) + name;
+
+ match (member)
+ {
+ | _ is IProperty
+ | _ is IField => _text += " : " + member.GetMemType().ToString();
+ | _ => ()
+ }
+
+ _text += GetLocationText(member.Location);
+ }
+
+ private SetText(value : LocalValue) : void
+ {
+ _text = sprintf("(%s) %s%s",
+ GetKindText(value),
+ value.Name,
+ match (value.ValKind)
+ {
+ | Function => value.Type.ToMethodDefinitionString()
+ | _ => " : " + value.Type.ToDisplayString()
+ });
+
+ def definedIn = value.DefinedIn.ToString();
+
+ foreach (use in value.UsedIn)
+ {
+ when (use.ToString() != definedIn)
+ {
+ _text += $"\ndefined in $definedIn";
+ break;
+ }
+ }
+ }
+
+ private SetText(mtype : MType) : void
+ {
+ match (mtype)
+ {
+ | Class(tycon, _) =>
+
+ _text = GetAttributeText(tycon.Attributes);
+
+ _text += match (tycon.GetTydecl())
+ {
+ | VariantOption => "variant option"
+ | Variant => "variant"
+ | Class => if (tycon.Attributes %&& NemerleAttributes.Struct) "struct" else "class"
+ | Alias => "alias"
+ | Interface => "interface"
+ | Enum => "enum"
+ }
+
+ _text += " " + tycon.FullName + GetLocationText(tycon.Location);
+
+ | _ => _text += mtype.ToString()
+ }
+ }
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,12 @@
+using Nemerle.Collections;
+using Nemerle.Compiler;
+
+namespace Nemerle.Completion2
+{
+ public class CompilerMessage
+ {
+ public mutable Message : string;
+ public mutable Location : Location;
+ public mutable MessageKind : MessageKind;
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Decl.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Decl.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,46 @@
+using Nemerle.Compiler;
+using Nemerle.Utility;
+
+namespace Nemerle.Completion2
+{
+ [Record]
+ public variant Decl
+ {
+ | GlobalAttribute { }
+ | Using
+ {
+ Name : list [string];
+ NameLocations : list [Location];
+ Alias : string;
+ AliasLocation : Location;
+ BeforeEnv : GlobalEnv;
+ AfterEnv : GlobalEnv;
+ }
+ | Namespace
+ {
+ mutable Decls : list[Decl];
+ Name : list [string];
+ NameLocations : list [Location];
+ OutsideEnv : GlobalEnv;
+ InsideEnv : GlobalEnv;
+ BodyLocation : Location;
+ }
+ | Type { Builder : TypeBuilder; }
+ | None
+
+ [Accessor]
+ _location : Location;
+
+ public override ToString() : string
+ {
+ match (this)
+ {
+ | GlobalAttribute => "<attribute>"
+ | Using as decl => "using " + decl.Name.ToString(".") + ";"
+ | Namespace as decl => "namespace " + decl.Name.ToString(".") + " { ... }"
+ | None => "<none>"
+ | Type(typeBuilder) => typeBuilder.ToString()
+ }
+ }
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/DefineCollection.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,67 @@
+using System;
+using Nemerle.Assertions;
+using Nemerle.Collections;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Utility;
+
+using Typed = Nemerle.Compiler.Typedtree;
+using SR = System.Reflection;
+
+namespace Nemerle.Completion2
+{
+ public class DefineCollection
+ : System.Collections.Generic.IEnumerable [string]
+ {
+ internal this (eng : Engine)
+ {
+ _defines = [];
+ _engine = eng;
+ }
+
+ internal mutable _defines : list[string];
+ _engine : Engine;
+
+ public Add (define : string) : void
+ {
+ unless (_defines.Contains (define))
+ {
+ _defines ::= define;
+ _engine.Options.DefineConstant (define);
+ _engine.Sources.set_unparsed_state ();
+ }
+ }
+
+ public Remove (define : string) : void
+ {
+ when (_defines.Contains (define))
+ {
+ _ = _defines.Remove (define);
+ _engine.Options.UndefineConstant (define);
+ _engine.Sources.set_unparsed_state ();
+ }
+ }
+
+ public Contains (define : string) : bool
+ {
+ _defines.Contains (define)
+ }
+
+ public Clear () : void
+ {
+ unless (_defines.Length == 0)
+ {
+ foreach (define in _defines)
+ _engine.Options.UndefineConstant (define);
+ _defines = [];
+ _engine.Sources.set_unparsed_state();
+ }
+ }
+
+ public GetEnumerator () : Nemerle.Collections.IEnumerator[string]
+ {
+ Nemerle.Collections.ListEnumerator (_defines)
+ }
+ }
+} // end namespace
+
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/CompletionElem.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,83 @@
+using System;
+using System.Diagnostics;
+using Nemerle.Assertions;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Imperative;
+using Nemerle.Utility;
+
+using Nemerle.Compiler.Utils;
+using Typed = Nemerle.Compiler.Typedtree;
+
+namespace Nemerle.Completion2
+{
+ [Record]
+ public class CompletionElem
+ {
+ [Accessor] _glyphType : int;
+ [Accessor] _displayName : string;
+ [Accessor] _info : string;
+ [Accessor] _overloads : array[IMember];
+
+ public this (name : string, node : NamespaceTree.Node)
+ {
+ node.EnsureCached();
+ _displayName = name;
+ _info = "";
+
+ match (node.Value) // : NamespaceTree.TypeInfoCache
+ {
+ // TypeInfo loaded or parsed
+ | Cached(ty) => _glyphType = GlyphIndexFromTypeDecl(ty.GetTydecl());
+ // ambiguous TypeInfo loaded or parsed
+ | CachedAmbiguous(_typeInfos) => _glyphType = GlyphType.Snippet :> int;
+ // TypeInfo of external type not yet loaded
+ | NotLoaded(extType) => _glyphType = GlyphIndexFromSysType(extType.SystemType);
+ | NotLoadedList(_extTypes) => _glyphType = GlyphType.Snippet :> int;
+ | NamespaceReference => _glyphType = GlyphType.Namespace :> int;
+ | MacroCall => _glyphType = GlyphType.Macro :> int;
+ | No => throw ArgumentException("Tish function can't process nade wich value is No!")
+ }
+ }
+
+ GlyphIndexFromSysType(sysType : Type) : int
+ {
+ def result =
+ if (sysType.IsInterface) GlyphType.Interface
+ else if (sysType.IsEnum ) GlyphType.Enum
+ else if (sysType.IsSubclassOf(Const.DelegateType)) GlyphType.Delegate
+ else if (IsVariantType(sysType)) GlyphType.Variant
+ else if (IsVariantOptionType(sysType)) GlyphType.VariantOption
+ else GlyphType.Class;
+
+ result :> int;
+ }
+
+ GlyphIndexFromTypeDecl(typeDecl : Typedtree.TypeDeclaration) : int
+ {
+ def result = match (typeDecl)
+ {
+ | Class => GlyphType.Class
+ | Alias => GlyphType.Class //{ ty : MType; }
+ | Interface => GlyphType.Interface
+ | Variant => GlyphType.Variant //{ members : list [TypeInfo]; }
+ | VariantOption => GlyphType.VariantOption
+ | Enum => GlyphType.Enum
+ };
+
+ result :> int;
+ }
+
+ public override ToString() : string { _displayName }
+
+ public static IsVariantType(sysType : Type) : bool
+ {
+ sysType.GetCustomAttributes(Const.VariantType, false).Length == 1
+ }
+
+ public static IsVariantOptionType(sysType : Type) : bool
+ {
+ sysType.GetCustomAttributes(Const.VariantOptionType, false).Length == 1
+ }
+ }
+}
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n Wed Aug 16 05:38:15 2006
@@ -0,0 +1,190 @@
+using System;
+using System.IO;
+using System.Diagnostics;
+using SCG = System.Collections.Generic;
+using Nemerle.Assertions;
+using Nemerle.Collections;
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Imperative;
+using Nemerle.Utility;
+
+using Nemerle.Compiler.Utils;
+using Typed = Nemerle.Compiler.Typedtree;
+using SR = System.Reflection;
+
+namespace Nemerle.Completion2
+{
+ public delegate CompletionStageHandler (node : TypeInfo) : bool;
+
+ public partial class Engine : ManagerClass
+ {
+ /// Make typed tree and constryct compile unit collection.
+ public GetProject () : Project
+ {
+ Instance = this;
+ Init ();
+
+ // lexing of the NotParsed files
+ // we save the parsed files to improve performance
+
+ this.Hierarchy = TypesManager (this);
+
+ mutable trees = [];
+ try
+ {
+ foreach ((filePath, fileInfo) in Sources._sources.KeyValuePairs)
+ {
+ match (fileInfo)
+ {
+ | NotParsed as np =>
+ _fileIndex = Location.GetFileIndex(filePath);
+ BeginParseFile(_fileIndex);
+ try
+ {
+ def lexer = LexerString (this, np.code, Location(_fileIndex, 1, 1));
+ def decls = ParsingPipeline (lexer);
+ Sources._sources[filePath] = ParsedFile.Parsed (decls, np.code);
+ trees ::= decls;
+ }
+ finally { EndParseFile(_fileIndex); }
+ | Parsed as p => trees ::= p.decls;
+ }
+ }
+ }
+ catch { | _e => Trace.WriteLine(_e); }
+
+ // create N.C.TypeBuilders for all parsed types and add them to namespace hierarchy
+ try
+ {
+ foreach (group in trees)
+ foreach (topDecl in group)
+ ScanningPipeline(topDecl);
+ }
+ catch { | _e => Trace.WriteLine(_e); }
+
+ // xz. Âđîäĺ ęŕę çŕíčěŕĺňń˙ ďîńňđîĺíčĺě ĺäčíîăî äĺđĺâŕ ňčďîâ č đŕçđĺřĺíč˙ ńńűëîę.
+ try { this.Hierarchy.Run(); }
+ catch { | _e => Trace.WriteLine(_e); }
+
+ def nsTree = NameTree.NamespaceTree;
+
+ /// Ďđîáĺăŕĺňń˙ ďî ďđîńňđŕíńňâŕě čěĺí äë˙ ęŕćäîăî ôŕéëŕ
+ def AddTypeBilders(@namespace, index, nsTree)
+ {
+ def node = @namespace.InsideEnv.CurrentNamespace;
+
+ foreach (subNs is Decl.Namespace in @namespace.Decls)
+ AddTypeBilders(subNs, index, nsTree);
+
+ when (node.Children != null)
+ foreach (subNode in node.Children.Values)
+ match (subNode.Value)
+ {
+ | Cached(tc) =>//TypeInfoCache.
+ match (tc)
+ {
+ | tb is TypeBuilder =>
+ def tb = tb;
+
+ //FixMe: match (tb.PartsLocation.Find(loc => loc.FileIndex == index))
+ // unresolved expression: accessing member `FileIndex' in `loc' : Nemerle.Compiler.Location
+ // at Nemerle.Compiler.Typer2.Unfold(TExpr ex