Browse Source

Updated to IronPython 2.0 Beta 5.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3553 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 18 years ago
parent
commit
c5c59e9a43
  1. 2
      src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs
  2. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs
  3. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs
  4. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs
  5. 8
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonParser.cs
  6. 14
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonVariableResolver.cs
  7. 5
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/TextEditor.cs
  8. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs
  9. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/IronPythonParserTestFixture.cs

2
src/AddIns/BackendBindings/Python/Python.Build.Tasks/Project/Src/PythonCompiler.cs

@ -93,7 +93,7 @@ namespace ICSharpCode.Python.Build.Tasks
public void Compile() public void Compile()
{ {
// Compile the source files to a dll first. // Compile the source files to a dll first.
ScriptEngine engine = PythonEngine.CurrentEngine; ScriptEngine engine = IronPython.Hosting.Python.CreateEngine();
PythonDictionary dictionary = new PythonDictionary(); PythonDictionary dictionary = new PythonDictionary();
dictionary.setdefault("mainModule", mainFile); dictionary.setdefault("mainModule", mainFile);
string outputAssemblyDll = Path.ChangeExtension(outputAssembly, ".dll"); string outputAssemblyDll = Path.ChangeExtension(outputAssembly, ".dll");

3
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonAstWalker.cs

@ -5,10 +5,11 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Scripting;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
using IronPython.Compiler; using IronPython.Compiler;
using IronPython.Compiler.Ast; using IronPython.Compiler.Ast;

2
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerError.cs

@ -5,8 +5,8 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting;
using System; using System;
using System.Scripting;
namespace ICSharpCode.PythonBinding namespace ICSharpCode.PythonBinding
{ {

2
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCompilerSink.cs

@ -5,9 +5,9 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Scripting;
namespace ICSharpCode.PythonBinding namespace ICSharpCode.PythonBinding
{ {

8
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonParser.cs

@ -5,11 +5,11 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting.Compilers; using Microsoft.Scripting;
using Microsoft.Scripting.Hosting; using Microsoft.Scripting.Hosting;
using Microsoft.Scripting.Runtime;
using System; using System;
using System.IO; using System.IO;
using System.Scripting;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
@ -83,13 +83,13 @@ namespace ICSharpCode.PythonBinding
if (fileContent != null) { if (fileContent != null) {
// try { // try {
if (scriptEngine == null) { if (scriptEngine == null) {
scriptEngine = PythonEngine.CurrentEngine; scriptEngine = IronPython.Hosting.Python.CreateEngine();
} }
PythonCompilerSink sink = new PythonCompilerSink(); PythonCompilerSink sink = new PythonCompilerSink();
SourceUnit source = DefaultContext.DefaultPythonContext.CreateFileUnit(fileName, fileContent); SourceUnit source = DefaultContext.DefaultPythonContext.CreateFileUnit(fileName, fileContent);
CompilerContext context = new CompilerContext(source, new PythonCompilerOptions(), sink); CompilerContext context = new CompilerContext(source, new PythonCompilerOptions(), sink);
Parser parser = Parser.CreateParser(context, new PythonEngineOptions()); Parser parser = Parser.CreateParser(context, new PythonOptions());
PythonAst ast = parser.ParseFile(false); PythonAst ast = parser.ParseFile(false);
PythonAstWalker walker = new PythonAstWalker(projectContent, fileName); PythonAstWalker walker = new PythonAstWalker(projectContent, fileName);

14
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonVariableResolver.cs

@ -5,11 +5,11 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting.Compilers; using Microsoft.Scripting;
using Microsoft.Scripting.Hosting; using Microsoft.Scripting.Hosting;
using Microsoft.Scripting.Runtime;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Scripting;
using System.Text; using System.Text;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
@ -51,20 +51,14 @@ namespace ICSharpCode.PythonBinding
public string Resolve(string variableName, string fileName, string code) public string Resolve(string variableName, string fileName, string code)
{ {
if (code != null) { if (code != null) {
ScriptEngine scriptEngine = PythonEngine.CurrentEngine; ScriptEngine scriptEngine = IronPython.Hosting.Python.CreateEngine();
PythonCompilerSink sink = new PythonCompilerSink(); PythonCompilerSink sink = new PythonCompilerSink();
SourceUnit source = DefaultContext.DefaultPythonContext.CreateFileUnit(fileName, code); SourceUnit source = DefaultContext.DefaultPythonContext.CreateFileUnit(fileName, code);
CompilerContext context = new CompilerContext(source, new PythonCompilerOptions(), sink); CompilerContext context = new CompilerContext(source, new PythonCompilerOptions(), sink);
Parser parser = Parser.CreateParser(context, new PythonEngineOptions()); Parser parser = Parser.CreateParser(context, new PythonOptions());
PythonAst ast = parser.ParseFile(false); PythonAst ast = parser.ParseFile(false);
return Resolve(variableName, ast); return Resolve(variableName, ast);
//PythonCompilerSink sink = new PythonCompilerSink();
//CompilerContext context = new CompilerContext(null, sink);
//Parser parser = Parser.FromString(null, context, code);
//Statement statement = parser.ParseFileInput();
//return Resolve(variableName, statement);
} }
return null; return null;
} }

5
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/TextEditor.cs

@ -16,6 +16,7 @@ namespace ICSharpCode.PythonBinding
public class TextEditor : ITextEditor public class TextEditor : ITextEditor
{ {
delegate string GetLineInvoker(int index); delegate string GetLineInvoker(int index);
delegate void WriteInvoker(string text, Color color);
TextEditorControl textEditorControl; TextEditorControl textEditorControl;
TextArea textArea; TextArea textArea;
@ -56,8 +57,8 @@ namespace ICSharpCode.PythonBinding
public void Write(string text, Color backgroundColour) public void Write(string text, Color backgroundColour)
{ {
if (textEditorControl.InvokeRequired) { if (textEditorControl.InvokeRequired) {
Action<string, Color> action = Write; WriteInvoker invoker = new WriteInvoker(Write);
textEditorControl.Invoke(action, new object[] {text, backgroundColour}); textEditorControl.Invoke(invoker, new object[] {text, backgroundColour});
} else { } else {
int offset = textEditorControl.Document.PositionToOffset(new TextLocation(Column, Line)); int offset = textEditorControl.Document.PositionToOffset(new TextLocation(Column, Line));
textEditorControl.ActiveTextAreaControl.TextArea.InsertString(text); textEditorControl.ActiveTextAreaControl.TextArea.InsertString(text);

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs

@ -37,7 +37,7 @@ namespace PythonBinding.Tests.Console
textEditor = new TextEditor(textEditorControl); textEditor = new TextEditor(textEditorControl);
host = new DerivedPythonConsoleHost(textEditor); host = new DerivedPythonConsoleHost(textEditor);
ScriptRuntime runtime = ScriptRuntime.Create(); ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime();
// expectedEngine = runtime.GetEngine(typeof(PythonContext)); // expectedEngine = runtime.GetEngine(typeof(PythonContext));
// host.ScriptEngineToReturn = expectedEngine; // host.ScriptEngineToReturn = expectedEngine;
// engine = host.CallCreateEngine(); // engine = host.CallCreateEngine();

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/IronPythonParserTestFixture.cs

@ -5,7 +5,7 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using Microsoft.Scripting.Compilers; using Microsoft.Scripting.Runtime;
using System; using System;
using System.CodeDom; using System.CodeDom;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;

Loading…
Cancel
Save