aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
diff options
context:
space:
mode:
authorTedd Hansen2007-08-12 18:06:02 +0000
committerTedd Hansen2007-08-12 18:06:02 +0000
commita968d05864d205a289f05074338bb1e7165bc4e6 (patch)
tree173655a56b9ec3f997debc37a3c058c97aa807e8 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
parentCode comments and cleanup, correct datatypes for key, vector, rotation, (hope... (diff)
downloadopensim-SC_OLD-a968d05864d205a289f05074338bb1e7165bc4e6.zip
opensim-SC_OLD-a968d05864d205a289f05074338bb1e7165bc4e6.tar.gz
opensim-SC_OLD-a968d05864d205a289f05074338bb1e7165bc4e6.tar.bz2
opensim-SC_OLD-a968d05864d205a289f05074338bb1e7165bc4e6.tar.xz
LSL BuiltIn implementation is now in Compiler\LSL\LSL_BaseClass. So users won't have to reference every internal command by object.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs13
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;
3using System.Text; 3using System.Text;
4using System.Text.RegularExpressions; 4using System.Text.RegularExpressions;
5 5
6namespace LSL2CS.Converter 6namespace 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 }