[svn] r5893: corsavy-addin: . trunk trunk/Configuration trunk/Configuration/AssemblyInfo.cs trunk/NemerleB...

malekith svnadmin at nemerle.org
Sat Nov 5 23:41:51 CET 2005


Log:
Initial, based on CSharpAddin.

Author: malekith
Date: Sat Nov  5 23:41:47 2005
New Revision: 5893

Added:
   corsavy-addin/
   corsavy-addin/trunk/
   corsavy-addin/trunk/Configuration/
   corsavy-addin/trunk/Configuration/AssemblyInfo.cs
   corsavy-addin/trunk/NemerleBinding.addin
   corsavy-addin/trunk/NemerleBinding.csproj
   corsavy-addin/trunk/NemerleBinding.sln   (contents, props changed)
   corsavy-addin/trunk/Resources/
   corsavy-addin/trunk/Resources/BuildOptions.xfrm
   corsavy-addin/trunk/Src/
   corsavy-addin/trunk/Src/EventHandlerCompletitionDataProvider.cs
   corsavy-addin/trunk/Src/FormattingStrategy/
   corsavy-addin/trunk/Src/FormattingStrategy/DocumentAccessor.cs
   corsavy-addin/trunk/Src/FormattingStrategy/Indentation.cs
   corsavy-addin/trunk/Src/FormattingStrategy/NemerleFormattingStrategy.cs
   corsavy-addin/trunk/Src/NemerleAmbience.cs
   corsavy-addin/trunk/Src/NemerleBindingExecutionManager.cs
   corsavy-addin/trunk/Src/NemerleCompletionBinding.cs
   corsavy-addin/trunk/Src/NemerleLanguageBinding.cs
   corsavy-addin/trunk/Src/OptionPanels/
   corsavy-addin/trunk/Src/OptionPanels/BuildOptions.cs
   corsavy-addin/trunk/Src/Project/
   corsavy-addin/trunk/Src/Project/NemerleProject.cs
   corsavy-addin/trunk/obj/
   corsavy-addin/trunk/svn-commit.tmp

Added: corsavy-addin/trunk/Configuration/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Configuration/AssemblyInfo.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,38 @@
+ďťż// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="none" email=""/>
+//     <version>$Revision: 350 $</version>
+// </file>
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("NemerleBinding")]
+[assembly: AssemblyDescription("Nemerle language binding for #develop")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("nemerle.org")]
+[assembly: AssemblyProduct("SharpDevelop")]
+[assembly: AssemblyCopyright("(c) 2004-2005 Mike KrĂźger, 2005 Daniel Grunwald, 2005 Kamil Skalski, Michal Moskal")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("2.0.0.1")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]

Added: corsavy-addin/trunk/NemerleBinding.addin
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/NemerleBinding.addin	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,86 @@
+<AddIn name        = "Nemerle Binding"
+       author      = "Kamil Skalski, Michal Moskal, Mike Krueger"
+       copyright   = "GPL"
+       url         = "http://nemerle.org"
+       description = "Backing binding for Nemerle"
+       version     = "1.0.0">
+	
+	<Runtime>
+		<Import assembly = "NemerleBinding.dll"/>
+		<Import assembly = ":ICSharpCode.SharpDevelop"/>
+	</Runtime>
+	
+	<Path name = "/SharpDevelop/Workbench/Ambiences">
+		<Class id    = "Nemerle"
+		       class = "NemerleAmbience"/>
+	</Path>
+	
+	<Path name = "/SharpDevelop/Workbench/FileFilter">
+		<FileFilter id = "Nemerle"
+		            insertbefore="AllFiles"
+		            name = "Nemerle files (*.n)"
+		            extensions = "*.n"/>
+	</Path>
+	
+	<!--
+	<Path name = "/Workspace/Parser">
+		<Parser id    = "Nemerle"
+		        supportedextensions  = ".cs"
+		        projectfileextension = ".csproj"
+		        class = "NemerleBinding.Parser.TParser"/>
+	</Path>
+
+	<Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
+		<CodeCompletionBinding id = "Nemerle" extensions = ".n" class = "NemerleBinding.NemerleCompletionBinding"/>
+	</Path>
+	-->
+	
+	<Path path = "/SharpDevelop/BackendBindings/ProjectOptions/Nemerle">
+		<DialogPanel id    = "Application"
+		             label = "${res:Dialog.ProjectOptions.ApplicationSettings}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ApplicationSettings"/>
+		<DialogPanel id    = "ReferencePaths"
+		             label = "${res:Dialog.ProjectOptions.ReferencePaths}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ReferencePaths"/>
+		<DialogPanel id    = "Signing"
+		             label = "${res:Dialog.ProjectOptions.Signing}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.Signing"/>
+		<DialogPanel id    = "BuildEvents"
+		             label = "${res:Dialog.ProjectOptions.BuildEvents}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
+		<DialogPanel id    = "BuildOptions"
+		             label = "${res:Dialog.ProjectOptions.BuildOptions}"
+		             class = "CSharpBinding.OptionPanels.BuildOptions"/>
+		<DialogPanel id    = "DebugOptions"
+		             label = "${res:Dialog.ProjectOptions.DebugOptions}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
+		<DialogPanel id    = "Publish"
+		             label = "${res:Dialog.ProjectOptions.Publish}"
+		             class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.Publish"/>
+	</Path>
+	
+	<!--
+	<Path name = "/AddIns/DefaultTextEditor/Formatter/Nemerle">
+		<Class id ="NemerleFormatter" class = "NemerleBinding.FormattingStrategy.NemerleFormattingStrategy"/>
+	</Path>
+	-->
+	
+	<Path name = "/Workspace/Icons">
+		<!-- Nemerle -->
+		<Icon id         = "NemerlePrj"
+		      language   = "Nemerle"
+		      resource   = "Nemerle.ProjectIcon"/>
+		
+		<Icon id         = "NemerleFile"
+		      extensions = ".n"
+		      resource   = "Nemerle.FileIcon"/>
+	</Path>
+	
+	<Path path = "/SharpDevelop/Workbench/LanguageBindings">
+		<LanguageBinding id                   = "Nemerle"
+		                 guid                 = "{EE063E9F-4091-4163-AC1C-2CE2079D61A5}"
+		                 supportedextensions  = ".n"
+		                 projectfileextension = ".csproj"
+		                 class                = "NemerleBinding.NemerleLanguageBinding" />
+	</Path>
+</AddIn>

Added: corsavy-addin/trunk/NemerleBinding.csproj
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/NemerleBinding.csproj	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,67 @@
+ďťż<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.50215</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{431983BC-B264-4D2B-A598-944807ED72D6}</ProjectGuid>
+    <AssemblyName>NemerleBinding</AssemblyName>
+    <OutputTarget>Library</OutputTarget>
+    <NoStdLib>False</NoStdLib>
+    <NoConfig>False</NoConfig>
+    <RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
+    <OutputType>Library</OutputType>
+    <AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>Full</DebugType>
+    <Optimize>False</Optimize>
+    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+    <OutputPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\CSharpBinding\</OutputPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugSymbols>False</DebugSymbols>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+    <OutputPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\CSharpBinding\</OutputPath>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.XML" />
+    <Reference Include="ICSharpCode.Core">
+      <HintPath>..\trunk\SharpDevelop\bin\ICSharpCode.Core.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="ICSharpCode.TextEditor">
+      <HintPath>..\trunk\SharpDevelop\bin\ICSharpCode.TextEditor.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="ICSharpCode.SharpDevelop">
+      <HintPath>..\trunk\SharpDevelop\bin\ICSharpCode.SharpDevelop.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Configuration\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Resources\BuildOptions.xfrm" />
+    <Compile Include="Src\NemerleAmbience.cs" />
+    <Compile Include="Src\NemerleBindingExecutionManager.cs" />
+    <Compile Include="Src\NemerleLanguageBinding.cs" />
+    <Compile Include="Src\FormattingStrategy\NemerleFormattingStrategy.cs" />
+    <Compile Include="Src\FormattingStrategy\DocumentAccessor.cs" />
+    <Compile Include="Src\FormattingStrategy\Indentation.cs" />
+    <Compile Include="Src\OptionPanels\BuildOptions.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Src\Project\NemerleProject.cs" />
+    <None Include="NemerleBinding.addin">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <Compile Include="Src\EventHandlerCompletitionDataProvider.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+</Project>
\ No newline at end of file

Added: corsavy-addin/trunk/NemerleBinding.sln
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/NemerleBinding.sln	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,16 @@
+ďťżMicrosoft Visual Studio Solution File, Format Version 9.00
+# SharpDevelop 2.0.0.9999
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NemerleBinding", "NemerleBinding.csproj", "{431983BC-B264-4D2B-A598-944807ED72D6}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{431983BC-B264-4D2B-A598-944807ED72D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{431983BC-B264-4D2B-A598-944807ED72D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{431983BC-B264-4D2B-A598-944807ED72D6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{431983BC-B264-4D2B-A598-944807ED72D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+EndGlobal

Added: corsavy-addin/trunk/Resources/BuildOptions.xfrm
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Resources/BuildOptions.xfrm	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,313 @@
+<Components version="1.0">
+  <System.Windows.Forms.UserControl>
+    <Name value="XmlUserControl1" />
+    <ClientSize value="{Width=527, Height=657}" />
+    <AutoScroll value="True" />
+    <Controls>
+      <System.Windows.Forms.GroupBox>
+        <Name value="generalGroupBox" />
+        <Location value="{X=3,Y=3}" />
+        <Text value="${res:Dialog.ProjectOptions.BuildOptions.General}" />
+        <Size value="{Width=521, Height=152}" />
+        <TabIndex value="0" />
+        <Anchor value="Top, Left, Right" />
+        <Controls>
+          <System.Windows.Forms.CheckBox>
+            <Name value="noCorlibCheckBox" />
+            <Location value="{X=12,Y=124}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <Text value="${res:Dialog.ProjectOptions.BuildOptions.NoCorlib}" />
+            <TabIndex value="5" />
+            <Size value="{Width=503, Height=24}" />
+          </System.Windows.Forms.CheckBox>
+          <System.Windows.Forms.CheckBox>
+            <Name value="checkForOverflowCheckBox" />
+            <Location value="{X=12,Y=104}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <Text value="${res:Dialog.ProjectOptions.BuildOptions.CheckForOverflow}" />
+            <TabIndex value="4" />
+            <Size value="{Width=502, Height=24}" />
+          </System.Windows.Forms.CheckBox>
+          <System.Windows.Forms.Label>
+            <Name value="label1" />
+            <Location value="{X=6,Y=17}" />
+            <Text value="${res:Dialog.ProjectOptions.BuildOptions.ConditionalSymbols}" />
+            <TextAlign value="BottomLeft" />
+            <Size value="{Width=470, Height=16}" />
+            <TabIndex value="0" />
+            <Anchor value="Top, Left, Right" />
+          </System.Windows.Forms.Label>
+          <System.Windows.Forms.TextBox>
+            <Name value="conditionalSymbolsTextBox" />
+            <TabIndex value="1" />
+            <Anchor value="Top, Left, Right" />
+            <Size value="{Width=502, Height=21}" />
+            <Location value="{X=13,Y=36}" />
+          </System.Windows.Forms.TextBox>
+          <System.Windows.Forms.CheckBox>
+            <Name value="allowUnsafeCodeCheckBox" />
+            <Location value="{X=13,Y=84}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <Text value="${res:Dialog.ProjectOptions.BuildOptions.AllowUnsafeCode}" />
+            <TabIndex value="3" />
+            <Size value="{Width=502, Height=24}" />
+            <Anchor value="Top, Left, Right" />
+          </System.Windows.Forms.CheckBox>
+          <System.Windows.Forms.CheckBox>
+            <Name value="optimizeCodeCheckBox" />
+            <Location value="{X=13,Y=64}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <Text value="${res:Dialog.ProjectOptions.BuildOptions.OptimizeCode}" />
+            <TabIndex value="2" />
+            <Size value="{Width=502, Height=24}" />
+            <Anchor value="Top, Left, Right" />
+          </System.Windows.Forms.CheckBox>
+        </Controls>
+      </System.Windows.Forms.GroupBox>
+      <System.Windows.Forms.GroupBox>
+        <Name value="outputGroupBox" />
+        <Location value="{X=3,Y=161}" />
+        <Text value="${res:Dialog.ProjectOptions.Build.Output}" />
+        <Size value="{Width=521, Height=299}" />
+        <TabIndex value="1" />
+        <Anchor value="Top, Left, Right" />
+        <Controls>
+          <System.Windows.Forms.ComboBox>
+            <Name value="targetFrameworkComboBox" />
+            <TabIndex value="8" />
+            <Size value="{Width=121, Height=21}" />
+            <DropDownStyle value="DropDownList" />
+            <Location value="{X=164,Y=112}" />
+          </System.Windows.Forms.ComboBox>
+          <System.Windows.Forms.Label>
+            <Name value="targetFrameworkLabel" />
+            <Location value="{X=13,Y=112}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.TargetFramework}" />
+            <TextAlign value="MiddleRight" />
+            <Size value="{Width=150, Height=23}" />
+            <TabIndex value="7" />
+          </System.Windows.Forms.Label>
+          <System.Windows.Forms.GroupBox>
+            <Name value="advancedOutputGroupBox" />
+            <Location value="{X=6,Y=138}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.Advanced}" />
+            <Size value="{Width=505, Height=155}" />
+            <TabIndex value="9" />
+            <Anchor value="Top, Bottom, Left, Right" />
+            <Controls>
+              <System.Windows.Forms.ComboBox>
+                <Name value="targetCpuComboBox" />
+                <TabIndex value="4" />
+                <Size value="{Width=171, Height=21}" />
+                <FormattingEnabled value="True" />
+                <DropDownStyle value="DropDownList" />
+                <Location value="{X=193,Y=71}" />
+              </System.Windows.Forms.ComboBox>
+              <System.Windows.Forms.Label>
+                <Name value="label9" />
+                <Location value="{X=6,Y=69}" />
+                <Text value="${res:Dialog.ProjectOptions.Build.TargetCPU}" />
+                <TextAlign value="MiddleRight" />
+                <Size value="{Width=181, Height=23}" />
+                <TabIndex value="3" />
+              </System.Windows.Forms.Label>
+              <System.Windows.Forms.TextBox>
+                <Name value="dllBaseAddressTextBox" />
+                <TabIndex value="8" />
+                <Size value="{Width=121, Height=21}" />
+                <Location value="{X=193,Y=125}" />
+              </System.Windows.Forms.TextBox>
+              <System.Windows.Forms.Label>
+                <Name value="label8" />
+                <Location value="{X=7,Y=123}" />
+                <Text value="${res:Dialog.ProjectOptions.Build.DLLBaseAddress}" />
+                <TextAlign value="MiddleRight" />
+                <Size value="{Width=180, Height=23}" />
+                <TabIndex value="7" />
+              </System.Windows.Forms.Label>
+              <System.Windows.Forms.ComboBox>
+                <Name value="fileAlignmentComboBox" />
+                <TabIndex value="6" />
+                <Size value="{Width=171, Height=21}" />
+                <FormattingEnabled value="True" />
+                <DropDownStyle value="DropDownList" />
+                <Location value="{X=193,Y=98}" />
+              </System.Windows.Forms.ComboBox>
+              <System.Windows.Forms.Label>
+                <Name value="label7" />
+                <Location value="{X=6,Y=96}" />
+                <Text value="${res:Dialog.ProjectOptions.Build.FileAlignment}" />
+                <TextAlign value="MiddleRight" />
+                <Size value="{Width=181, Height=23}" />
+                <TabIndex value="5" />
+              </System.Windows.Forms.Label>
+              <System.Windows.Forms.CheckBox>
+                <Name value="registerCOMInteropCheckBox" />
+                <Location value="{X=175,Y=18}" />
+                <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+                <Text value="${res:Dialog.ProjectOptions.Build.RegisterForCOM}" />
+                <TabIndex value="0" />
+                <Size value="{Width=209, Height=20}" />
+                <Anchor value="Top, Left, Right" />
+              </System.Windows.Forms.CheckBox>
+              <System.Windows.Forms.Label>
+                <Name value="label2" />
+                <Location value="{X=6,Y=43}" />
+                <Text value="${res:Dialog.ProjectOptions.Build.GenerateSerializationAssembly}" />
+                <TextAlign value="MiddleRight" />
+                <Size value="{Width=181, Height=20}" />
+                <TabIndex value="1" />
+              </System.Windows.Forms.Label>
+              <System.Windows.Forms.ComboBox>
+                <Name value="generateSerializationAssemblyComboBox" />
+                <TabIndex value="2" />
+                <Size value="{Width=171, Height=21}" />
+                <FormattingEnabled value="True" />
+                <DropDownStyle value="DropDownList" />
+                <Location value="{X=193,Y=44}" />
+              </System.Windows.Forms.ComboBox>
+            </Controls>
+          </System.Windows.Forms.GroupBox>
+          <System.Windows.Forms.ComboBox>
+            <Name value="debugInfoComboBox" />
+            <TabIndex value="6" />
+            <Size value="{Width=121, Height=21}" />
+            <DropDownStyle value="DropDownList" />
+            <Location value="{X=164,Y=88}" />
+          </System.Windows.Forms.ComboBox>
+          <System.Windows.Forms.Label>
+            <Name value="debugInfoLabel" />
+            <Location value="{X=13,Y=86}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.DebugInfo}" />
+            <TextAlign value="MiddleRight" />
+            <Size value="{Width=145, Height=23}" />
+            <TabIndex value="5" />
+          </System.Windows.Forms.Label>
+          <System.Windows.Forms.CheckBox>
+            <Name value="xmlDocumentationCheckBox" />
+            <Location value="{X=13,Y=63}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <Text value="${res:Dialog.ProjectOptions.Build.XmlDocumentationFile}" />
+            <TabIndex value="3" />
+            <Size value="{Width=151, Height=20}" />
+          </System.Windows.Forms.CheckBox>
+          <System.Windows.Forms.TextBox>
+            <Name value="xmlDocumentationTextBox" />
+            <TabIndex value="4" />
+            <Anchor value="Top, Left, Right" />
+            <Size value="{Width=351, Height=21}" />
+            <Location value="{X=164,Y=62}" />
+          </System.Windows.Forms.TextBox>
+          <System.Windows.Forms.Label>
+            <Name value="label5" />
+            <Location value="{X=6,Y=17}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.OutputPath}" />
+            <TextAlign value="BottomLeft" />
+            <Size value="{Width=505, Height=16}" />
+            <TabIndex value="0" />
+            <Anchor value="Top, Left, Right" />
+          </System.Windows.Forms.Label>
+          <System.Windows.Forms.TextBox>
+            <Name value="outputPathTextBox" />
+            <TabIndex value="1" />
+            <Anchor value="Top, Left, Right" />
+            <Size value="{Width=457, Height=21}" />
+            <Location value="{X=13,Y=36}" />
+          </System.Windows.Forms.TextBox>
+          <System.Windows.Forms.Button>
+            <Name value="outputPathBrowseButton" />
+            <Location value="{X=475,Y=36}" />
+            <Text value="..." />
+            <Size value="{Width=40, Height=21}" />
+            <Anchor value="Top, Right" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <TabIndex value="2" />
+          </System.Windows.Forms.Button>
+        </Controls>
+      </System.Windows.Forms.GroupBox>
+      <System.Windows.Forms.GroupBox>
+        <Name value="treatWarningsAsErrorsGroupBox" />
+        <Location value="{X=3,Y=552}" />
+        <UseCompatibleTextRendering value="True" />
+        <Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors}" />
+        <Size value="{Width=521, Height=100}" />
+        <TabIndex value="3" />
+        <Anchor value="Top, Left, Right" />
+        <Controls>
+          <System.Windows.Forms.TextBox>
+            <Name value="specificWarningsTextBox" />
+            <TabIndex value="2" />
+            <Anchor value="Top, Left, Right" />
+            <Size value="{Width=377, Height=21}" />
+            <Location value="{X=136,Y=44}" />
+          </System.Windows.Forms.TextBox>
+          <System.Windows.Forms.RadioButton>
+            <Name value="allRadioButton" />
+            <Location value="{X=8,Y=68}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}" />
+            <Size value="{Width=128, Height=24}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <TabIndex value="3" />
+          </System.Windows.Forms.RadioButton>
+          <System.Windows.Forms.RadioButton>
+            <Name value="specificWarningsRadioButton" />
+            <Location value="{X=8,Y=44}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}" />
+            <Size value="{Width=128, Height=24}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <TabIndex value="1" />
+          </System.Windows.Forms.RadioButton>
+          <System.Windows.Forms.RadioButton>
+            <Name value="noneRadioButton" />
+            <Location value="{X=8,Y=20}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}" />
+            <Size value="{Width=128, Height=24}" />
+            <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
+            <TabIndex value="0" />
+          </System.Windows.Forms.RadioButton>
+        </Controls>
+      </System.Windows.Forms.GroupBox>
+      <System.Windows.Forms.GroupBox>
+        <Name value="warningsGroupBox" />
+        <Location value="{X=3,Y=466}" />
+        <Text value="${res:Dialog.ProjectOptions.Build.ErrorsAndWarnings}" />
+        <Size value="{Width=521, Height=80}" />
+        <TabIndex value="2" />
+        <Anchor value="Top, Left, Right" />
+        <Controls>
+          <System.Windows.Forms.TextBox>
+            <Name value="suppressWarningsTextBox" />
+            <TabIndex value="3" />
+            <Anchor value="Top, Left, Right" />
+            <Size value="{Width=349, Height=21}" />
+            <Location value="{X=164,Y=44}" />
+          </System.Windows.Forms.TextBox>
+          <System.Windows.Forms.Label>
+            <Name value="label4" />
+            <Location value="{X=4,Y=44}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.SuppressWarnings}" />
+            <TextAlign value="MiddleRight" />
+            <Size value="{Width=154, Height=23}" />
+            <TabIndex value="2" />
+          </System.Windows.Forms.Label>
+          <System.Windows.Forms.ComboBox>
+            <Name value="warningLevelComboBox" />
+            <TabIndex value="1" />
+            <Size value="{Width=60, Height=21}" />
+            <FormattingEnabled value="True" />
+            <DropDownStyle value="DropDownList" />
+            <Location value="{X=164,Y=20}" />
+          </System.Windows.Forms.ComboBox>
+          <System.Windows.Forms.Label>
+            <Name value="label3" />
+            <Location value="{X=4,Y=20}" />
+            <Text value="${res:Dialog.ProjectOptions.Build.WarningLevel}" />
+            <TextAlign value="MiddleRight" />
+            <Size value="{Width=154, Height=23}" />
+            <TabIndex value="0" />
+          </System.Windows.Forms.Label>
+        </Controls>
+      </System.Windows.Forms.GroupBox>
+    </Controls>
+  </System.Windows.Forms.UserControl>
+</Components>

Added: corsavy-addin/trunk/Src/EventHandlerCompletitionDataProvider.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/EventHandlerCompletitionDataProvider.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,121 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Markus Palme" email="MarkusPalme at gmx.de"/>
+//     <version>$Revision: 438 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using ICSharpCode.TextEditor;
+using ICSharpCode.Core;
+using ICSharpCode.TextEditor.Gui.CompletionWindow;
+using ICSharpCode.TextEditor.Document;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
+using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
+
+namespace NemerleBinding
+{
+	public class EventHandlerCompletitionDataProvider : AbstractCompletionDataProvider
+	{
+		string expression;
+		ResolveResult resolveResult;
+		IClass resolvedClass;
+		
+		public EventHandlerCompletitionDataProvider(string expression, ResolveResult resolveResult)
+		{
+			this.expression = expression;
+			this.resolveResult = resolveResult;
+			this.resolvedClass = resolveResult.ResolvedType.GetUnderlyingClass();
+		}
+		
+		/// <summary>
+		/// Generates the completion data. This method is called by the text editor control.
+		/// </summary>
+		public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
+		{
+			ArrayList completionData = new ArrayList();
+			completionData.Add(new DelegateCompletionData("new " + resolveResult.ResolvedType.Name + "();", 2,
+			                                              "delegate " + resolvedClass.FullyQualifiedName + "\n" + CodeCompletionData.GetDocumentation(resolvedClass.Documentation)));
+			completionData.Add(new DelegateCompletionData("delegate {  };", 3,
+			                                              "${res:NemerleBinding.InsertAnonymousMethod}"));
+			NemerleAmbience ambience = new NemerleAmbience();
+			ambience.ConversionFlags = ConversionFlags.ShowParameterNames;
+			IMethod invoke = resolvedClass.SearchMember("Invoke", LanguageProperties.CSharp) as IMethod;
+			if (invoke != null) {
+				StringBuilder builder = new StringBuilder("delegate(");
+				for (int i = 0; i < invoke.Parameters.Count; ++i) {
+					if (i > 0) {
+						builder.Append(", ");
+					}
+					builder.Append(ambience.Convert(invoke.Parameters[i]));
+				}
+				builder.Append(") {  };");
+				completionData.Add(new DelegateCompletionData(builder.ToString(), 3,
+				                                              "${res:NemerleBinding.InsertAnonymousMethodWithParameters}"));
+				IClass callingClass = resolveResult.CallingClass;
+				IClass eventReturnType = invoke.ReturnType.GetUnderlyingClass();
+				IClass[] eventParameters = new IClass[invoke.Parameters.Count];
+				for (int i = 0; i < eventParameters.Length; i++) {
+					eventParameters[i] = invoke.Parameters[i].ReturnType.GetUnderlyingClass();
+					if (eventParameters[i] == null) {
+						eventReturnType = null;
+						break;
+					}
+				}
+				if (callingClass != null && eventReturnType != null) {
+					bool inStatic = false;
+					if (resolveResult.CallingMember != null)
+						inStatic = resolveResult.CallingMember.IsStatic;
+					foreach (IMethod method in callingClass.DefaultReturnType.GetMethods()) {
+						if (inStatic && !method.IsStatic)
+							continue;
+						if (!method.IsAccessible(callingClass, true))
+							continue;
+						if (method.Parameters.Count != invoke.Parameters.Count)
+							continue;
+						// check return type compatibility:
+						IClass c2 = method.ReturnType.GetUnderlyingClass();
+						if (c2 == null || !c2.IsTypeInInheritanceTree(eventReturnType))
+							continue;
+						bool ok = true;
+						for (int i = 0; i < eventParameters.Length; i++) {
+							c2 = method.Parameters[i].ReturnType.GetUnderlyingClass();
+							if (c2 == null || !eventParameters[i].IsTypeInInheritanceTree(c2)) {
+								ok = false;
+								break;
+							}
+						}
+						if (ok) {
+							completionData.Add(new CodeCompletionData(method));
+						}
+					}
+				}
+			}
+			return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
+		}
+		
+		private class DelegateCompletionData : DefaultCompletionData
+		{
+			int cursorOffset;
+			
+			public DelegateCompletionData(string text, int cursorOffset, string documentation)
+				: base(text, StringParser.Parse(documentation), ClassBrowserIconService.DelegateIndex)
+			{
+				this.cursorOffset = cursorOffset;
+			}
+			
+			public override bool InsertAction(TextArea textArea, char ch)
+			{
+				bool r = base.InsertAction(textArea, ch);
+				textArea.Caret.Column -= cursorOffset;
+				return r;
+			}
+		}
+	}
+}

Added: corsavy-addin/trunk/Src/FormattingStrategy/DocumentAccessor.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/FormattingStrategy/DocumentAccessor.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,197 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Daniel Grunwald" email="daniel at danielgrunwald.de"/>
+//     <version>$Revision: 230 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.IO;
+
+using ICSharpCode.TextEditor;
+using ICSharpCode.TextEditor.Document;
+
+namespace NemerleBinding.FormattingStrategy
+{
+	/// <summary>
+	/// Interface used for the indentation class to access the document.
+	/// </summary>
+	public interface IDocumentAccessor
+	{
+		/// <summary>Gets if something was changed in the document.</summary>
+		bool Dirty { get; }
+		/// <summary>Gets if the current line is read only (because it is not in the
+		/// selected text region)</summary>
+		bool ReadOnly { get; }
+		/// <summary>Gets the number of the current line.</summary>
+		int LineNumber { get; }
+		/// <summary>Gets/Sets the text of the current line.</summary>
+		string Text { get; set; }
+		/// <summary>Advances to the next line.</summary>
+		bool Next();
+	}
+	
+	#region DocumentAccessor
+	public class DocumentAccessor : IDocumentAccessor
+	{
+		IDocument doc;
+		
+		int minLine;
+		int maxLine;
+		int changedLines = 0;
+		
+		public DocumentAccessor(IDocument document)
+		{
+			doc = document;
+			this.minLine = 0;
+			this.maxLine = doc.TotalNumberOfLines - 1;
+		}
+		
+		public DocumentAccessor(IDocument document, int minLine, int maxLine)
+		{
+			doc = document;
+			this.minLine = minLine;
+			this.maxLine = maxLine;
+		}
+		
+		int num = -1;
+		bool dirty;
+		string text;
+		LineSegment line;
+		
+		public bool ReadOnly {
+			get {
+				return num < minLine;
+			}
+		}
+		
+		public bool Dirty {
+			get {
+				return dirty;
+			}
+		}
+		
+		public int LineNumber {
+			get {
+				return num;
+			}
+		}
+		
+		public int ChangedLines {
+			get {
+				return changedLines;
+			}
+		}
+		
+		bool lineDirty = false;
+		
+		public string Text {
+			get { return text; }
+			set {
+				if (num < minLine) return;
+				text = value;
+				dirty = true;
+				lineDirty = true;
+			}
+		}
+		
+		public bool Next()
+		{
+			if (lineDirty) {
+				doc.Replace(line.Offset, line.Length, text);
+				lineDirty = false;
+				++changedLines;
+			}
+			++num;
+			if (num > maxLine) return false;
+			line = doc.GetLineSegment(num);
+			text = doc.GetText(line);
+			return true;
+		}
+	}
+	#endregion
+	
+	#region FileAccessor
+	public class FileAccessor : IDisposable, IDocumentAccessor
+	{
+		public bool Dirty {
+			get {
+				return dirty;
+			}
+		}
+		
+		public bool ReadOnly {
+			get {
+				return false;
+			}
+		}
+		
+		FileStream f;
+		StreamReader r;
+		ArrayList lines = new ArrayList();
+		bool dirty = false;
+		
+		System.Text.Encoding encoding;
+		
+		string filename;
+		public FileAccessor(string filename)
+		{
+			this.filename = filename;
+			f = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
+			// TODO: Auto-detect encoding
+			encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
+			r = new StreamReader(f, encoding);
+		}
+		
+		int num = 0;
+		
+		public int LineNumber {
+			get { return num; }
+		}
+		
+		
+		string text = "";
+		
+		public string Text {
+			get {
+				return text;
+			}
+			set {
+				dirty = true;
+				text = value;
+			}
+		}
+		
+		public bool Next()
+		{
+			if (num > 0) {
+				lines.Add(text);
+			}
+			text = r.ReadLine();
+			++num;
+			return text != null;
+		}
+		
+		void IDisposable.Dispose()
+		{
+			Close();
+		}
+		
+		public void Close()
+		{
+			r.Close();
+			f.Close();
+			if (dirty) {
+				f = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
+				using (StreamWriter w = new StreamWriter(f, encoding)) {
+					foreach (string line in lines) {
+						w.WriteLine(line);
+					}
+				}
+				f.Close();
+			}
+		}
+	}
+	#endregion
+}

Added: corsavy-addin/trunk/Src/FormattingStrategy/Indentation.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/FormattingStrategy/Indentation.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,386 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Daniel Grunwald" email="daniel at danielgrunwald.de"/>
+//     <version>$Revision: 230 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace NemerleBinding.FormattingStrategy
+{
+	public class IndentationSettings
+	{
+		public string IndentString = "\t";
+		/// <summary>Leave empty lines empty.</summary>
+		public bool LeaveEmptyLines = true;
+	}
+	
+	public class IndentationReformatter
+	{
+		public struct Block
+		{
+			public string OuterIndent;
+			public string InnerIndent;
+			public string LastWord;
+			public char Bracket;
+			public bool Continuation;
+			public bool OneLineBlock;
+			public int StartLine;
+			
+			public void Indent(IndentationSettings set)
+			{
+				Indent(set, set.IndentString);
+			}
+			
+			public void Indent(IndentationSettings set, string str)
+			{
+				OuterIndent = InnerIndent;
+				InnerIndent += str;
+				Continuation = false;
+				OneLineBlock = false;
+				LastWord = "";
+			}
+		}
+		
+		StringBuilder wordBuilder;
+		Stack blocks; // blocks contains all blocks outside of the current
+		Block block;  // block is the current block
+		
+		bool inString = false;
+		bool inChar   = false;
+		bool verbatim = false;
+		bool escape   = false;
+		
+		bool lineComment  = false;
+		bool blockComment = false;
+		
+		char lastRealChar = ' '; // last non-comment char
+		
+		public void Reformat(IDocumentAccessor doc, IndentationSettings set)
+		{
+			Init();
+			
+			while (doc.Next()) {
+				Step(doc, set);
+			}
+		}
+		
+		public void Init()
+		{
+			wordBuilder = new StringBuilder();
+			blocks = new Stack();
+			block = new Block();
+			block.InnerIndent = "";
+			block.OuterIndent = "";
+			block.Bracket = '{';
+			block.Continuation = false;
+			block.LastWord = "";
+			block.OneLineBlock = false;
+			block.StartLine = 0;
+			
+			inString = false;
+			inChar   = false;
+			verbatim = false;
+			escape   = false;
+			
+			lineComment  = false;
+			blockComment = false;
+			
+			lastRealChar = ' '; // last non-comment char
+		}
+		
+		public void Step(IDocumentAccessor doc, IndentationSettings set)
+		{
+			string line = doc.Text;
+			if (set.LeaveEmptyLines && line.Length == 0) return; // leave empty lines empty
+			line = line.TrimStart();
+			
+			StringBuilder indent = new StringBuilder();
+			if (line.Length == 0) {
+				// Special treatment for empty lines:
+				if (blockComment || (inString && verbatim))
+					return;
+				indent.Append(block.InnerIndent);
+				if (block.OneLineBlock)
+					indent.Append(set.IndentString);
+				if (block.Continuation)
+					indent.Append(set.IndentString);
+				if (doc.Text != indent.ToString())
+					doc.Text = indent.ToString();
+				return;
+			}
+			
+			if (TrimEnd(doc))
+				line = doc.Text.TrimStart();
+			
+			Block oldBlock = block;
+			bool startInComment = blockComment;
+			bool startInString = (inString && verbatim);
+			
+			#region Parse char by char
+			lineComment = false;
+			inChar = false;
+			escape = false;
+			if (!verbatim) inString = false;
+			
+			lastRealChar = '\n';
+			
+			char lastchar = ' ';
+			char c = ' ';
+			char nextchar = line[0];
+			for (int i = 0; i < line.Length; i++) {
+				if (lineComment) break; // cancel parsing current line
+				
+				lastchar = c;
+				c = nextchar;
+				if (i + 1 < line.Length)
+					nextchar = line[i + 1];
+				else
+					nextchar = '\n';
+				
+				if (escape) {
+					escape = false;
+					continue;
+				}
+				
+				#region Check for comment/string chars
+				switch (c) {
+					case '/':
+						if (blockComment && lastchar == '*')
+							blockComment = false;
+						if (!inString && !inChar) {
+							if (!blockComment && nextchar == '/')
+								lineComment = true;
+							if (!lineComment && nextchar == '*')
+								blockComment = true;
+						}
+						break;
+					case '#':
+						if (!(inChar || blockComment || inString))
+							lineComment = true;
+						break;
+					case '"':
+						if (!(inChar || lineComment || blockComment)) {
+							inString = !inString;
+							if (!inString && verbatim) {
+								if (nextchar == '"') {
+									escape = true; // skip escaped quote
+									inString = true;
+								} else {
+									verbatim = false;
+								}
+							} else if (inString && lastchar == '@') {
+								verbatim = true;
+							}
+						}
+						break;
+					case '\'':
+						if (!(inString || lineComment || blockComment)) {
+							inChar = !inChar;
+						}
+						break;
+					case '\\':
+						if ((inString && !verbatim) || inChar)
+							escape = true; // skip next character
+						break;
+				}
+				#endregion
+				
+				if (lineComment || blockComment || inString || inChar) {
+					if (wordBuilder.Length > 0)
+						block.LastWord = wordBuilder.ToString();
+					wordBuilder.Length = 0;
+					continue;
+				}
+				
+				if (!Char.IsWhiteSpace(c) && c != '[' && c != '/') {
+					if (block.Bracket == '{')
+						block.Continuation = true;
+				}
+				
+				if (Char.IsLetterOrDigit(c)) {
+					wordBuilder.Append(c);
+				} else {
+					if (wordBuilder.Length > 0)
+						block.LastWord = wordBuilder.ToString();
+					wordBuilder.Length = 0;
+				}
+				
+				#region Push/Pop the blocks
+				switch (c) {
+					case '{':
+						block.OneLineBlock = false;
+						blocks.Push(block);
+						block.StartLine = doc.LineNumber;
+						if (block.LastWord == "switch")
+							block.Indent(set, set.IndentString + set.IndentString);
+						else
+							block.Indent(set);
+						block.Bracket = '{';
+						break;
+					case '}':
+						while (block.Bracket != '{') {
+							if (blocks.Count == 0) break;
+							block = (Block)blocks.Pop();
+						}
+						if (blocks.Count == 0) break;
+						block = (Block)blocks.Pop();
+						block.Continuation = false;
+						block.OneLineBlock = false;
+						break;
+					case '(':
+					case '[':
+						blocks.Push(block);
+						if (block.StartLine == doc.LineNumber)
+							block.InnerIndent = block.OuterIndent;
+						else
+							block.StartLine = doc.LineNumber;
+						block.Indent(set,
+						             (oldBlock.OneLineBlock ? set.IndentString : "") +
+						             (oldBlock.Continuation ? set.IndentString : "") +
+						             new String(' ', i + 1));
+						block.Bracket = c;
+						break;
+					case ')':
+						if (blocks.Count == 0) break;
+						if (block.Bracket == '(') {
+							block = (Block)blocks.Pop();
+							if (IsSingleStatementKeyword(block.LastWord))
+								block.Continuation = false;
+						}
+						break;
+					case ']':
+						if (blocks.Count == 0) break;
+						if (block.Bracket == '[')
+							block = (Block)blocks.Pop();
+						break;
+					case ';':
+					case ',':
+						block.Continuation = false;
+						block.OneLineBlock = false;
+						break;
+					case ':':
+						if (block.LastWord == "case" || line.StartsWith("case ") || line.StartsWith(block.LastWord + ":")) {
+							block.Continuation = false;
+							block.OneLineBlock = false;
+						}
+						break;
+				}
+				
+				if (!Char.IsWhiteSpace(c)) {
+					// register this char as last char
+					lastRealChar = c;
+				}
+				#endregion
+			}
+			#endregion
+			
+			if (wordBuilder.Length > 0)
+				block.LastWord = wordBuilder.ToString();
+			wordBuilder.Length = 0;
+			
+			if (startInString) return;
+			if (startInComment && line[0] != '*') return;
+			if (doc.Text.StartsWith("//\t") || doc.Text == "//")
+				return;
+			
+			if (line[0] == '}') {
+				indent.Append(oldBlock.OuterIndent);
+				oldBlock.OneLineBlock = false;
+				oldBlock.Continuation = false;
+			} else {
+				indent.Append(oldBlock.InnerIndent);
+			}
+			
+			if (indent.Length > 0 && oldBlock.Bracket == '(' && line[0] == ')') {
+				indent.Remove(indent.Length - 1, 1);
+			} else if (indent.Length > 0 && oldBlock.Bracket == '[' && line[0] == ']') {
+				indent.Remove(indent.Length - 1, 1);
+			}
+			
+			if (line[0] == ':') {
+				oldBlock.Continuation = true;
+			} else if (lastRealChar == ':' && indent.Length >= set.IndentString.Length) {
+				if (block.LastWord == "case" || line.StartsWith("case ") || line.StartsWith(block.LastWord + ":"))
+					indent.Remove(indent.Length - set.IndentString.Length, set.IndentString.Length);
+			} else if (lastRealChar == ')') {
+				if (IsSingleStatementKeyword(block.LastWord)) {
+					block.OneLineBlock = true;
+				}
+			} else if (lastRealChar == 'e' && block.LastWord == "else") {
+				block.OneLineBlock = true;
+				block.Continuation = false;
+			}
+			
+			if (doc.ReadOnly) {
+				// We can't change the current line, but we should accept the existing
+				// indentation if possible (=if the current statement is not a multiline
+				// statement).
+				if (!oldBlock.Continuation && !oldBlock.OneLineBlock &&
+				    oldBlock.StartLine == block.StartLine &&
+				    block.StartLine < doc.LineNumber && lastRealChar != ':') {
+					// use indent StringBuilder to get the indentation of the current line
+					indent.Length = 0;
+					line = doc.Text; // get untrimmed line
+					for (int i = 0; i < line.Length; ++i) {
+						if (!Char.IsWhiteSpace(line[i]))
+							break;
+						indent.Append(line[i]);
+					}
+					block.InnerIndent = indent.ToString();
+				}
+				return;
+			}
+			
+			if (line[0] != '{') {
+				if (line[0] != ')' && oldBlock.Continuation && oldBlock.Bracket == '{')
+					indent.Append(set.IndentString);
+				if (oldBlock.OneLineBlock)
+					indent.Append(set.IndentString);
+			}
+			
+			// this is only for blockcomment lines starting with *,
+			// all others keep their old indentation
+			if (startInComment)
+				indent.Append(' ');
+			
+			if (indent.Length != (doc.Text.Length - line.Length) ||
+			    !doc.Text.StartsWith(indent.ToString()) ||
+			    Char.IsWhiteSpace(doc.Text[indent.Length]))
+			{
+				doc.Text = indent.ToString() + line;
+			}
+		}
+		
+		bool IsSingleStatementKeyword(string keyword) {
+			switch (keyword) {
+				case "if":
+				case "for":
+				case "while":
+				case "do":
+				case "foreach":
+				case "using":
+				case "lock":
+					return true;
+				default:
+					return false;
+			}
+		}
+		
+		bool TrimEnd(IDocumentAccessor doc)
+		{
+			string line = doc.Text;
+			if (!Char.IsWhiteSpace(line[line.Length - 1])) return false;
+			
+			// one space after an empty comment is allowed
+			if (line.EndsWith("// ") || line.EndsWith("* "))
+				return false;
+			
+			doc.Text = line.TrimEnd();
+			return true;
+		}
+	}
+}

Added: corsavy-addin/trunk/Src/FormattingStrategy/NemerleFormattingStrategy.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/FormattingStrategy/NemerleFormattingStrategy.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,795 @@
+ďťż// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Daniel Grunwald" email="daniel at danielgrunwald.de"/>
+//     <version>$Revision: 468 $</version>
+// </file>
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Text;
+
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.TextEditor;
+using ICSharpCode.TextEditor.Actions;
+using ICSharpCode.TextEditor.Document;
+using ICSharpCode.Core;
+
+namespace NemerleBinding.FormattingStrategy
+{
+	/// <summary>
+	/// This class handles the auto and smart indenting in the textbuffer while
+	/// you type.
+	/// </summary>
+	public class NemerleFormattingStrategy : DefaultFormattingStrategy
+	{
+		public NemerleFormattingStrategy()
+		{
+		}
+		
+		#region SmartIndentLine
+		/// <summary>
+		/// Define CSharp specific smart indenting for a line :)
+		/// </summary>
+		protected override int SmartIndentLine(TextArea textArea, int lineNr)
+		{
+			if (lineNr <= 0) {
+				return AutoIndentLine(textArea, lineNr);
+			}
+			
+			string oldText = textArea.Document.GetText(textArea.Document.GetLineSegment(lineNr));
+			
+			DocumentAccessor acc = new DocumentAccessor(textArea.Document, lineNr, lineNr);
+			
+			IndentationSettings set = new IndentationSettings();
+			set.IndentString = Tab.GetIndentationString(textArea.Document);
+			set.LeaveEmptyLines = false;
+			IndentationReformatter r = new IndentationReformatter();
+			
+			r.Reformat(acc, set);
+			
+			if (acc.ChangedLines > 0)
+				textArea.Document.UndoStack.UndoLast(2);
+			
+			string t = acc.Text;
+			if (t.Length == 0) {
+				// use AutoIndentation for new lines in comments / verbatim strings.
+				return AutoIndentLine(textArea, lineNr);
+			} else {
+				int newIndentLength = t.Length - t.TrimStart().Length;
+				int oldIndentLength = oldText.Length - oldText.TrimStart().Length;
+				if (oldIndentLength != newIndentLength && lineNr == textArea.Caret.Position.Y) {
+					// fix cursor position if indentation was changed
+					int newX = textArea.Caret.Position.X - oldIndentLength + newIndentLength;
+					textArea.Caret.Position = new Point(Math.Max(newX, 0), lineNr);
+				}
+				return newIndentLength;
+			}
+		}
+		
+		/// <summary>
+		/// This function sets the indentlevel in a range of lines.
+		/// </summary>
+		public override void IndentLines(TextArea textArea, int begin, int end)
+		{
+			if (textArea.Document.TextEditorProperties.IndentStyle != IndentStyle.Smart) {
+				base.IndentLines(textArea, begin, end);
+				return;
+			}
+			int cursorPos = textArea.Caret.Position.Y;
+			int oldIndentLength = 0;
+			
+			if (cursorPos >= begin && cursorPos <= end)
+				oldIndentLength = GetIndentation(textArea, cursorPos).Length;
+			
+			IndentationSettings set = new IndentationSettings();
+			set.IndentString = Tab.GetIndentationString(textArea.Document);
+			IndentationReformatter r = new IndentationReformatter();
+			DocumentAccessor acc = new DocumentAccessor(textArea.Document, begin, end);
+			r.Reformat(acc, set);
+			
+			if (cursorPos >= begin && cursorPos <= end) {
+				int newIndentLength = GetIndentation(textArea, cursorPos).Length;
+				if (oldIndentLength != newIndentLength) {
+					// fix cursor position if indentation was changed
+					int newX = textArea.Caret.Position.X - oldIndentLength + newIndentLength;
+					textArea.Caret.Position = new Point(Math.Max(newX, 0), cursorPos);
+				}
+			}
+			
+			if (acc.ChangedLines > 0)
+				textArea.Document.UndoStack.UndoLast(acc.ChangedLines);
+		}
+		#endregion
+		
+		#region Private functions
+		bool NeedCurlyBracket(string text)
+		{
+			int curlyCounter = 0;
+			
+			bool inString = false;
+			bool inChar   = false;
+			bool verbatim = false;
+			
+			bool lineComment  = false;
+			bool blockComment = false;
+			
+			for (int i = 0; i < text.Length; ++i) {
+				switch (text[i]) {
+					case '\r':
+					case '\n':
+						lineComment = false;
+						inChar = false;
+						if (!verbatim) inString = false;
+						break;
+					case '/':
+						if (blockComment) {
+							Debug.Assert(i > 0);
+							if (text[i - 1] == '*') {
+								blockComment = false;
+							}
+						}
+						if (!inString && !inChar && i + 1 < text.Length) {
+							if (!blockComment && text[i + 1] == '/') {
+								lineComment = true;
+							}
+							if (!lineComment && text[i + 1] == '*') {
+								blockComment = true;
+							}
+						}
+						break;
+					case '"':
+						if (!(inChar || lineComment || blockComment)) {
+							if (inString && verbatim) {
+								if (i + 1 < text.Length && text[i + 1] == '"') {
+									++i; // skip escaped quote
+									inString = false; // let the string go on
+								} else {
+									verbatim = false;
+								}
+							} else if (!inString && i > 0 && text[i - 1] == '@') {
+								verbatim = true;
+							}
+							inString = !inString;
+						}
+						break;
+					case '\'':
+						if (!(inString || lineComment || blockComment)) {
+							inChar = !inChar;
+						}
+						break;
+					case '{':
+						if (!(inString || inChar || lineComment || blockComment)) {
+							++curlyCounter;
+						}
+						break;
+					case '}':
+						if (!(inString || inChar || lineComment || blockComment)) {
+							--curlyCounter;
+						}
+						break;
+					case '\\':
+						if ((inString && !verbatim) || inChar)
+							++i; // skip next character
+						break;
+				}
+			}
+			return curlyCounter > 0;
+		}
+		
+		
+		bool IsInsideStringOrComment(TextArea textArea, LineSegment curLine, int cursorOffset)
+		{
+			// scan cur line if it is inside a string or single line comment (//)
+			bool insideString  = false;
+			char stringstart = ' ';
+			bool verbatim = false; // true if the current string is verbatim (@-string)
+			char c = ' ';
+			char lastchar;
+			
+			for (int i = curLine.Offset; i < cursorOffset; ++i) {
+				lastchar = c;
+				c = textArea.Document.GetCharAt(i);
+				if (insideString) {
+					if (c == stringstart) {
+						if (verbatim && i + 1 < cursorOffset && textArea.Document.GetCharAt(i + 1) == '"') {
+							++i; // skip escaped character
+						} else {
+							insideString = false;
+						}
+					} else if (c == '\\' && !verbatim) {
+						++i; // skip escaped character
+					}
+				} else if (c == '/' && i + 1 < cursorOffset && textArea.Document.GetCharAt(i + 1) == '/') {
+					return true;
+				} else if (c == '"' || c == '\'') {
+					stringstart = c;
+					insideString = true;
+					verbatim = (c == '"') && (lastchar == '@');
+				}
+			}
+			
+			return insideString;
+		}
+		
+		bool IsInsideDocumentationComment(TextArea textArea, LineSegment curLine, int cursorOffset)
+		{
+			for (int i = curLine.Offset; i < cursorOffset; ++i) {
+				char ch = textArea.Document.GetCharAt(i);
+				if (ch == '"') {
+					// parsing strings correctly is too complicated (see above),
+					// but I don't now any case where a doc comment is after a string...
+					return false;
+				}
+				if (ch == '/' && i + 2 < cursorOffset && textArea.Document.GetCharAt(i + 1) == '/' && textArea.Document.GetCharAt(i + 2) == '/') {
+					return true;
+				}
+			}
+			return false;
+		}
+		
+		
+		
+		bool IsBeforeRegion(TextArea textArea, DomRegion region, int lineNr)
+		{
+			if (region.IsEmpty) {
+				return false;
+			}
+			return region.BeginLine - 2 <= lineNr && lineNr <= region.BeginLine;
+		}
+		
+		object GetClassMember(TextArea textArea, int lineNr, IClass c)
+		{
+			if (IsBeforeRegion(textArea, c.Region, lineNr)) {
+				return c;
+			}
+			
+			foreach (IClass inner in c.InnerClasses) {
+				object o = GetClassMember(textArea, lineNr, inner);
+				if (o != null) {
+					return o;
+				}
+			}
+			
+			foreach (IField f in c.Fields) {
+				if (IsBeforeRegion(textArea, f.Region, lineNr)) {
+					return f;
+				}
+			}
+			foreach (IProperty p in c.Properties) {
+				if (IsBeforeRegion(textArea, p.Region, lineNr)) {
+					return p;
+				}
+			}
+			foreach (IEvent e in c.Events) {
+				if (IsBeforeRegion(textArea, e.Region, lineNr)) {
+					return e;
+				}
+			}
+			foreach (IMethod m in c.Methods) {
+				if (IsBeforeRegion(textArea, m.Region, lineNr)) {
+					return m;
+				}
+			}
+			return null;
+		}
+		
+		object GetMember(TextArea textArea, int lineNr)
+		{
+			string fileName = textArea.MotherTextEditorControl.FileName;
+			if (fileName != null && fileName.Length > 0 ) {
+				string fullPath = Path.GetFullPath(fileName);
+				ParseInformation parseInfo = ParserService.GetParseInformation(fullPath);
+				if (parseInfo != null) {
+					ICompilationUnit currentCompilationUnit = (ICompilationUnit)parseInfo.BestCompilationUnit;
+					if (currentCompilationUnit != null) {
+						foreach (IClass c in currentCompilationUnit.Classes) {
+							object o = GetClassMember(textArea, lineNr, c);
+							if (o != null) {
+								return o;
+							}
+						}
+					}
+				}
+			}
+			return null;
+		}
+		#endregion
+		
+		#region FormatLine
+		
+		bool NeedEndregion(IDocument document)
+		{
+			int regions = 0;
+			int endregions = 0;
+			foreach (LineSegment line in document.LineSegmentCollection) {
+				string text = document.GetText(line).Trim();
+				if (text.StartsWith("#region")) {
+					++regions;
+				} else if (text.StartsWith("#endregion")) {
+					++endregions;
+				}
+			}
+			return regions > endregions;
+		}
+		public override int FormatLine(TextArea textArea, int lineNr, int cursorOffset, char ch) // used for comment tag formater/inserter
+		{
+			LineSegment curLine   = textArea.Document.GetLineSegment(lineNr);
+			LineSegment lineAbove = lineNr > 0 ? textArea.Document.GetLineSegment(lineNr - 1) : null;
+			
+			//// local string for curLine segment
+			string curLineText="";
+			if (ch == '/') {
+				curLineText   = textArea.Document.GetText(curLine);
+				string lineAboveText = lineAbove == null ? "" : textArea.Document.GetText(lineAbove);
+				if (curLineText != null && curLineText.EndsWith("///") && (lineAboveText == null || !lineAboveText.Trim().StartsWith("///"))) {
+					string indentation = base.GetIndentation(textArea, lineNr);
+					object member = GetMember(textArea, lineNr);
+					if (member != null) {
+						StringBuilder sb = new StringBuilder();
+						sb.Append(" <summary>\n");
+						sb.Append(indentation);
+						sb.Append("/// \n");
+						sb.Append(indentation);
+						sb.Append("/// </summary>");
+						
+						if (member is IMethod) {
+							IMethod method = (IMethod)member;
+							if (method.Parameters != null && method.Parameters.Count > 0) {
+								for (int i = 0; i < method.Parameters.Count; ++i) {
+									sb.Append("\n");
+									sb.Append(indentation);
+									sb.Append("/// <param name=\"");
+									sb.Append(method.Parameters[i].Name);
+									sb.Append("\"></param>");
+								}
+							}
+							if (method.ReturnType != null && method.ReturnType.FullyQualifiedName != "System.Void") {
+								sb.Append("\n");
+								sb.Append(indentation);
+								sb.Append("/// <returns></returns>");
+							}
+						}
+						textArea.Document.Insert(cursorOffset, sb.ToString());
+						
+						textArea.Refresh();
+						textArea.Caret.Position = textArea.Document.OffsetToPosition(cursorOffset + indentation.Length + "/// ".Length + " <summary>\n".Length);
+						return 0;
+					}
+				}
+				return 0;
+			}
+			
+			if (ch != '\n' && ch != '>') {
+				if (IsInsideStringOrComment(textArea, curLine, cursorOffset)) {
+					return 0;
+				}
+			}
+			switch (ch) {
+				case '>':
+					if (IsInsideDocumentationComment(textArea, curLine, cursorOffset)) {
+						curLineText  = textArea.Document.GetText(curLine);
+						int column = textArea.Caret.Offset - curLine.Offset;
+						int index = Math.Min(column - 1, curLineText.Length - 1);
+						
+						while (index >= 0 && curLineText[index] != '<') {
+							--index;
+							if(curLineText[index] == '/')
+								return 0; // the tag was an end tag or already
+						}
+						
+						if (index > 0) {
+							StringBuilder commentBuilder = new StringBuilder("");
+							for (int i = index; i < curLineText.Length && i < column && !Char.IsWhiteSpace(curLineText[i]); ++i) {
+								commentBuilder.Append(curLineText[ i]);
+							}
+							string tag = commentBuilder.ToString().Trim();
+							if (!tag.EndsWith(">")) {
+								tag += ">";
+							}
+							if (!tag.StartsWith("/")) {
+								textArea.Document.Insert(textArea.Caret.Offset, "</" + tag.Substring(1));
+							}
+						}
+					}
+					break;
+				case ':':
+				case ')':
+				case ']':
+					
+				case '}':
+				case '{':
+					return textArea.Document.FormattingStrategy.IndentLine(textArea, lineNr);
+				case '\n':
+					if (lineNr <= 0) {
+						return IndentLine(textArea, lineNr);
+					}
+					
+					string  lineAboveText = lineAbove == null ? "" : textArea.Document.GetText(lineAbove);
+					//// curLine might have some text which should be added to indentation
+					curLineText = "";
+					if (curLine.Length > 0) {
+						curLineText = textArea.Document.GetText(curLine);
+					}
+					
+					LineSegment nextLine      = lineNr + 1 < textArea.Document.TotalNumberOfLines ? textArea.Document.GetLineSegment(lineNr + 1) : null;
+					string      nextLineText  = lineNr + 1 < textArea.Document.TotalNumberOfLines ? textArea.Document.GetText(nextLine) : "";
+					
+					int addCursorOffset = 0;
+					
+					if (lineAboveText.Trim().StartsWith("#region") && NeedEndregion(textArea.Document)) {
+						textArea.Document.Insert(curLine.Offset, "#endregion");
+						return IndentLine(textArea, lineNr) + "#endregion".Length;
+					}
+					
+					if (lineAbove.HighlightSpanStack != null && lineAbove.HighlightSpanStack.Count > 0) {
+						if (!((Span)lineAbove.HighlightSpanStack.Peek()).StopEOL) {	// case for /* style comments
+							int index = lineAboveText.IndexOf("/*");
+							if (index > 0) {
+								StringBuilder indentation = new StringBuilder(GetIndentation(textArea, lineNr - 1));
+								for (int i = indentation.Length; i < index; ++ i) {
+									indentation.Append(' ');
+								}
+								//// adding curline text
+								textArea.Document.Replace(curLine.Offset, curLine.Length, indentation.ToString() + " * " + curLineText);
+								return indentation.Length + 3 + curLineText.Length;
+							}
+							
+							index = lineAboveText.IndexOf("*");
+							if (index > 0) {
+								StringBuilder indentation = new StringBuilder(GetIndentation(textArea, lineNr - 1));
+								for (int i = indentation.Length; i < index; ++ i) {
+									indentation.Append(' ');
+								}
+								//// adding curline if present
+								textArea.Document.Replace(curLine.Offset, curLine.Length, indentation.ToString() + "* " + curLineText);
+								return indentation.Length + 2 + curLineText.Length;
+							}
+						} else { // don't handle // lines, because they're only one lined comments
+							int indexAbove = lineAboveText.IndexOf("///");
+							int indexNext  = nextLineText.IndexOf("///");
+							if (indexAbove > 0 && (indexNext != -1 || indexAbove + 4 < lineAbove.Length)) {
+								StringBuilder indentation = new StringBuilder(GetIndentation(textArea, lineNr - 1));
+								for (int i = indentation.Length; i < indexAbove; ++ i) {
+									indentation.Append(' ');
+								}
+								//// adding curline text if present
+								textArea.Document.Replace(curLine.Offset, curLine.Length, indentation.ToString() + "/// " + curLineText);
+								textArea.Document.UndoStack.UndoLast(2);
+								return indentation.Length + 4 /*+ curLineText.Length*/;
+							}
+							
+							if (IsInNonVerbatimString(lineAboveText, curLineText)) {
+								textArea.Document.Insert(lineAbove.Offset + lineAbove.Length,
+								                         "\" +");
+								curLine = textArea.Document.GetLineSegment(lineNr);
+								textArea.Document.Insert(curLine.Offset, "\"");
+								textArea.Document.UndoStack.UndoLast(3);
+								addCursorOffset = 1;
+							}
+						}
+					}
+					int result = IndentLine(textArea, lineNr) + addCursorOffset;
+					if (textArea.TextEditorProperties.AutoInsertCurlyBracket) {
+						string oldLineText = TextUtilities.GetLineAsString(textArea.Document, lineNr - 1);
+						if (oldLineText.EndsWith("{")) {
+							if (NeedCurlyBracket(textArea.Document.TextContent)) {
+								textArea.Document.Insert(curLine.Offset + curLine.Length, "\n}");
+								IndentLine(textArea, lineNr + 1);
+							}
+						}
+					}
+					return result;
+			}
+			return 0;
+		}
+		
+		/// <summary>
+		/// Checks if the cursor is inside a non-verbatim string.
+		/// This method is used to check if a line break was inserted in a string.
+		/// The text editor has already broken the line for us, so we just need to check
+		/// the two lines.
+		/// </summary>
+		/// <param name="start">The part before the line break</param>
+		/// <param name="end">The part after the line break</param>
+		/// <returns>
+		/// True, when the line break was inside a non-verbatim-string, so when
+		/// start does not contain a comment, but a non-even number of ", and
+		/// end contains a non-even number of " before the first comment.
+		/// </returns>
+		bool IsInNonVerbatimString(string start, string end)
+		{
+			bool inString = false;
+			bool inChar = false;
+			for (int i = 0; i < start.Length; ++i) {
+				char c = start[i];
+				if (c == '"' && !inChar) {
+					if (!inString && i > 0 && start[i - 1] == '@')
+						return false; // no string line break for verbatim strings
+					inString = !inString;
+				} else if (c == '\'' && !inString) {
+					inChar = !inChar;
+				}
+				if (!inString && i > 0 && start[i - 1] == '/' && (c == '/' || c == '*'))
+					return false;
+				if (inString && start[i] == '\\')
+					++i;
+			}
+			if (!inString) return false;
+			// we are possibly in a string, or a multiline string has just ended here
+			// check if the closing double quote is in end
+			for (int i = 0; i < end.Length; ++i) {
+				char c = end[i];
+				if (c == '"' && !inChar) {
+					if (!inString && i > 0 && end[i - 1] == '@')
+						break; // no string line break for verbatim strings
+					inString = !inString;
+				} else if (c == '\'' && !inString) {
+					inChar = !inChar;
+				}
+				if (!inString && i > 0 && end[i - 1] == '/' && (c == '/' || c == '*'))
+					break;
+				if (inString && end[i] == '\\')
+					++i;
+			}
+			// return true if the string was closed properly
+			return !inString;
+		}
+		#endregion
+		
+		#region SearchBracket helper functions
+		static int ScanLineStart(IDocument document, int offset)
+		{
+			for (int i = offset - 1; i > 0; --i) {
+				if (document.GetCharAt(i) == '\n')
+					return i + 1;
+			}
+			return 0;
+		}
+		
+		/// <summary>
+		/// Gets the type of code at offset.<br/>
+		/// 0 = Code,<br/>
+		/// 1 = Comment,<br/>
+		/// 2 = String<br/>
+		/// Block comments and multiline strings are not supported.
+		/// </summary>
+		static int GetStartType(IDocument document, int linestart, int offset)
+		{
+			bool inString = false;
+			bool inChar = false;
+			bool verbatim = false;
+			for(int i = linestart; i < offset; i++) {
+				switch (document.GetCharAt(i)) {
+					case '/':
+						if (!inString && !inChar && i + 1 < document.TextLength) {
+							if (document.GetCharAt(i + 1) == '/') {
+								return 1;
+							}
+						}
+						break;
+					case '"':
+						if (!inChar) {
+							if (inString && verbatim) {
+								if (i + 1 < document.TextLength && document.GetCharAt(i + 1) == '"') {
+									++i; // skip escaped quote
+									inString = false; // let the string go on
+								} else {
+									verbatim = false;
+								}
+							} else if (!inString && i > 0 && document.GetCharAt(i - 1) == '@') {
+								verbatim = true;
+							}
+							inString = !inString;
+						}
+						break;
+					case '\'':
+						if (!inString) inChar = !inChar;
+						break;
+					case '\\':
+						if ((inString && !verbatim) || inChar)
+							++i; // skip next character
+						break;
+				}
+			}
+			return (inString || inChar) ? 2 : 0;
+		}
+		#endregion
+		
+		#region SearchBracketBackward
+		public override int SearchBracketBackward(IDocument document, int offset, char openBracket, char closingBracket)
+		{
+			if (offset + 1 >= document.TextLength) return -1;
+			// this method parses a c# document backwards to find the matching bracket
+			
+			// first try "quick find" - find the matching bracket if there is no string/comment in the way
+			int quickResult = base.SearchBracketBackward(document, offset, openBracket, closingBracket);
+			if (quickResult >= 0) return quickResult;
+			
+			// we need to parse the line from the beginning, so get the line start position
+			int linestart = ScanLineStart(document, offset + 1);
+			
+			// we need to know where offset is - in a string/comment or in normal code?
+			// ignore cases where offset is in a block comment
+			int starttype = GetStartType(document, linestart, offset + 1);
+			if (starttype != 0) {
+				return -1; // start position is in a comment/string
+			}
+			
+			// I don't see any possibility to parse a C# document backwards...
+			// We have to do it forwards and push all bracket positions on a stack.
+			Stack bracketStack = new Stack();
+			bool  blockComment = false;
+			bool  lineComment  = false;
+			bool  inChar       = false;
+			bool  inString     = false;
+			bool  verbatim     = false;
+			
+			for(int i = 0; i <= offset; ++i) {
+				char ch = document.GetCharAt(i);
+				switch (ch) {
+					case '\r':
+					case '\n':
+						lineComment = false;
+						inChar = false;
+						if (!verbatim) inString = false;
+						break;
+					case '/':
+						if (blockComment) {
+							Debug.Assert(i > 0);
+							if (document.GetCharAt(i - 1) == '*') {
+								blockComment = false;
+							}
+						}
+						if (!inString && !inChar && i + 1 < document.TextLength) {
+							if (!blockComment && document.GetCharAt(i + 1) == '/') {
+								lineComment = true;
+							}
+							if (!lineComment && document.GetCharAt(i + 1) == '*') {
+								blockComment = true;
+							}
+						}
+						break;
+					case '"':
+						if (!(inChar || lineComment || blockComment)) {
+							if (inString && verbatim) {
+								if (i + 1 < document.TextLength && document.GetCharAt(i + 1) == '"') {
+									++i; // skip escaped quote
+									inString = false; // let the string go
+								} else {
+									verbatim = false;
+								}
+							} else if (!inString && offset > 0 && document.GetCharAt(i - 1) == '@') {
+								verbatim = true;
+							}
+							inString = !inString;
+						}
+						break;
+					case '\'':
+						if (!(inString || lineComment || blockComment)) {
+							inChar = !inChar;
+						}
+						break;
+					case '\\':
+						if ((inString && !verbatim) || inChar)
+							++i; // skip next character
+						break;
+						default :
+							if (ch == openBracket) {
+							if (!(inString || inChar || lineComment || blockComment)) {
+								bracketStack.Push(i);
+							}
+						} else if (ch == closingBracket) {
+							if (!(inString || inChar || lineComment || blockComment)) {
+								if (bracketStack.Count > 0)
+									bracketStack.Pop();
+							}
+						}
+						break;
+				}
+			}
+			if (bracketStack.Count > 0) return (int)bracketStack.Pop();
+			return -1;
+		}
+		#endregion
+		
+		#region SearchBracketForward
+		public override int SearchBracketForward(IDocument document, int offset, char openBracket, char closingBracket)
+		{
+			bool inString = false;
+			bool inChar   = false;
+			bool verbatim = false;
+			
+			bool lineComment  = false;
+			bool blockComment = false;
+			
+			if (offset < 0) return -1;
+			
+			// first try "quick find" - find the matching bracket if there is no string/comment in the way
+			int quickResult = base.SearchBracketForward(document, offset, openBracket, closingBracket);
+			if (quickResult >= 0) return quickResult;
+			
+			// we need to parse the line from the beginning, so get the line start position
+			int linestart = ScanLineStart(document, offset);
+			
+			// we need to know where offset is - in a string/comment or in normal code?
+			// ignore cases where offset is in a block comment
+			int starttype = GetStartType(document, linestart, offset);
+			if (starttype != 0) return -1; // start position is in a comment/string
+			
+			int brackets = 1;
+			
+			while (offset < document.TextLength) {
+				char ch = document.GetCharAt(offset);
+				switch (ch) {
+					case '\r':
+					case '\n':
+						lineComment = false;
+						inChar = false;
+						if (!verbatim) inString = false;
+						break;
+					case '/':
+						if (blockComment) {
+							Debug.Assert(offset > 0);
+							if (document.GetCharAt(offset - 1) == '*') {
+								blockComment = false;
+							}
+						}
+						if (!inString && !inChar && offset + 1 < document.TextLength) {
+							if (!blockComment && document.GetCharAt(offset + 1) == '/') {
+								lineComment = true;
+							}
+							if (!lineComment && document.GetCharAt(offset + 1) == '*') {
+								blockComment = true;
+							}
+						}
+						break;
+					case '"':
+						if (!(inChar || lineComment || blockComment)) {
+							if (inString && verbatim) {
+								if (offset + 1 < document.TextLength && document.GetCharAt(offset + 1) == '"') {
+									++offset; // skip escaped quote
+									inString = false; // let the string go
+								} else {
+									verbatim = false;
+								}
+							} else if (!inString && offset > 0 && document.GetCharAt(offset - 1) == '@') {
+								verbatim = true;
+							}
+							inString = !inString;
+						}
+						break;
+					case '\'':
+						if (!(inString || lineComment || blockComment)) {
+							inChar = !inChar;
+						}
+						break;
+					case '\\':
+						if ((inString && !verbatim) || inChar)
+							++offset; // skip next character
+						break;
+						default :
+							if (ch == openBracket) {
+							if (!(inString || inChar || lineComment || blockComment)) {
+								++brackets;
+							}
+						} else if (ch == closingBracket) {
+							if (!(inString || inChar || lineComment || blockComment)) {
+								--brackets;
+								if (brackets == 0) {
+									return offset;
+								}
+							}
+						}
+						break;
+				}
+				++offset;
+			}
+			return -1;
+		}
+		#endregion
+	}
+}

Added: corsavy-addin/trunk/Src/NemerleAmbience.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/NemerleAmbience.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,558 @@
+ďťż// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Mike KrĂźger" email="mike at icsharpcode.net"/>
+//     <version>$Revision: 649 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Text;
+
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.Core;
+
+namespace NemerleBinding
+{
+	public class NemerleAmbience :  AbstractAmbience
+	{
+		static string[,] typeConversionList = new string[,] {
+			{"System.Void",    "void"},
+			{"System.Object",  "object"},
+			{"System.Boolean", "bool"},
+			{"System.Byte",    "byte"},
+			{"System.SByte",   "sbyte"},
+			{"System.Char",    "char"},
+			{"System.Enum",    "enum"},
+			{"System.Int16",   "short"},
+			{"System.Int32",   "int"},
+			{"System.Int64",   "long"},
+			{"System.UInt16",  "ushort"},
+			{"System.UInt32",  "uint"},
+			{"System.UInt64",  "ulong"},
+			{"System.Single",  "float"},
+			{"System.Double",  "double"},
+			{"System.Decimal", "decimal"},
+			{"System.String",  "string"}
+		};
+		
+		static Hashtable typeConversionTable = new Hashtable();
+		
+		public static Hashtable TypeConversionTable {
+			get {
+				return typeConversionTable;
+			}
+		}
+		
+		static NemerleAmbience instance;
+		
+		public static NemerleAmbience Instance {
+			get {
+				if (instance == null) instance = new NemerleAmbience();
+				return instance;
+			}
+		}
+		
+		static NemerleAmbience()
+		{
+			for (int i = 0; i < typeConversionList.GetLength(0); ++i) {
+				typeConversionTable[typeConversionList[i, 0]] = typeConversionList[i, 1];
+			}
+		}
+		
+		bool ModifierIsSet(ModifierEnum modifier, ModifierEnum query)
+		{
+			return (modifier & query) == query;
+		}
+		
+		public override string Convert(ModifierEnum modifier)
+		{
+			if (ShowAccessibility) {
+				if (ModifierIsSet(modifier, ModifierEnum.Public)) {
+					return "public ";
+				} else if (ModifierIsSet(modifier, ModifierEnum.Private)) {
+					return "private ";
+				} else if (ModifierIsSet(modifier, ModifierEnum.ProtectedAndInternal)) {
+					return "protected internal ";
+				} else if (ModifierIsSet(modifier, ModifierEnum.Internal)) {
+					return "internal ";
+				} else if (ModifierIsSet(modifier, ModifierEnum.Protected)) {
+					return "protected ";
+				}
+			}
+			
+			return string.Empty;
+		}
+		
+		string GetModifier(IDecoration decoration)
+		{
+			string ret = "";
+			
+			if (IncludeHTMLMarkup) {
+				ret += "<i>";
+			}
+			
+			if (decoration.IsStatic) {
+				ret += "static ";
+			} else if (decoration.IsSealed) {
+				ret += "final ";
+			} else if (decoration.IsVirtual) {
+				ret += "virtual ";
+			} else if (decoration.IsOverride) {
+				ret += "override ";
+			} else if (decoration.IsNew) {
+				ret += "new ";
+			}
+			
+			if (IncludeHTMLMarkup) {
+				ret += "</i>";
+			}
+			
+			return ret;
+		}
+		
+		
+		public override string Convert(IClass c)
+		{
+			StringBuilder builder = new StringBuilder();
+			
+			builder.Append(Convert(c.Modifiers));
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<i>");
+			}
+			
+			if (ShowModifiers) {
+				if (c.IsSealed) {
+					switch (c.ClassType) {
+						case ClassType.Delegate:
+						case ClassType.Struct:
+						case ClassType.Enum:
+							break;
+							
+						default:
+							builder.Append("sealed ");
+							break;
+					}
+				} else if (c.IsAbstract && c.ClassType != ClassType.Interface) {
+					builder.Append("abstract ");
+				}
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</i>");
+			}
+			
+			if (ShowModifiers) {
+				switch (c.ClassType) {
+					case ClassType.Delegate:
+						builder.Append("delegate");
+						break;
+					case ClassType.Class:
+					case ClassType.Module:
+						builder.Append("class");
+						break;
+					case ClassType.Struct:
+						builder.Append("struct");
+						break;
+					case ClassType.Interface:
+						builder.Append("interface");
+						break;
+					case ClassType.Enum:
+						builder.Append("enum");
+						break;
+				}
+				builder.Append(' ');
+			}
+			if (ShowReturnType && c.ClassType == ClassType.Delegate) {
+				foreach(IMethod m in c.Methods) {
+					if (m.Name != "Invoke") continue;
+					
+					builder.Append(Convert(m.ReturnType));
+					builder.Append(' ');
+				}
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<b>");
+			}
+			
+			if (UseFullyQualifiedMemberNames) {
+				builder.Append(c.FullyQualifiedName);
+			} else {
+				builder.Append(c.Name);
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</b>");
+			}
+			if (c.TypeParameters.Count > 0) {
+				builder.Append('<');
+				for (int i = 0; i < c.TypeParameters.Count; ++i) {
+					if (i > 0) builder.Append(", ");
+					builder.Append(c.TypeParameters[i].Name);
+				}
+				builder.Append('>');
+			}
+			
+			if (ShowReturnType && c.ClassType == ClassType.Delegate) {
+				builder.Append(" (");
+				if (IncludeHTMLMarkup) builder.Append("<br>");
+				
+				foreach(IMethod m in c.Methods) {
+					if (m.Name != "Invoke") continue;
+					
+					for (int i = 0; i < m.Parameters.Count; ++i) {
+						if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
+						
+						builder.Append(Convert(m.Parameters[i]));
+						if (i + 1 < m.Parameters.Count) builder.Append(", ");
+						
+						if (IncludeHTMLMarkup) builder.Append("<br>");
+					}
+				}
+				builder.Append(')');
+				
+			} else if (ShowInheritanceList) {
+				if (c.BaseTypes.Count > 0) {
+					builder.Append(" : ");
+					for (int i = 0; i < c.BaseTypes.Count; ++i) {
+						builder.Append(c.BaseTypes[i]);
+						if (i + 1 < c.BaseTypes.Count) {
+							builder.Append(", ");
+						}
+					}
+				}
+			}
+			
+			if (IncludeBodies) {
+				builder.Append("\n{");
+			}
+			
+			return builder.ToString();
+		}
+		
+		public override string ConvertEnd(IClass c)
+		{
+			return "}";
+		}
+		
+		public override string Convert(IField field)
+		{
+			StringBuilder builder = new StringBuilder();
+			
+			builder.Append(Convert(field.Modifiers));
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<i>");
+			}
+			
+			if (ShowModifiers) {
+				if (field.IsConst) {
+					builder.Append("const ");
+				} else if (field.IsStatic) {
+					builder.Append("static ");
+				}
+				
+				if (field.IsReadonly) {
+					builder.Append("readonly ");
+				}
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</i>");
+			}
+			
+			if (field.ReturnType != null  && ShowReturnType) {
+				builder.Append(Convert(field.ReturnType));
+				builder.Append(' ');
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<b>");
+			}
+			
+			if (UseFullyQualifiedMemberNames) {
+				builder.Append(field.FullyQualifiedName);
+			} else {
+				builder.Append(field.Name);
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</b>");
+			}
+			
+			if (IncludeBodies) builder.Append(";");
+			
+			return builder.ToString();
+		}
+		
+		public override string Convert(IProperty property)
+		{
+			StringBuilder builder = new StringBuilder();
+			
+			builder.Append(Convert(property.Modifiers));
+			
+			if (ShowModifiers) {
+				builder.Append(GetModifier(property));
+			}
+			
+			if (property.ReturnType != null && ShowReturnType) {
+				builder.Append(Convert(property.ReturnType));
+				builder.Append(' ');
+			}
+			
+			if (property.IsIndexer) {
+				builder.Append("this");
+			} else {
+				if (IncludeHTMLMarkup) {
+					builder.Append("<b>");
+				}
+				if (UseFullyQualifiedMemberNames) {
+					builder.Append(property.FullyQualifiedName);
+				} else {
+					builder.Append(property.Name);
+				}
+				if (IncludeHTMLMarkup) {
+					builder.Append("</b>");
+				}
+			}
+			
+			if (property.Parameters.Count > 0) {
+				builder.Append(property.IsIndexer ? '[' : '(');
+				if (IncludeHTMLMarkup) builder.Append("<br>");
+				
+				for (int i = 0; i < property.Parameters.Count; ++i) {
+					if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
+					builder.Append(Convert(property.Parameters[i]));
+					if (i + 1 < property.Parameters.Count) {
+						builder.Append(", ");
+					}
+					if (IncludeHTMLMarkup) builder.Append("<br>");
+				}
+				
+				builder.Append(property.IsIndexer ? ']' : ')');
+			}
+			
+			if (IncludeBodies) {
+				builder.Append(" { ");
+				
+				if (property.CanGet) {
+					builder.Append("get; ");
+				}
+				if (property.CanSet) {
+					builder.Append("set; ");
+				}
+				
+				builder.Append(" } ");
+			}
+			
+			return builder.ToString();
+		}
+		
+		public override string Convert(IEvent e)
+		{
+			StringBuilder builder = new StringBuilder();
+			
+			builder.Append(Convert(e.Modifiers));
+			
+			if (ShowModifiers) {
+				builder.Append(GetModifier(e));
+			}
+			
+			builder.Append("event ");
+			
+			if (e.ReturnType != null && ShowReturnType) {
+				builder.Append(Convert(e.ReturnType));
+				builder.Append(' ');
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<b>");
+			}
+			
+			if (UseFullyQualifiedMemberNames) {
+				builder.Append(e.FullyQualifiedName);
+			} else {
+				builder.Append(e.Name);
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</b>");
+			}
+			
+			if (IncludeBodies) builder.Append(";");
+			
+			return builder.ToString();
+		}
+		
+		public override string Convert(IMethod m)
+		{
+			StringBuilder builder = new StringBuilder();
+			builder.Append(Convert(m.Modifiers));
+			
+			if (ShowModifiers) {
+				builder.Append(GetModifier(m));
+			}
+			
+			if (m.ReturnType != null && ShowReturnType) {
+				builder.Append(Convert(m.ReturnType));
+				builder.Append(' ');
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<b>");
+			}
+			
+			if (m.IsConstructor) {
+				if (m.DeclaringType != null) {
+					builder.Append(m.DeclaringType.Name);
+				} else {
+					builder.Append(m.Name);
+				}
+			} else {
+				if (UseFullyQualifiedMemberNames) {
+					builder.Append(m.FullyQualifiedName);
+				} else {
+					builder.Append(m.Name);
+				}
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</b>");
+			}
+			
+			if (m.TypeParameters.Count > 0) {
+				builder.Append('<');
+				for (int i = 0; i < m.TypeParameters.Count; ++i) {
+					if (i > 0) builder.Append(", ");
+					builder.Append(m.TypeParameters[i].Name);
+				}
+				builder.Append('>');
+			}
+			
+			builder.Append("(");
+			if (IncludeHTMLMarkup) builder.Append("<br>");
+			
+			for (int i = 0; i < m.Parameters.Count; ++i) {
+				if (IncludeHTMLMarkup) builder.Append("&nbsp;&nbsp;&nbsp;");
+				builder.Append(Convert(m.Parameters[i]));
+				if (i + 1 < m.Parameters.Count) {
+					builder.Append(", ");
+				}
+				if (IncludeHTMLMarkup) builder.Append("<br>");
+			}
+			
+			builder.Append(')');
+			
+			if (IncludeBodies) {
+				if (m.DeclaringType != null) {
+					if (m.DeclaringType.ClassType == ClassType.Interface) {
+						builder.Append(";");
+					} else {
+						builder.Append(" {");
+					}
+				} else {
+					builder.Append(" {");
+				}
+			}
+			return builder.ToString();
+		}
+		
+		public override string ConvertEnd(IMethod m)
+		{
+			return "}";
+		}
+		
+		public override string Convert(IReturnType returnType)
+		{
+			if (returnType == null) {
+				return String.Empty;
+			}
+			StringBuilder builder = new StringBuilder();
+			
+			string fullName = returnType.FullyQualifiedName;
+			if (fullName != null && typeConversionTable[fullName] != null) {
+				builder.Append(typeConversionTable[fullName].ToString());
+			} else {
+				if (UseFullyQualifiedNames) {
+					builder.Append(fullName);
+				} else {
+					builder.Append(returnType.Name);
+				}
+			}
+			
+			UnpackNestedType(builder, returnType);
+			
+			return builder.ToString();
+		}
+		
+		void UnpackNestedType(StringBuilder builder, IReturnType returnType)
+		{
+			if (returnType.ArrayDimensions > 0) {
+				builder.Append('[');
+				for (int i = 1; i < returnType.ArrayDimensions; ++i) {
+					builder.Append(',');
+				}
+				builder.Append(']');
+				UnpackNestedType(builder, returnType.ArrayElementType);
+			} else if (returnType.TypeArguments != null) {
+				UnpackNestedType(builder, returnType.UnboundType);
+				builder.Append('<');
+				for (int i = 0; i < returnType.TypeArguments.Count; ++i) {
+					if (i > 0) builder.Append(", ");
+					builder.Append(Convert(returnType.TypeArguments[i]));
+				}
+				builder.Append('>');
+			}
+		}
+		
+		public override string Convert(IParameter param)
+		{
+			StringBuilder builder = new StringBuilder();
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("<i>");
+			}
+			
+			if (param.IsRef) {
+				builder.Append("ref ");
+			} else if (param.IsOut) {
+				builder.Append("out ");
+			} else if (param.IsParams) {
+				builder.Append("params ");
+			}
+			
+			if (IncludeHTMLMarkup) {
+				builder.Append("</i>");
+			}
+			
+			builder.Append(Convert(param.ReturnType));
+			
+			if (ShowParameterNames) {
+				builder.Append(' ');
+				builder.Append(param.Name);
+			}
+			return builder.ToString();
+		}
+		
+		public override string WrapAttribute(string attribute)
+		{
+			return "[" + attribute + "]";
+		}
+		
+		public override string WrapComment(string comment)
+		{
+			return "// " + comment;
+		}
+
+		public override string GetIntrinsicTypeName(string dotNetTypeName)
+		{
+			if (typeConversionTable[dotNetTypeName] != null) {
+				return (string)typeConversionTable[dotNetTypeName];
+			}
+			return dotNetTypeName;
+		}
+		
+	}
+}

Added: corsavy-addin/trunk/Src/NemerleBindingExecutionManager.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/NemerleBindingExecutionManager.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,85 @@
+//// <file>
+////     <copyright see="prj:///doc/copyright.txt"/>
+////     <license see="prj:///doc/license.txt"/>
+////     <owner name="Mike KrĂźger" email="mike at icsharpcode.net"/>
+////     <version value="$version"/>
+//// </file>
+//
+//using System;
+//using System.IO;
+//using System.Diagnostics;
+//using System.Collections;
+//using System.Reflection;
+//using System.Resources;
+//using System.Windows.Forms;
+//using System.Xml;
+//using System.CodeDom.Compiler;
+//using System.Threading;
+//
+//using ICSharpCode.SharpDevelop.Project;
+//using ICSharpCode.SharpDevelop.Gui;
+//using ICSharpCode.Core;
+//
+//namespace NemerleBinding
+//{
+//	/// <summary>
+//	/// This class describes the main functionalaty of a language codon
+//	/// </summary>
+//	public class NemerleBindingExecutionManager
+//	{
+//		public void Execute(string filename, bool debug)
+//		{
+//		}
+//		
+//		public void Execute(IProject project, bool debug)
+//		{
+//			NemerleCompilerParameters parameters = (NemerleCompilerParameters)project.ActiveConfiguration;
+//			
+//			
+//			string directory = FileUtility.GetDirectoryNameWithSeparator(((NemerleCompilerParameters)project.ActiveConfiguration).OutputDirectory);
+//			string exe = ((NemerleCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
+//			string args = ((NemerleCompilerParameters)project.ActiveConfiguration).CommandLineParameters;
+//			
+//			
+//			bool customStartup = false;
+//			ProcessStartInfo psi;
+//			if (parameters.ExecuteScript != null && parameters.ExecuteScript.Length > 0) {
+//				customStartup = true;
+//				psi = new ProcessStartInfo("\"" + parameters.ExecuteScript + "\"", args);
+//			} else {
+//				if (parameters.CompileTarget == CompileTarget.Library) {
+//					
+//					MessageService.ShowError("${res:BackendBindings.ExecutionManager.CantExecuteDLLError}");
+//					return;
+//				}
+//			
+//				string runtimeStarter = String.Empty;
+//				
+//				switch (parameters.NetRuntime) {
+//					case NetRuntime.Mono:
+//						runtimeStarter = "mono ";
+//						break;
+//					case NetRuntime.MonoInterpreter:
+//						runtimeStarter = "mint ";
+//						break;
+//				}
+//				
+//				if (parameters.CompileTarget != CompileTarget.WinExe && parameters.PauseConsoleOutput) {
+//					psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c " + runtimeStarter + "\"" + directory + exe + "\" " + args +  " & pause");
+//				} else {
+//					psi = new ProcessStartInfo(runtimeStarter + "\"" + directory + exe + "\"");
+//					psi.Arguments = args;
+//				}
+//			}
+//			
+//			psi.WorkingDirectory = Path.GetDirectoryName(directory);
+//			psi.UseShellExecute  =  false;
+//			DebuggerService DebuggerService  = (DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService));
+//			if (debug && !customStartup) {
+//				DebuggerService.Start(Path.Combine(directory, exe), directory, args);
+//			} else {
+//				DebuggerService.StartWithoutDebugging(psi);
+//			}
+//		}
+//	}
+//}

Added: corsavy-addin/trunk/Src/NemerleCompletionBinding.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/NemerleCompletionBinding.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,277 @@
+ďťż// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Daniel Grunwald" email="daniel at danielgrunwald.de"/>
+//     <version>$Revision: 614 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using ICSharpCode.Core;
+using ICSharpCode.TextEditor.Gui.CompletionWindow;
+using ICSharpCode.TextEditor.Document;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
+using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
+using ICSharpCode.NRefactory.Parser;
+using CSTokens = ICSharpCode.NRefactory.Parser.CSharp.Tokens;
+
+namespace NemerleBinding
+{
+	public class NemerleCompletionBinding : DefaultCodeCompletionBinding
+	{
+		public override bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
+		{
+			Parser.ExpressionFinder ef = new Parser.ExpressionFinder(editor.FileName);
+			int cursor = editor.ActiveTextAreaControl.Caret.Offset;
+			ExpressionContext context = null;
+			if (ch == '(') {
+				if (CodeCompletionOptions.KeywordCompletionEnabled) {
+					switch (editor.GetWordBeforeCaret().Trim()) {
+						case "for":
+						case "lock":
+							context = ExpressionContext.Default;
+							break;
+						case "using":
+							context = ExpressionContext.TypeDerivingFrom(ReflectionReturnType.Disposable.GetUnderlyingClass(), false);
+							break;
+						case "catch":
+							context = ExpressionContext.TypeDerivingFrom(ReflectionReturnType.Exception.GetUnderlyingClass(), false);
+							break;
+						case "foreach":
+						case "typeof":
+						case "sizeof":
+						case "default":
+							context = ExpressionContext.Type;
+							break;
+					}
+				}
+				if (context != null) {
+					if (IsInComment(editor)) return false;
+					editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(context), ch);
+					return true;
+				} else if (EnableMethodInsight && CodeCompletionOptions.InsightEnabled) {
+					editor.ShowInsightWindow(new MethodInsightDataProvider());
+					return true;
+				}
+				return false;
+			} else if (ch == '[') {
+				LineSegment line = editor.Document.GetLineSegmentForOffset(cursor);
+				if (TextUtilities.FindPrevWordStart(editor.Document, cursor) <= line.Offset) {
+					// [ is first character on the line
+					// -> Attribute completion
+					editor.ShowCompletionWindow(new AttributesDataProvider(), ch);
+					return true;
+				}
+			} else if (ch == ',' && CodeCompletionOptions.InsightRefreshOnComma && CodeCompletionOptions.InsightEnabled) {
+				// Show MethodInsightWindow or IndexerInsightWindow
+				string documentText = editor.Text;
+				int oldCursor = cursor;
+				string textWithoutComments = ef.FilterComments(documentText, ref cursor);
+				int commentLength = oldCursor - cursor;
+				if (textWithoutComments != null) {
+					Stack<ResolveResult> parameters = new Stack<ResolveResult>();
+					char c = '\0';
+					while (cursor > 0) {
+						while (--cursor > 0 &&
+						       ((c = textWithoutComments[cursor]) == ',' ||
+						        char.IsWhiteSpace(c)));
+						if (c == '(') {
+							ShowInsight(editor, new MethodInsightDataProvider(cursor + commentLength, true), parameters, ch);
+							return true;
+						} else if (c == '[') {
+							ShowInsight(editor, new IndexerInsightDataProvider(cursor + commentLength, true), parameters, ch);
+							return true;
+						}
+						string expr = ef.FindExpressionInternal(textWithoutComments, cursor);
+						if (expr == null || expr.Length == 0)
+							break;
+						parameters.Push(ParserService.Resolve(new ExpressionResult(expr),
+						                                      editor.ActiveTextAreaControl.Caret.Line,
+						                                      editor.ActiveTextAreaControl.Caret.Column,
+						                                      editor.FileName,
+						                                      documentText));
+						cursor = ef.LastExpressionStartPosition;
+					}
+				}
+			} else if(ch == '=') {
+				LineSegment curLine = editor.Document.GetLineSegmentForOffset(cursor);
+				string documentText = editor.Text;
+				int position = editor.ActiveTextAreaControl.Caret.Offset - 2;
+				
+				if (position > 0 && (documentText[position + 1] == '+')) {
+					ExpressionResult result = ef.FindFullExpression(documentText, position);
+					
+					if(result.Expression != null) {
+						ResolveResult resolveResult = ParserService.Resolve(result, editor.ActiveTextAreaControl.Caret.Line, editor.ActiveTextAreaControl.Caret.Column, editor.FileName, documentText);
+						if (resolveResult != null && resolveResult.ResolvedType != null) {
+							IClass underlyingClass = resolveResult.ResolvedType.GetUnderlyingClass();
+							if (underlyingClass != null && underlyingClass.IsTypeInInheritanceTree(ProjectContentRegistry.Mscorlib.GetClass("System.MulticastDelegate"))) {
+								EventHandlerCompletitionDataProvider eventHandlerProvider = new EventHandlerCompletitionDataProvider(result.Expression, resolveResult);
+								eventHandlerProvider.InsertSpace = true;
+								editor.ShowCompletionWindow(eventHandlerProvider, ch);
+							}
+						}
+					}
+				}
+			} else if (ch == ';') {
+				LineSegment curLine = editor.Document.GetLineSegmentForOffset(cursor);
+				// don't return true when inference succeeds, otherwise the ';' won't be added to the document.
+				TryDeclarationTypeInference(editor, curLine);
+			}
+			
+			return base.HandleKeyPress(editor, ch);
+		}
+		
+		bool TryDeclarationTypeInference(SharpDevelopTextAreaControl editor, LineSegment curLine)
+		{
+			string lineText = editor.Document.GetText(curLine.Offset, curLine.Length);
+			ILexer lexer = ParserFactory.CreateLexer(SupportedLanguage.CSharp, new System.IO.StringReader(lineText));
+			Token typeToken = lexer.NextToken();
+			if (typeToken.kind == CSTokens.Question) {
+				if (lexer.NextToken().kind == CSTokens.Identifier) {
+					Token t = lexer.NextToken();
+					if (t.kind == CSTokens.Assign) {
+						string expr = lineText.Substring(t.col);
+						LoggingService.Debug("DeclarationTypeInference: >" + expr + "<");
+						ResolveResult rr = ParserService.Resolve(new ExpressionResult(expr),
+						                                         editor.ActiveTextAreaControl.Caret.Line,
+						                                         t.col, editor.FileName,
+						                                         editor.Document.TextContent);
+						if (rr != null && rr.ResolvedType != null) {
+							ClassFinder context = new ClassFinder(editor.FileName, editor.ActiveTextAreaControl.Caret.Line, t.col);
+							if (ICSharpCode.SharpDevelop.Refactoring.CodeGenerator.CanUseShortTypeName(rr.ResolvedType, context))
+								NemerleAmbience.Instance.ConversionFlags = ConversionFlags.None;
+							else
+								NemerleAmbience.Instance.ConversionFlags = ConversionFlags.UseFullyQualifiedNames;
+							string typeName = NemerleAmbience.Instance.Convert(rr.ResolvedType);
+							editor.Document.Replace(curLine.Offset + typeToken.col - 1, 1, typeName);
+							editor.ActiveTextAreaControl.Caret.Column += typeName.Length - 1;
+							return true;
+						}
+					}
+				}
+			}
+			return false;
+		}
+		
+		void ShowInsight(SharpDevelopTextAreaControl editor, MethodInsightDataProvider dp, Stack<ResolveResult> parameters, char charTyped)
+		{
+			int paramCount = parameters.Count;
+			dp.SetupDataProvider(editor.FileName, editor.ActiveTextAreaControl.TextArea);
+			List<IMethodOrProperty> methods = dp.Methods;
+			if (methods.Count == 0) return;
+			bool overloadIsSure;
+			if (methods.Count == 1) {
+				overloadIsSure = true;
+				dp.DefaultIndex = 0;
+			} else {
+				IReturnType[] parameterTypes = new IReturnType[paramCount + 1];
+				for (int i = 0; i < paramCount; i++) {
+					ResolveResult rr = parameters.Pop();
+					if (rr != null) {
+						parameterTypes[i] = rr.ResolvedType;
+					}
+				}
+				IReturnType[][] tmp;
+				int[] ranking = MemberLookupHelper.RankOverloads(methods, parameterTypes, true, out overloadIsSure, out tmp);
+				bool multipleBest = false;
+				int bestRanking = -1;
+				int best = 0;
+				for (int i = 0; i < ranking.Length; i++) {
+					if (ranking[i] > bestRanking) {
+						bestRanking = ranking[i];
+						best = i;
+						multipleBest = false;
+					} else if (ranking[i] == bestRanking) {
+						multipleBest = true;
+					}
+				}
+				if (multipleBest) overloadIsSure = false;
+				dp.DefaultIndex = best;
+			}
+			editor.ShowInsightWindow(dp);
+			if (overloadIsSure) {
+				IMethodOrProperty method = methods[dp.DefaultIndex];
+				if (paramCount < method.Parameters.Count) {
+					IParameter param = method.Parameters[paramCount];
+					ProvideContextCompletion(editor, param.ReturnType, charTyped);
+				}
+			}
+		}
+		
+		void ProvideContextCompletion(SharpDevelopTextAreaControl editor, IReturnType expected, char charTyped)
+		{
+			IClass c = expected.GetUnderlyingClass();
+			if (c == null) return;
+			if (c.ClassType == ClassType.Enum) {
+				CtrlSpaceCompletionDataProvider cdp = new CtrlSpaceCompletionDataProvider();
+				cdp.ForceNewExpression = true;
+				CachedCompletionDataProvider cache = new CachedCompletionDataProvider(cdp);
+				cache.GenerateCompletionData(editor.FileName, editor.ActiveTextAreaControl.TextArea, charTyped);
+				ICompletionData[] completionData = cache.CompletionData;
+				Array.Sort(completionData);
+				for (int i = 0; i < completionData.Length; i++) {
+					CodeCompletionData ccd = completionData[i] as CodeCompletionData;
+					if (ccd != null && ccd.Class != null) {
+						if (ccd.Class.FullyQualifiedName == expected.FullyQualifiedName) {
+							cache.DefaultIndex = i;
+							break;
+						}
+					}
+				}
+				if (cache.DefaultIndex >= 0) {
+					cache.InsertSpace = true;
+					editor.ShowCompletionWindow(cache, charTyped);
+				}
+			}
+		}
+		
+		bool IsInComment(SharpDevelopTextAreaControl editor)
+		{
+			Parser.ExpressionFinder ef = new Parser.ExpressionFinder(editor.FileName);
+			int cursor = editor.ActiveTextAreaControl.Caret.Offset - 1;
+			return ef.FilterComments(editor.Document.GetText(0, cursor + 1), ref cursor) == null;
+		}
+		
+		public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word)
+		{
+			// TODO: Assistance writing Methods/Fields/Properties/Events:
+			// use public/static/etc. as keywords to display a list with other modifiers
+			// and possible return types.
+			switch (word) {
+				case "using":
+					if (IsInComment(editor)) return false;
+					// TODO: check if we are inside class/namespace
+					editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Namespace), ' ');
+					return true;
+				case "as":
+				case "is":
+					if (IsInComment(editor)) return false;
+					editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Type), ' ');
+					return true;
+				case "override":
+					// TODO: Suggest list of virtual methods to override
+					return false;
+				case "new":
+					return ShowNewCompletion(editor);
+				default:
+					return base.HandleKeyword(editor, word);
+			}
+		}
+		
+		bool ShowNewCompletion(SharpDevelopTextAreaControl editor)
+		{
+			Parser.ExpressionFinder ef = new Parser.ExpressionFinder(editor.FileName);
+			int cursor = editor.ActiveTextAreaControl.Caret.Offset;
+			ExpressionContext context = ef.FindExpression(editor.Document.GetText(0, cursor) + " T.", cursor + 2).Context;
+			if (context.IsObjectCreation) {
+				editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(context), ' ');
+				return true;
+			}
+			return false;
+		}
+	}
+}

Added: corsavy-addin/trunk/Src/NemerleLanguageBinding.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/NemerleLanguageBinding.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,101 @@
+ďťż// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Mike KrĂźger" email="mike at icsharpcode.net"/>
+//     <version>$Revision: 230 $</version>
+// </file>
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using System.Resources;
+using System.Windows.Forms;
+using System.Xml;
+using System.CodeDom.Compiler;
+using System.Threading;
+
+using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.SharpDevelop.Internal.Templates;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.Core;
+
+namespace NemerleBinding
+{
+	public class NemerleLanguageBinding : ILanguageBinding
+	{
+		public const string LanguageName = "C#";
+		
+		public string Language {
+			get {
+				return LanguageName;
+			}
+		}
+		
+		#region routines for single file compilation
+		public bool CanCompile(string fileName)
+		{
+			Debug.Assert(fileName != null);
+			
+			string ext = Path.GetExtension(fileName);
+			if (ext == null) {
+				return false;
+			}
+			return ext.ToUpper() == ".N";
+		}
+		
+		public string GetCompiledOutputName(string fileName)
+		{
+			Debug.Assert(CanCompile(fileName));
+			
+			return Path.ChangeExtension(fileName, ".exe");
+		}
+		
+		public CompilerResults CompileFile(string fileName)
+		{
+			Debug.Assert(CanCompile(fileName));
+			
+			// TODO: Implement me!
+			return null;
+		}
+		
+		public void Execute(string fileName, bool debug)
+		{
+			string exe = GetCompiledOutputName(fileName);
+			
+			
+			if (debug) {
+				ProcessStartInfo psi = new ProcessStartInfo();
+				psi.FileName = exe;
+				psi.WorkingDirectory = Path.GetDirectoryName(exe);
+				psi.Arguments = "";
+
+				DebuggerService.CurrentDebugger.Start(psi);
+			} else {
+				ProcessStartInfo psi = new ProcessStartInfo();
+				psi.FileName = Environment.GetEnvironmentVariable("ComSpec");
+				psi.WorkingDirectory = Path.GetDirectoryName(exe);
+				psi.Arguments = "/c " + "\"" + exe + "\"" + " & pause";
+				psi.UseShellExecute = false;
+				
+				DebuggerService.CurrentDebugger.StartWithoutDebugging(psi);
+			}
+		}
+		#endregion
+		
+		public IProject LoadProject(string fileName, string projectName)
+		{
+			return new NemerleProject(fileName, projectName);
+		}
+		
+		public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
+		{
+			NemerleProject p = new NemerleProject(info);
+			if (projectOptions != null) {
+				p.ImportOptions(projectOptions.Attributes);
+			}
+			return p;
+		}
+	}
+}

Added: corsavy-addin/trunk/Src/OptionPanels/BuildOptions.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/OptionPanels/BuildOptions.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,71 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="Daniel Grunwald" email="daniel at danielgrunwald.de"/>
+//     <version>$Revision: 549 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Gui.XmlForms;
+using ICSharpCode.SharpDevelop.Gui.OptionPanels;
+
+using StringPair = System.Collections.Generic.KeyValuePair<string, string>;
+
+namespace NemerleBinding.OptionPanels
+{
+	public class BuildOptions : AbstractBuildOptions
+	{
+		public override void LoadPanelContents()
+		{
+			SetupFromXmlResource("BuildOptions.xfrm");
+			InitializeHelper();
+			
+			InitOutputPath();
+			InitXmlDoc();
+			InitTargetFramework(NemerleProject.DefaultTargetsFile,
+			                    @"$(SharpDevelopBinPath)\SharpDevelop.Build.Nemerle.targets");
+			
+			ConfigurationGuiBinding b;
+			
+			b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants");
+			b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
+			b.CreateLocationButton("conditionalSymbolsTextBox");
+			
+			b = helper.BindBoolean("optimizeCodeCheckBox", "Optimize", false);
+			b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
+			b.CreateLocationButton("optimizeCodeCheckBox");
+			
+			b = helper.BindBoolean("allowUnsafeCodeCheckBox", "AllowUnsafeBlocks", false);
+			b.CreateLocationButton("allowUnsafeCodeCheckBox");
+			
+			b = helper.BindBoolean("checkForOverflowCheckBox", "CheckForOverflowUnderflow", false);
+			b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
+			b.CreateLocationButton("checkForOverflowCheckBox");
+			
+			b = helper.BindBoolean("noCorlibCheckBox", "NoStdLib", false);
+			b.CreateLocationButton("noCorlibCheckBox");
+			
+			InitAdvanced();
+			b = helper.BindStringEnum("fileAlignmentComboBox", "FileAlignment",
+			                          "4096",
+			                          new StringPair("512", "512"),
+			                          new StringPair("1024", "1024"),
+			                          new StringPair("2048", "2048"),
+			                          new StringPair("4096", "4096"),
+			                          new StringPair("8192", "8192"));
+			b.DefaultLocation = PropertyStorageLocations.PlatformSpecific;
+			b.RegisterLocationButton(advancedLocationButton);
+			
+			InitWarnings();
+			
+			helper.AddConfigurationSelector(this);
+		}
+	}
+}

Added: corsavy-addin/trunk/Src/Project/NemerleProject.cs
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/Src/Project/NemerleProject.cs	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,65 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
+//     <license see="prj:///doc/license.txt">GNU General Public License</license>
+//     <owner name="none" email=""/>
+//     <version>$Revision: 549 $</version>
+// </file>
+
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using System.Resources;
+using System.Windows.Forms;
+using System.Xml;
+using System.CodeDom.Compiler;
+using System.Threading;
+
+using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.SharpDevelop.Internal.Templates;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.Core;
+
+namespace NemerleBinding
+{
+	public class NemerleProject : MSBuildProject
+	{
+		[Browsable(false)]
+		public override IAmbience Ambience {
+			get {
+				return NemerleAmbience.Instance;
+			}
+		}
+		
+		public NemerleProject(string fileName, string projectName)
+		{
+			this.Name = projectName;
+			Language = "Nemerle";
+			SetupProject(fileName);
+			IdGuid = BaseConfiguration["ProjectGuid"];
+		}
+		
+		public NemerleProject(ProjectCreateInformation info)
+		{
+			Language = "Nemerle";
+			Create(info);
+		}
+		
+		public const string DefaultTargetsFile = @"$(MSBuildBinPath)\Microsoft.CSharp.Targets";
+		
+		protected override void Create(ProjectCreateInformation information)
+		{
+			base.Create(information);
+			imports.Add(DefaultTargetsFile);
+			SetProperty("Debug", null, "CheckForOverflowUnderflow", "True", PropertyStorageLocations.ConfigurationSpecific);
+			SetProperty("Release", null, "CheckForOverflowUnderflow", "False", PropertyStorageLocations.ConfigurationSpecific);
+		}
+		
+		public override bool CanCompile(string fileName)
+		{
+			return new NemerleLanguageBinding().CanCompile(fileName);
+		}
+	}
+}

Added: corsavy-addin/trunk/svn-commit.tmp
==============================================================================
--- (empty file)
+++ corsavy-addin/trunk/svn-commit.tmp	Sat Nov  5 23:41:47 2005
@@ -0,0 +1,4 @@
+Initial, based on CSharpAddin.
+--This line, and those below, will be ignored--
+
+A    .



More information about the svn mailing list