aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTedd Hansen2007-08-25 21:35:03 +0000
committerTedd Hansen2007-08-25 21:35:03 +0000
commitd9b9b1651367de4432b22282b21b1b69c1a23141 (patch)
treeb861c6a274814018c11b71ac0336149558d553d6
parentApplied dalien's libsl login patch (should now allow libsl clients to once ag... (diff)
downloadopensim-SC_OLD-d9b9b1651367de4432b22282b21b1b69c1a23141.zip
opensim-SC_OLD-d9b9b1651367de4432b22282b21b1b69c1a23141.tar.gz
opensim-SC_OLD-d9b9b1651367de4432b22282b21b1b69c1a23141.tar.bz2
opensim-SC_OLD-d9b9b1651367de4432b22282b21b1b69c1a23141.tar.xz
Script compiler should now show error on correct line number in original LSL-script.
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Executor.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
4 files changed, 16 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs
index 363d81e..e3d574b 100644
--- a/OpenSim/Region/ScriptEngine/Common/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.ScriptEngine.Common
57 57
58 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); 58 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
59 59
60 Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); 60 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
61 61
62 if (Events.ContainsKey(EventName) == false) 62 if (Events.ContainsKey(EventName) == false)
63 { 63 {
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Common
81 81
82 if (ev == null) // No event by that name! 82 if (ev == null) // No event by that name!
83 { 83 {
84 Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); 84 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
85 return; 85 return;
86 } 86 }
87 87
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index bdeed8f..a700489 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -87,6 +87,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
87 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 87 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
88 parameters.GenerateExecutable = false; 88 parameters.GenerateExecutable = false;
89 parameters.OutputAssembly = OutFile; 89 parameters.OutputAssembly = OutFile;
90 //parameters.IncludeDebugInformation = false;
90 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script); 91 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script);
91 92
92 // Go through errors 93 // Go through errors
@@ -97,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
97 string errtext = ""; 98 string errtext = "";
98 foreach (CompilerError CompErr in results.Errors) 99 foreach (CompilerError CompErr in results.Errors)
99 { 100 {
100 errtext += "Line number " + CompErr.Line + 101 errtext += "Line number " + (CompErr.Line - 1) +
101 ", Error Number: " + CompErr.ErrorNumber + 102 ", Error Number: " + CompErr.ErrorNumber +
102 ", '" + CompErr.ErrorText + "'\r\n"; 103 ", '" + CompErr.ErrorText + "'\r\n";
103 } 104 }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 2c9031c..bbb9f06 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
152 in_state = true; 152 in_state = true;
153 current_statename = m.Groups[1].Captures[0].Value; 153 current_statename = m.Groups[1].Captures[0].Value;
154 //Console.WriteLine("Current statename: " + current_statename); 154 //Console.WriteLine("Current statename: " + current_statename);
155 cache = Regex.Replace(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", "", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 155 cache = Regex.Replace(cache, @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
156 } 156 }
157 ret += cache; 157 ret += cache;
158 cache = ""; 158 cache = "";
@@ -169,7 +169,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
169 // void dataserver(key query_id, string data) { 169 // void dataserver(key query_id, string data) {
170 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 170 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
171 //Console.WriteLine("Replacing using statename: " + current_statename); 171 //Console.WriteLine("Replacing using statename: " + current_statename);
172 cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"public $1" + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 172 cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
173 } 173 }
174 174
175 ret += cache; 175 ret += cache;
@@ -202,7 +202,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
202 } 202 }
203 203
204 // Add "void" in front of functions that needs it 204 // Add "void" in front of functions that needs it
205 Script = Regex.Replace(Script, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 205 Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
206 206
207 // Replace <x,y,z> and <x,y,z,r> 207 // Replace <x,y,z> and <x,y,z,r>
208 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 208 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
@@ -228,15 +228,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
228 228
229 // Add namespace, class name and inheritance 229 // Add namespace, class name and inheritance
230 Return = "" + 230 Return = "" +
231 "using System;\r\n" + 231 "using System; " +
232 "using System.Collections.Generic;\r\n" + 232 "using System.Collections.Generic; " +
233 "using System.Text;\r\n" + 233 "using System.Text; " +
234 "using OpenSim.Region.ScriptEngine.Common;\r\n" + 234 "using OpenSim.Region.ScriptEngine.Common; " +
235 "namespace SecondLife {\r\n"; 235 "namespace SecondLife { ";
236 Return += "" + 236 Return += "" +
237 //"[Serializable] " + 237 //"[Serializable] " +
238 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; 238 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { ";
239 Return += @"public Script() { }"+"\r\n"; 239 Return += @"public Script() { } ";
240 Return += Script; 240 Return += Script;
241 Return += "} }\r\n"; 241 Return += "} }\r\n";
242 242
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index bf863b8..c7c33bb 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -123,6 +123,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
123 } 123 }
124 catch (ThreadAbortException tae) 124 catch (ThreadAbortException tae)
125 { 125 {
126 string a = tae.ToString();
127 a = "";
126 // Expected 128 // Expected
127 } 129 }
128 130