Browse Source

Add InterpreterWrapper.boo.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@618 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
4d14446434
  1. 1
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj
  2. 15
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo
  3. 35
      src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo
  4. 7
      src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin
  5. 3
      src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj
  6. 1
      src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj
  7. 0
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd
  8. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml
  9. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd

1
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/Boo.InterpreterAddIn.booproj

@ -33,6 +33,7 @@
<Compile Include="CodeCompletionData.boo" /> <Compile Include="CodeCompletionData.boo" />
<Compile Include="InteractiveInterpreterControl.boo" /> <Compile Include="InteractiveInterpreterControl.boo" />
<Compile Include="InterpreterPad.boo" /> <Compile Include="InterpreterPad.boo" />
<Compile Include="InterpreterWrapper.boo" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj"> <ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">

15
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InteractiveInterpreterControl.boo

@ -133,7 +133,7 @@ class InteractiveInterpreterControl(TextEditorControl):
_block = System.IO.StringWriter() _block = System.IO.StringWriter()
[getter(Interpreter)] [getter(Interpreter)]
_interpreter as Boo.Lang.Interpreter.InteractiveInterpreter _interpreter = InterpreterWrapper()
_codeCompletionWindow as CodeCompletionWindow _codeCompletionWindow as CodeCompletionWindow
@ -148,10 +148,8 @@ class InteractiveInterpreterControl(TextEditorControl):
_blockKeys = false _blockKeys = false
def constructor(): def constructor():
self._interpreter = Boo.Lang.Interpreter.InteractiveInterpreter( self._interpreter.LinePrinted += self.print
RememberLastValue: true, self._interpreter.Cleared += self.cls
Print: self.print)
self._interpreter.SetValue("cls", cls)
self._lineHistory = LineHistory(CurrentLineChanged: _lineHistory_CurrentLineChanged) self._lineHistory = LineHistory(CurrentLineChanged: _lineHistory_CurrentLineChanged)
self.Document.HighlightingStrategy = GetBooHighlighting() self.Document.HighlightingStrategy = GetBooHighlighting()
self.EnableFolding = false self.EnableFolding = false
@ -178,7 +176,7 @@ class InteractiveInterpreterControl(TextEditorControl):
def Eval(code as string): def Eval(code as string):
try: try:
_interpreter.LoopEval(code) _interpreter.RunCommand(code)
ensure: ensure:
_state = InputState.SingleLine _state = InputState.SingleLine
@ -332,8 +330,3 @@ class InteractiveInterpreterControl(TextEditorControl):
def GetBooHighlighting(): def GetBooHighlighting():
return HighlightingManager.Manager.FindHighlighter("Boo") return HighlightingManager.Manager.FindHighlighter("Boo")
static def InstallDefaultSyntaxModeProvider():
HighlightingManager.Manager.AddSyntaxModeFileProvider(
FileSyntaxModeProvider(Path.GetDirectoryName(Application.ExecutablePath)))

35
src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo

@ -0,0 +1,35 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
namespace Boo.InterpreterAddIn
import System
import System.Windows.Forms
class InterpreterWrapper:
_interpreter as Boo.Lang.Interpreter.InteractiveInterpreter
def constructor():
_interpreter = Boo.Lang.Interpreter.InteractiveInterpreter(
RememberLastValue: true,
Print: self.OnPrintLine)
_interpreter.SetValue("cls", { Cleared() })
event LinePrinted as callable(string)
event Cleared as MethodInvoker
private def OnPrintLine(text as string):
LinePrinted(text)
def RunCommand(code as string):
_interpreter.LoopEval(code)
def SuggestCodeCompletion(code as string):
// David: the code completion items have to be passed as strings;
// but it's not important, you can return null if you want.
return _interpreter.SuggestCodeCompletion(code)

7
src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin

@ -52,13 +52,6 @@
<CodeCompletionBinding id = "Boo" extensions = ".boo" class = "Grunwald.BooBinding.CodeCompletion.CompletionBinding"/> <CodeCompletionBinding id = "Boo" extensions = ".boo" class = "Grunwald.BooBinding.CodeCompletion.CompletionBinding"/>
</Path> </Path>
<Path name = "/SharpDevelop/ViewContent/DefaultTextEditor/SyntaxModes">
<SyntaxMode id = "Boo Syntax Mode"
name = "Boo"
extensions = ".boo"
resource = "Grunwald.BooBinding.Resources.Boo.xshd" />
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings"> <Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "BooFormDesigner" <DisplayBinding id = "BooFormDesigner"
type = "Secondary" type = "Secondary"

3
src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj

@ -61,9 +61,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Resources\Boo.xshd">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<Compile Include="Src\AssemblyInfo.cs" /> <Compile Include="Src\AssemblyInfo.cs" />
<Compile Include="Src\BooProject.cs" /> <Compile Include="Src\BooProject.cs" />
<Compile Include="Src\BooLanguageBinding.cs" /> <Compile Include="Src\BooLanguageBinding.cs" />

1
src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj

@ -182,6 +182,7 @@
<EmbeddedResource Include="Resources\XML-Mode.xshd" /> <EmbeddedResource Include="Resources\XML-Mode.xshd" />
<Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" /> <Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" />
<Compile Include="Src\Util\FileReader.cs" /> <Compile Include="Src\Util\FileReader.cs" />
<EmbeddedResource Include="Resources\Boo.xshd" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project> </Project>

0
src/AddIns/BackendBindings/Boo/BooBinding/Project/Resources/Boo.xshd → src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd

6
src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml

@ -7,6 +7,10 @@
name = "BAT" name = "BAT"
extensions = ".bat"/> extensions = ".bat"/>
<Mode file = "Boo.xshd"
name = "Boo"
extensions = ".boo"/>
<Mode file = "Coco-Mode.xshd" <Mode file = "Coco-Mode.xshd"
name = "Coco" name = "Coco"
extensions = ".atg"/> extensions = ".atg"/>
@ -45,5 +49,5 @@
<Mode file = "XML-Mode.xshd" <Mode file = "XML-Mode.xshd"
name = "XML" name = "XML"
extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets"/> extensions = ".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets"/>
</SyntaxModes> </SyntaxModes>

2
src/Libraries/ICSharpCode.TextEditor/Project/Resources/XML-Mode.xshd

@ -1,6 +1,6 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<!-- syntaxdefinition for XML 2000 by Mike Krueger --> <!-- syntaxdefinition for XML 2000 by Mike Krueger -->
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.proj;.csproj;.vbproj;.ilproj;.build;.xfrm;.targets"> <SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets">
<Properties> <Properties>
<Property name="BlockCommentBegin" value="&lt;!--"/> <Property name="BlockCommentBegin" value="&lt;!--"/>

Loading…
Cancel
Save