Xanathar 11 ani în urmă
părinte
comite
5afe7f22c5

+ 47 - 0
src/MoonSharp.Debugger/MainForm.Designer.cs

@@ -0,0 +1,47 @@
+namespace MoonSharp.Debugger
+{
+	partial class MainForm
+	{
+		/// <summary>
+		/// Required designer variable.
+		/// </summary>
+		private System.ComponentModel.IContainer components = null;
+
+		/// <summary>
+		/// Clean up any resources being used.
+		/// </summary>
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+		protected override void Dispose(bool disposing)
+		{
+			if (disposing && (components != null))
+			{
+				components.Dispose();
+			}
+			base.Dispose(disposing);
+		}
+
+		#region Windows Form Designer generated code
+
+		/// <summary>
+		/// Required method for Designer support - do not modify
+		/// the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+			this.SuspendLayout();
+			// 
+			// MainForm
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.ClientSize = new System.Drawing.Size(1094, 734);
+			this.Name = "MainForm";
+			this.Text = "Moon# Debugger";
+			this.ResumeLayout(false);
+
+		}
+
+		#endregion
+	}
+}
+

+ 19 - 0
src/MoonSharp.Debugger/MainForm.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace MoonSharp.Debugger
+{
+	public partial class MainForm : Form
+	{
+		public MainForm()
+		{
+			InitializeComponent();
+		}
+	}
+}

+ 120 - 0
src/MoonSharp.Debugger/MainForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 84 - 0
src/MoonSharp.Debugger/MoonSharp.Debugger.csproj

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F4F82CCE-2E13-441B-939C-63CF2343B1C9}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Debugger</RootNamespace>
+    <AssemblyName>MoonSharp.Debugger</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MainForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="MainForm.Designer.cs">
+      <DependentUpon>MainForm.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="MainForm.resx">
+      <DependentUpon>MainForm.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 21 - 0
src/MoonSharp.Debugger/Program.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace MoonSharp.Debugger
+{
+	static class Program
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main()
+		{
+			Application.EnableVisualStyles();
+			Application.SetCompatibleTextRenderingDefault(false);
+			Application.Run(new MainForm());
+		}
+	}
+}

+ 36 - 0
src/MoonSharp.Debugger/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Debugger")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Debugger")]
+[assembly: AssemblyCopyright("Copyright ©  2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("43c6203a-fd70-44f6-bdd9-30588e7c9733")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
src/MoonSharp.Debugger/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.34014
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MoonSharp.Debugger.Properties
+{
+
+
+	/// <summary>
+	///   A strongly-typed resource class, for looking up localized strings, etc.
+	/// </summary>
+	// This class was auto-generated by the StronglyTypedResourceBuilder
+	// class via a tool like ResGen or Visual Studio.
+	// To add or remove a member, edit your .ResX file then rerun ResGen
+	// with the /str option, or rebuild your VS project.
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+	[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+	[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+	internal class Resources
+	{
+
+		private static global::System.Resources.ResourceManager resourceMan;
+
+		private static global::System.Globalization.CultureInfo resourceCulture;
+
+		[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+		internal Resources()
+		{
+		}
+
+		/// <summary>
+		///   Returns the cached ResourceManager instance used by this class.
+		/// </summary>
+		[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+		internal static global::System.Resources.ResourceManager ResourceManager
+		{
+			get
+			{
+				if ((resourceMan == null))
+				{
+					global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MoonSharp.Debugger.Properties.Resources", typeof(Resources).Assembly);
+					resourceMan = temp;
+				}
+				return resourceMan;
+			}
+		}
+
+		/// <summary>
+		///   Overrides the current thread's CurrentUICulture property for all
+		///   resource lookups using this strongly typed resource class.
+		/// </summary>
+		[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+		internal static global::System.Globalization.CultureInfo Culture
+		{
+			get
+			{
+				return resourceCulture;
+			}
+			set
+			{
+				resourceCulture = value;
+			}
+		}
+	}
+}

+ 117 - 0
src/MoonSharp.Debugger/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
src/MoonSharp.Debugger/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.34014
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MoonSharp.Debugger.Properties
+{
+
+
+	[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+	internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+	{
+
+		private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+		public static Settings Default
+		{
+			get
+			{
+				return defaultInstance;
+			}
+		}
+	}
+}

+ 7 - 0
src/MoonSharp.Debugger/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 57 - 4
src/MoonSharp.Interpreter.Tests/SimpleTests.cs

@@ -128,15 +128,15 @@ namespace MoonSharp.Interpreter.Tests
 			RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
 			RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
 
 
 			Assert.AreEqual(5, res.Tuple.Length);
 			Assert.AreEqual(5, res.Tuple.Length);
-			Assert.AreEqual(DataType.Boolean, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[0].Type);
 			Assert.AreEqual(DataType.Boolean, res.Tuple[1].Type);
 			Assert.AreEqual(DataType.Boolean, res.Tuple[1].Type);
 			Assert.AreEqual(DataType.Boolean, res.Tuple[2].Type);
 			Assert.AreEqual(DataType.Boolean, res.Tuple[2].Type);
-			Assert.AreEqual(DataType.Boolean, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[3].Type);
 			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
 			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
-			Assert.AreEqual(true, res.Tuple[0].Boolean);
+			Assert.AreEqual("!", res.Tuple[0].String);
 			Assert.AreEqual(true, res.Tuple[1].Boolean);
 			Assert.AreEqual(true, res.Tuple[1].Boolean);
 			Assert.AreEqual(false, res.Tuple[2].Boolean);
 			Assert.AreEqual(false, res.Tuple[2].Boolean);
-			Assert.AreEqual(true, res.Tuple[3].Boolean);
+			Assert.AreEqual("!", res.Tuple[3].String);
 			Assert.AreEqual(2, res.Tuple[4].Number);
 			Assert.AreEqual(2, res.Tuple[4].Number);
 		}
 		}
 		[Test]
 		[Test]
@@ -629,6 +629,59 @@ namespace MoonSharp.Interpreter.Tests
 			Assert.AreEqual(1, res.Tuple[1].Number);
 			Assert.AreEqual(1, res.Tuple[1].Number);
 			Assert.AreEqual(2, res.Tuple[2].Number);
 			Assert.AreEqual(2, res.Tuple[2].Number);
 		}
 		}
+		[Test]
+		public void LoopWithReturn()
+		{
+			string script = @"function Allowed( )
+									for i = 1, 20 do
+  										return false 
+									end
+									return true
+								end
+						Allowed();
+								";
+
+			RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
+
+		}
+		[Test]
+		public void IfWithLongExpr()
+		{
+			string script = @"function Allowed( )
+									for i = 1, 20 do
+									if ( false ) or ( true and true ) or ( 7+i <= 9 and false ) then 
+  										return false 
+									end
+									end		
+									return true
+								end
+						Allowed();
+								";
+
+			RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
+
+		}
+
+		[Test]
+		public void IfWithLongExprTbl()
+		{
+			string script = @"
+						t = { {}, {} }
+						
+						function Allowed( )
+									for i = 1, 20 do
+									if ( t[1][3] ) or ( i <= 17 and t[1][1] ) or ( 7+i <= 9 and t[1][1] ) then 
+  										return false 
+									end
+									end		
+									return true
+								end
+						Allowed();
+								";
+
+			RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
+
+		}
 
 
 	}
 	}
 }
 }

+ 11 - 0
src/MoonSharp.Interpreter/Debugging/IDebugGuest.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MoonSharp.Interpreter.Debugging
+{
+	public interface IDebugGuest
+	{
+	}
+}

+ 13 - 0
src/MoonSharp.Interpreter/Debugging/IDebugger.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MoonSharp.Interpreter.Debugging
+{
+	public interface IDebugger
+	{
+		void Init(IDebugGuest debugGuest);
+		void OnBreak();
+	}
+}

+ 9 - 0
src/MoonSharp.Interpreter/Execution/Script.cs

@@ -48,5 +48,14 @@ namespace MoonSharp.Interpreter.Execution
 			//	return m_Script.ExecRoot(runtimeScope);
 			//	return m_Script.ExecRoot(runtimeScope);
 			//}
 			//}
 		}
 		}
+
+		public RValue OldExecute()
+		{
+			using (var _ = new CodeChrono("MoonSharpScript.Execute"))
+			{
+				return m_Script.ExecRoot(runtimeScope);
+			}
+		}
+
 	}
 	}
 }
 }

+ 2 - 2
src/MoonSharp.Interpreter/Execution/VM/Chunk.cs

@@ -128,13 +128,13 @@ namespace MoonSharp.Interpreter.Execution.VM
 			return Emit(new Instruction() { OpCode = OpCode.Bool });
 			return Emit(new Instruction() { OpCode = OpCode.Bool });
 		}
 		}
 
 
-		[Conditional("EMIT_DEBUG_OPS")]
+		//[Conditional("EMIT_DEBUG_OPS")]
 		public void Debug(string str)
 		public void Debug(string str)
 		{
 		{
 			Emit(new Instruction() { OpCode = OpCode.Debug, Name = str.Substring(0, Math.Min(32, str.Length)) });
 			Emit(new Instruction() { OpCode = OpCode.Debug, Name = str.Substring(0, Math.Min(32, str.Length)) });
 		}
 		}
 
 
-		[Conditional("EMIT_DEBUG_OPS")]
+		//[Conditional("EMIT_DEBUG_OPS")]
 		public void Debug(Antlr4.Runtime.Tree.IParseTree parseTree)
 		public void Debug(Antlr4.Runtime.Tree.IParseTree parseTree)
 		{
 		{
 			string str = parseTree.GetText();
 			string str = parseTree.GetText();

+ 33 - 5
src/MoonSharp.Interpreter/Execution/VM/VmExecutor.cs

@@ -8,12 +8,18 @@ namespace MoonSharp.Interpreter.Execution.VM
 {
 {
 	sealed class VmExecutor
 	sealed class VmExecutor
 	{
 	{
+		public class CallStackItem
+		{
+			public int IP;
+			public int SP;
+		}
+
 		Chunk m_RootChunk;
 		Chunk m_RootChunk;
 		Chunk m_CurChunk;
 		Chunk m_CurChunk;
 		int m_InstructionPtr;
 		int m_InstructionPtr;
 
 
 		List<RValue> m_ValueStack = new List<RValue>();
 		List<RValue> m_ValueStack = new List<RValue>();
-		List<int> m_ExecutionStack = new List<int>();
+		List<CallStackItem> m_ExecutionStack = new List<CallStackItem>();
 		bool m_Terminate = false;
 		bool m_Terminate = false;
 
 
 		RuntimeScope m_Scope;
 		RuntimeScope m_Scope;
@@ -419,18 +425,20 @@ namespace MoonSharp.Interpreter.Execution.VM
 
 
 			if (i.NumVal == 0)
 			if (i.NumVal == 0)
 			{
 			{
+				int retpoint = PopToBasePointer();
 				var argscnt = (int)(m_ValueStack.Pop().Number);
 				var argscnt = (int)(m_ValueStack.Pop().Number);
 				m_ValueStack.RemoveLast(argscnt + 1);
 				m_ValueStack.RemoveLast(argscnt + 1);
-				m_InstructionPtr = m_ExecutionStack.Pop();
 				m_ValueStack.Push(RValue.Nil);
 				m_ValueStack.Push(RValue.Nil);
+				m_InstructionPtr = retpoint;
 			}
 			}
 			else if (i.NumVal == 1)
 			else if (i.NumVal == 1)
 			{
 			{
 				var retval = m_ValueStack.Pop();
 				var retval = m_ValueStack.Pop();
+				int retpoint = PopToBasePointer();
 				var argscnt = (int)(m_ValueStack.Pop().Number);
 				var argscnt = (int)(m_ValueStack.Pop().Number);
 				m_ValueStack.RemoveLast(argscnt + 1);
 				m_ValueStack.RemoveLast(argscnt + 1);
 				m_ValueStack.Push(retval);
 				m_ValueStack.Push(retval);
-				m_InstructionPtr = m_ExecutionStack.Pop();
+				m_InstructionPtr = retpoint;
 			}
 			}
 			else
 			else
 			{
 			{
@@ -438,6 +446,22 @@ namespace MoonSharp.Interpreter.Execution.VM
 			}
 			}
 		}
 		}
 
 
+		private int PopToBasePointer()
+		{
+			var xs = m_ExecutionStack.Pop();
+			m_ValueStack.CropAtCount(xs.SP);
+			return xs.IP;
+		}
+
+		private int PopExecStackAndCheckVStack(int vstackguard)
+		{
+			var xs = m_ExecutionStack.Pop();
+			if (vstackguard != xs.SP)
+				throw new InternalErrorException("StackGuard violation");
+
+			return xs.IP;
+		}
+
 		private void ExecArgs(Instruction I)
 		private void ExecArgs(Instruction I)
 		{
 		{
 			for (int i = 0; i < I.SymbolList.Length; i++)
 			for (int i = 0; i < I.SymbolList.Length; i++)
@@ -460,7 +484,11 @@ namespace MoonSharp.Interpreter.Execution.VM
 			else if (fn.Type == DataType.Function)
 			else if (fn.Type == DataType.Function)
 			{
 			{
 				m_ValueStack.Push(new RValue(i.NumVal));
 				m_ValueStack.Push(new RValue(i.NumVal));
-				m_ExecutionStack.Push(m_InstructionPtr);
+				m_ExecutionStack.Push(new CallStackItem()
+				{
+					SP = m_ValueStack.Count,
+					IP = m_InstructionPtr,
+				});
 				m_InstructionPtr = fn.Function.ByteCodeLocation;
 				m_InstructionPtr = fn.Function.ByteCodeLocation;
 				fn.Function.EnterClosureBeforeCall(m_Scope);
 				fn.Function.EnterClosureBeforeCall(m_Scope);
 			}
 			}
@@ -483,7 +511,7 @@ namespace MoonSharp.Interpreter.Execution.VM
 
 
 		private void ExecShortCircuitingOperator(Instruction i)
 		private void ExecShortCircuitingOperator(Instruction i)
 		{
 		{
-			bool expectedValToShortCircuit = i.OpCode == OpCode.JfOrPop;
+			bool expectedValToShortCircuit = i.OpCode == OpCode.JtOrPop;
 
 
 			RValue op = m_ValueStack.Peek();
 			RValue op = m_ValueStack.Peek();
 
 

+ 2 - 0
src/MoonSharp.Interpreter/MoonSharp.Interpreter.csproj

@@ -56,6 +56,8 @@
     <Compile Include="CoreLib\BasicMethods.cs" />
     <Compile Include="CoreLib\BasicMethods.cs" />
     <Compile Include="CoreLib\MetaTableMethods.cs" />
     <Compile Include="CoreLib\MetaTableMethods.cs" />
     <Compile Include="DataStructs\Slice.cs" />
     <Compile Include="DataStructs\Slice.cs" />
+    <Compile Include="Debugging\IDebugGuest.cs" />
+    <Compile Include="Debugging\IDebugger.cs" />
     <Compile Include="Diagnostics\Debug.cs" />
     <Compile Include="Diagnostics\Debug.cs" />
     <Compile Include="Errors\InternalErrorException.cs" />
     <Compile Include="Errors\InternalErrorException.cs" />
     <Compile Include="Execution\Behaviours\Behaviour.cs" />
     <Compile Include="Execution\Behaviours\Behaviour.cs" />

+ 1 - 1
src/MoonSharp.Interpreter/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.9.0")]
+[assembly: AssemblyVersion("0.1.9.1")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 2 - 4
src/MoonSharp.Interpreter/Tree/Expressions/OperatorExpression.cs

@@ -184,18 +184,16 @@ namespace MoonSharp.Interpreter.Tree.Expressions
 
 
 			if (m_Operator == Operator.Or)
 			if (m_Operator == Operator.Or)
 			{
 			{
-				Instruction i = bc.Jump(OpCode.JfOrPop, -1);
+				Instruction i = bc.Jump(OpCode.JtOrPop, -1);
 				m_Exp2.Compile(bc);
 				m_Exp2.Compile(bc);
-				bc.Bool();
 				i.NumVal = bc.GetJumpPointForNextInstruction();
 				i.NumVal = bc.GetJumpPointForNextInstruction();
 				return;
 				return;
 			}
 			}
 
 
 			if (m_Operator == Operator.And)
 			if (m_Operator == Operator.And)
 			{
 			{
-				Instruction i = bc.Jump(OpCode.JtOrPop, -1);
+				Instruction i = bc.Jump(OpCode.JfOrPop, -1);
 				m_Exp2.Compile(bc);
 				m_Exp2.Compile(bc);
-				bc.Bool();
 				i.NumVal = bc.GetJumpPointForNextInstruction();
 				i.NumVal = bc.GetJumpPointForNextInstruction();
 				return;
 				return;
 			}
 			}

+ 1 - 1
src/MoonSharp/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.9.0")]
+[assembly: AssemblyVersion("0.1.9.1")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 1 - 1
src/MoonSharpTests/Program.cs

@@ -12,7 +12,7 @@ namespace MoonSharpTests
 {
 {
 	class Program
 	class Program
 	{
 	{
-		public const string RESTRICT_TEST = null; //"ForEachLoop";
+		public const string RESTRICT_TEST = "LoopWithReturn";
 
 
 		static void Main(string[] args)
 		static void Main(string[] args)
 		{
 		{

+ 51 - 3
src/PerformanceComparison/Program.cs

@@ -13,9 +13,9 @@ namespace PerformanceComparison
 {
 {
 	class Program
 	class Program
 	{
 	{
-		const int ITERATIONS = 10000;
+		const int ITERATIONS = 100;
 
 
-		static  string scriptText = @"
+		static  string scriptText1 = @"
 			function move(n, src, dst, via)
 			function move(n, src, dst, via)
 				if n > 0 then
 				if n > 0 then
 					move(n - 1, src, via, dst)
 					move(n - 1, src, via, dst)
@@ -26,7 +26,55 @@ namespace PerformanceComparison
  
  
 			move(4, 1, 2, 3)
 			move(4, 1, 2, 3)
 			";
 			";
-
+		static  string scriptText = @"
+N = 8
+ 
+board = {}
+for i = 1, N do
+    board[i] = {}
+    for j = 1, N do
+		board[i][j] = false
+    end
+end
+ 
+function Allowed( x, y )
+    for i = 1, x-1 do
+	if ( board[i][y] ) or ( i <= y and board[x-i][y-i] ) or ( y+i <= N and board[x-i][y+i] ) then 
+  	    return false 
+	end
+    end		
+    return true
+end
+ 
+function Find_Solution( x )
+    for y = 1, N do
+	if Allowed( x, y ) then 
+  	    board[x][y] = true 
+	    if x == N or Find_Solution( x+1 ) then
+		return true
+	    end
+	    board[x][y] = false			 
+	end		
+    end
+    return false
+end
+ 
+if Find_Solution( 1 ) then
+    for i = 1, N do
+ 	for j = 1, N do
+  	    if board[i][j] then 
+		print( 'Q' )
+	    else 
+		print( 'x' )
+	    end
+	end
+	print( '|' )
+    end
+else
+    print( 'NO!' )
+end
+ 
+			";
 		static StringBuilder g_MoonSharpStr = new StringBuilder();
 		static StringBuilder g_MoonSharpStr = new StringBuilder();
 		static StringBuilder g_NLuaStr = new StringBuilder();
 		static StringBuilder g_NLuaStr = new StringBuilder();
 
 

+ 6 - 0
src/moonsharp.sln

@@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{F02DBEDA-6
 		..\README.md = ..\README.md
 		..\README.md = ..\README.md
 	EndProjectSection
 	EndProjectSection
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.Debugger", "MoonSharp.Debugger\MoonSharp.Debugger.csproj", "{F4F82CCE-2E13-441B-939C-63CF2343B1C9}"
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|Any CPU = Debug|Any CPU
@@ -45,6 +47,10 @@ Global
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Release|Any CPU.Build.0 = Release|Any CPU
 		{470C034F-1F1F-499C-9499-DC00B9EEEDE9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F4F82CCE-2E13-441B-939C-63CF2343B1C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F4F82CCE-2E13-441B-939C-63CF2343B1C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F4F82CCE-2E13-441B-939C-63CF2343B1C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F4F82CCE-2E13-441B-939C-63CF2343B1C9}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE