diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index d9042b5..99fdb0d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -3,7 +3,7 @@ using System.Collections.Generic; | |||
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Text.RegularExpressions; | 4 | using System.Text.RegularExpressions; |
5 | 5 | ||
6 | namespace LSL2CS.Converter | 6 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
7 | { | 7 | { |
8 | public class LSL2CSConverter | 8 | public class LSL2CSConverter |
9 | { | 9 | { |
@@ -30,6 +30,7 @@ namespace LSL2CS.Converter | |||
30 | public string Convert(string Script) | 30 | public string Convert(string Script) |
31 | { | 31 | { |
32 | string Return = ""; | 32 | string Return = ""; |
33 | Script = " \r\n" + Script; | ||
33 | 34 | ||
34 | // | 35 | // |
35 | // Prepare script for processing | 36 | // Prepare script for processing |
@@ -143,7 +144,7 @@ namespace LSL2CS.Converter | |||
143 | // Go back to level 0, this is not a state | 144 | // Go back to level 0, this is not a state |
144 | in_state = true; | 145 | in_state = true; |
145 | current_statename = m.Groups[1].Captures[0].Value; | 146 | current_statename = m.Groups[1].Captures[0].Value; |
146 | Console.WriteLine("Current statename: " + current_statename); | 147 | //Console.WriteLine("Current statename: " + current_statename); |
147 | cache = Regex.Replace(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", "", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 148 | cache = Regex.Replace(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", "", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
148 | } | 149 | } |
149 | ret += cache; | 150 | ret += cache; |
@@ -160,7 +161,7 @@ namespace LSL2CS.Converter | |||
160 | //Replace function names | 161 | //Replace function names |
161 | // void dataserver(key query_id, string data) { | 162 | // void dataserver(key query_id, string data) { |
162 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 163 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
163 | Console.WriteLine("Replacing using statename: " + current_statename); | 164 | //Console.WriteLine("Replacing using statename: " + current_statename); |
164 | cache = Regex.Replace(cache, @"^(\s*)((?!if|switch|for)[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1" + current_statename + "_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 165 | cache = Regex.Replace(cache, @"^(\s*)((?!if|switch|for)[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1" + current_statename + "_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
165 | } | 166 | } |
166 | 167 | ||
@@ -219,10 +220,10 @@ namespace LSL2CS.Converter | |||
219 | 220 | ||
220 | 221 | ||
221 | // Add namespace, class name and inheritance | 222 | // Add namespace, class name and inheritance |
222 | Return = "namespace SecondLife {" + Environment.NewLine; | 223 | Return = "namespace SecondLife {\r\n"; |
223 | Return += "public class Script : LSL_BaseClass {" + Environment.NewLine; | 224 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; |
224 | Return += Script; | 225 | Return += Script; |
225 | Return += "} }" + Environment.NewLine; | 226 | Return += "} }\r\n"; |
226 | 227 | ||
227 | return Return; | 228 | return Return; |
228 | } | 229 | } |