Browse Source

Rename of exception, updated readme

Xanathar 11 years ago
parent
commit
3ebb8cf89b

+ 14 - 6
README.md

@@ -1,12 +1,16 @@
-moonsharp
+Moon#
 =========
 =========
 
 
 An interpreter for a very close cousin of the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms.
 An interpreter for a very close cousin of the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms.
 
 
-*Project Status*
+
+**Project Status**
+
 The project has just been started,  yet it is able to parse most Lua structures and execute them correctly. The code is,  however,  heavily unoptimized. 
 The project has just been started,  yet it is able to parse most Lua structures and execute them correctly. The code is,  however,  heavily unoptimized. 
 
 
-*Roadmap*
+
+**Roadmap**
+
 * support for all core language structures (see documentation for differences between Moon# and Lua)
 * support for all core language structures (see documentation for differences between Moon# and Lua)
 * optimizations 
 * optimizations 
 * better integration between Lua/Moon# tables and CLR objects
 * better integration between Lua/Moon# tables and CLR objects
@@ -14,8 +18,12 @@ The project has just been started,  yet it is able to parse most Lua structures
 * REPL interpreter
 * REPL interpreter
 * standard library 
 * standard library 
 
 
-You can see the future backlog and status on [url:Pivotal Tracker|https://www.pivotaltracker.com/n/projects/1082626]
 
 
-*License*
-The program and libraries are released under a BSD license - see the license section.
+You can see the future backlog and status on [https://www.pivotaltracker.com/n/projects/1082626](https://www.pivotaltracker.com/n/projects/1082626 "Moon# Backlog on Pivotal Tracker")
+
+
+**License**
+
+The program and libraries are released under a 3-clause BSD license - see the license section.
+
 This work is based on the ANTLR4 Lua grammar Copyright (c) 2013, Kazunori Sakamoto.
 This work is based on the ANTLR4 Lua grammar Copyright (c) 2013, Kazunori Sakamoto.

+ 2 - 2
src/MoonSharp.Interpreter/Errors/LuaRuntimeException.cs → src/MoonSharp.Interpreter/Errors/ScriptRuntimeException.cs

@@ -8,9 +8,9 @@ using Antlr4.Runtime.Tree;
 namespace MoonSharp.Interpreter
 namespace MoonSharp.Interpreter
 {
 {
 	[Serializable]
 	[Serializable]
-	public class LuaRuntimeException : Exception
+	public class ScriptRuntimeException : Exception
 	{
 	{
-		internal LuaRuntimeException(IParseTree tree, string format, params object[] args)
+		internal ScriptRuntimeException(IParseTree tree, string format, params object[] args)
 			: base(string.Format(format, args) + FormatTree(tree))
 			: base(string.Format(format, args) + FormatTree(tree))
 		{
 		{
 
 

+ 1 - 1
src/MoonSharp.Interpreter/Execution/DataTypes/DataType.cs

@@ -49,7 +49,7 @@ namespace MoonSharp.Interpreter.Execution
 					return "thread";
 					return "thread";
 				case DataType.Tuple:
 				case DataType.Tuple:
 				default:
 				default:
-					throw new LuaRuntimeException(null, "Unexpected LuaType {0}", type);
+					throw new ScriptRuntimeException(null, "Unexpected LuaType {0}", type);
 			}
 			}
 		}
 		}
 	}
 	}

+ 10 - 10
src/MoonSharp.Interpreter/Execution/DataTypes/RValue.cs

@@ -76,20 +76,20 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		private void AssignNil()
 		private void AssignNil()
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Type = DataType.Nil;
 			Type = DataType.Nil;
 			m_HashCode = -1;
 			m_HashCode = -1;
 		}
 		}
 		private void Assign(bool v)
 		private void Assign(bool v)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Boolean = v;
 			Boolean = v;
 			Type = DataType.Boolean;
 			Type = DataType.Boolean;
 			m_HashCode = -1;
 			m_HashCode = -1;
 		}
 		}
 		public void Assign(double num)
 		public void Assign(double num)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Number = num;
 			Number = num;
 			Type = DataType.Number;
 			Type = DataType.Number;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -97,7 +97,7 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		private void Assign(string str)
 		private void Assign(string str)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			String = str;
 			String = str;
 			Type = DataType.String;
 			Type = DataType.String;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -105,7 +105,7 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		private void Assign(Closure function)
 		private void Assign(Closure function)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Function = function;
 			Function = function;
 			Type = DataType.Function;
 			Type = DataType.Function;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -113,7 +113,7 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		private void Assign(CallbackFunction function)
 		private void Assign(CallbackFunction function)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Callback = function;
 			Callback = function;
 			Type = DataType.ClrFunction;
 			Type = DataType.ClrFunction;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -121,7 +121,7 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		private void Assign(Table table)
 		private void Assign(Table table)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Table = table;
 			Table = table;
 			Type = DataType.Table;
 			Type = DataType.Table;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -129,7 +129,7 @@ namespace MoonSharp.Interpreter.Execution
 
 
 		public void Assign(RValue[] tuple)
 		public void Assign(RValue[] tuple)
 		{
 		{
-			if (this.ReadOnly) throw new LuaRuntimeException(null, "Writing on r-value");
+			if (this.ReadOnly) throw new ScriptRuntimeException(null, "Writing on r-value");
 			Tuple = tuple;
 			Tuple = tuple;
 			Type = DataType.Tuple;
 			Type = DataType.Tuple;
 			m_HashCode = -1;
 			m_HashCode = -1;
@@ -405,7 +405,7 @@ namespace MoonSharp.Interpreter.Execution
 		public void Assign(RValue value)
 		public void Assign(RValue value)
 		{
 		{
 			if (this.ReadOnly)
 			if (this.ReadOnly)
-				throw new LuaRuntimeException(null, "Assigning on r-value");
+				throw new ScriptRuntimeException(null, "Assigning on r-value");
 
 
 			this.Boolean = value.Boolean;
 			this.Boolean = value.Boolean;
 			this.Function = value.Function;
 			this.Function = value.Function;
@@ -427,7 +427,7 @@ namespace MoonSharp.Interpreter.Execution
 			if (this.Type == DataType.String)
 			if (this.Type == DataType.String)
 				return new RValue(this.String.Length);
 				return new RValue(this.String.Length);
 
 
-			throw new LuaRuntimeException(null, "Can't get length of type {0}", this.Type);
+			throw new ScriptRuntimeException(null, "Can't get length of type {0}", this.Type);
 		}
 		}
 
 
 
 

+ 5 - 5
src/MoonSharp.Interpreter/Execution/Scopes/RuntimeScope.cs

@@ -98,13 +98,13 @@ namespace MoonSharp.Interpreter.Execution
 						}
 						}
 						else
 						else
 						{
 						{
-							throw new LuaRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
+							throw new ScriptRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
 						}
 						}
 					}
 					}
 				case SymbolRefType.Invalid:
 				case SymbolRefType.Invalid:
 				default:
 				default:
 					{
 					{
-						throw new LuaRuntimeException(null, "Invalid value at resolution: {0}", symref.Name);
+						throw new ScriptRuntimeException(null, "Invalid value at resolution: {0}", symref.Name);
 					}
 					}
 			}
 			}
 		}
 		}
@@ -138,14 +138,14 @@ namespace MoonSharp.Interpreter.Execution
 						}
 						}
 						else
 						else
 						{
 						{
-							throw new LuaRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
+							throw new ScriptRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
 						}
 						}
 					}
 					}
 					break;
 					break;
 				case SymbolRefType.Invalid:
 				case SymbolRefType.Invalid:
 				default:
 				default:
 					{
 					{
-						throw new LuaRuntimeException(null, "Invalid value at resolution: {0}", symref.Name);
+						throw new ScriptRuntimeException(null, "Invalid value at resolution: {0}", symref.Name);
 					}
 					}
 			}
 			}
 		}
 		}
@@ -153,7 +153,7 @@ namespace MoonSharp.Interpreter.Execution
 		public void ExpandGlobal(int maxidx)
 		public void ExpandGlobal(int maxidx)
 		{
 		{
 			if (m_GlobalScope.Count > 0)
 			if (m_GlobalScope.Count > 0)
-				throw new LuaRuntimeException(null, "INTERNAL ERROR");
+				throw new ScriptRuntimeException(null, "INTERNAL ERROR");
 
 
 			for (int i = 0; i <= maxidx; i++)
 			for (int i = 0; i <= maxidx; i++)
 				m_GlobalScope.Add(RValue.Nil);
 				m_GlobalScope.Add(RValue.Nil);

+ 1 - 1
src/MoonSharp.Interpreter/MoonSharp.Interpreter.csproj

@@ -61,7 +61,7 @@
     <Compile Include="Execution\Behaviours\DefaultBehaviour.cs" />
     <Compile Include="Execution\Behaviours\DefaultBehaviour.cs" />
     <Compile Include="Diagnostics\AstDump.cs" />
     <Compile Include="Diagnostics\AstDump.cs" />
     <Compile Include="Diagnostics\CodeChrono.cs" />
     <Compile Include="Diagnostics\CodeChrono.cs" />
-    <Compile Include="Errors\LuaRuntimeException.cs" />
+    <Compile Include="Errors\ScriptRuntimeException.cs" />
     <Compile Include="Errors\SyntaxErrorException.cs" />
     <Compile Include="Errors\SyntaxErrorException.cs" />
     <Compile Include="Execution\DataTypes\Closure.cs" />
     <Compile Include="Execution\DataTypes\Closure.cs" />
     <Compile Include="Execution\ExecutionFlow.cs" />
     <Compile Include="Execution\ExecutionFlow.cs" />

+ 1 - 1
src/MoonSharp.Interpreter/Tree/Expressions/IndexExpression.cs

@@ -27,7 +27,7 @@ namespace MoonSharp.Interpreter.Tree.Expressions
 
 
 			if (baseValue.Type != DataType.Table)
 			if (baseValue.Type != DataType.Table)
 			{
 			{
-				throw new LuaRuntimeException(this.TreeNode, "Can't index: {0}", baseValue.Type);
+				throw new ScriptRuntimeException(this.TreeNode, "Can't index: {0}", baseValue.Type);
 			}
 			}
 			else
 			else
 			{
 			{

+ 1 - 1
src/MoonSharp.Interpreter/Tree/Expressions/SymbolRefExpression.cs

@@ -29,7 +29,7 @@ namespace MoonSharp.Interpreter.Tree.Expressions
 			RValue v = scope.Get(m_Ref);
 			RValue v = scope.Get(m_Ref);
 
 
 			if (v == null)
 			if (v == null)
-				throw new LuaRuntimeException(this.TreeNode, "Undefined symbol: {0}", m_Ref.Name);
+				throw new ScriptRuntimeException(this.TreeNode, "Undefined symbol: {0}", m_Ref.Name);
 
 
 			return v;
 			return v;
 		}
 		}

+ 1 - 1
src/MoonSharp.Interpreter/Tree/NodeBase.cs

@@ -26,7 +26,7 @@ namespace MoonSharp.Interpreter.Tree
 
 
 		public Exception RuntimeError(string format, params object[] args)
 		public Exception RuntimeError(string format, params object[] args)
 		{
 		{
-			return new LuaRuntimeException(TreeNode, format, args);
+			return new ScriptRuntimeException(TreeNode, format, args);
 		}
 		}
 
 
 		public void SyntaxAssert(bool condition, string format, params object[] args)
 		public void SyntaxAssert(bool condition, string format, params object[] args)

+ 6 - 0
src/moonsharp.sln

@@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerformanceComparison", "Pe
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharpTests", "MoonSharpTests\MoonSharpTests.csproj", "{470C034F-1F1F-499C-9499-DC00B9EEEDE9}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharpTests", "MoonSharpTests\MoonSharpTests.csproj", "{470C034F-1F1F-499C-9499-DC00B9EEEDE9}"
 EndProject
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{F02DBEDA-6AEB-461A-9557-DA7E2CB56C5A}"
+	ProjectSection(SolutionItems) = preProject
+		..\LICENSE = ..\LICENSE
+		..\README.md = ..\README.md
+	EndProjectSection
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|Any CPU = Debug|Any CPU