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.
 
-*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. 
 
-*Roadmap*
+
+**Roadmap**
+
 * support for all core language structures (see documentation for differences between Moon# and Lua)
 * optimizations 
 * 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
 * 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.

+ 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
 {
 	[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))
 		{
 

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

@@ -49,7 +49,7 @@ namespace MoonSharp.Interpreter.Execution
 					return "thread";
 				case DataType.Tuple:
 				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()
 		{
-			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;
 			m_HashCode = -1;
 		}
 		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;
 			Type = DataType.Boolean;
 			m_HashCode = -1;
 		}
 		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;
 			Type = DataType.Number;
 			m_HashCode = -1;
@@ -97,7 +97,7 @@ namespace MoonSharp.Interpreter.Execution
 
 		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;
 			Type = DataType.String;
 			m_HashCode = -1;
@@ -105,7 +105,7 @@ namespace MoonSharp.Interpreter.Execution
 
 		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;
 			Type = DataType.Function;
 			m_HashCode = -1;
@@ -113,7 +113,7 @@ namespace MoonSharp.Interpreter.Execution
 
 		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;
 			Type = DataType.ClrFunction;
 			m_HashCode = -1;
@@ -121,7 +121,7 @@ namespace MoonSharp.Interpreter.Execution
 
 		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;
 			Type = DataType.Table;
 			m_HashCode = -1;
@@ -129,7 +129,7 @@ namespace MoonSharp.Interpreter.Execution
 
 		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;
 			Type = DataType.Tuple;
 			m_HashCode = -1;
@@ -405,7 +405,7 @@ namespace MoonSharp.Interpreter.Execution
 		public void Assign(RValue value)
 		{
 			if (this.ReadOnly)
-				throw new LuaRuntimeException(null, "Assigning on r-value");
+				throw new ScriptRuntimeException(null, "Assigning on r-value");
 
 			this.Boolean = value.Boolean;
 			this.Function = value.Function;
@@ -427,7 +427,7 @@ namespace MoonSharp.Interpreter.Execution
 			if (this.Type == DataType.String)
 				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
 						{
-							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:
 				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
 						{
-							throw new LuaRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
+							throw new ScriptRuntimeException(null, "Invalid upvalue at resolution: {0}", symref.Name);
 						}
 					}
 					break;
 				case SymbolRefType.Invalid:
 				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)
 		{
 			if (m_GlobalScope.Count > 0)
-				throw new LuaRuntimeException(null, "INTERNAL ERROR");
+				throw new ScriptRuntimeException(null, "INTERNAL ERROR");
 
 			for (int i = 0; i <= maxidx; i++)
 				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="Diagnostics\AstDump.cs" />
     <Compile Include="Diagnostics\CodeChrono.cs" />
-    <Compile Include="Errors\LuaRuntimeException.cs" />
+    <Compile Include="Errors\ScriptRuntimeException.cs" />
     <Compile Include="Errors\SyntaxErrorException.cs" />
     <Compile Include="Execution\DataTypes\Closure.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)
 			{
-				throw new LuaRuntimeException(this.TreeNode, "Can't index: {0}", baseValue.Type);
+				throw new ScriptRuntimeException(this.TreeNode, "Can't index: {0}", baseValue.Type);
 			}
 			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);
 
 			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;
 		}

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

@@ -26,7 +26,7 @@ namespace MoonSharp.Interpreter.Tree
 
 		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)

+ 6 - 0
src/moonsharp.sln

@@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerformanceComparison", "Pe
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharpTests", "MoonSharpTests\MoonSharpTests.csproj", "{470C034F-1F1F-499C-9499-DC00B9EEEDE9}"
 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
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU