From c935b308e67d4468437fa201a3bf444d9715f377 Mon Sep 17 00:00:00 2001 From: Dalien Talbot Date: Sun, 10 Feb 2008 22:23:11 +0000 Subject: The very beginnings of attachments (no detachments! :) --- .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 07a31d0..613aa32 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -176,9 +176,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { // 0 => 1: Get last Match m = - //Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", - Regex.Match(cache, @"(?![a-zA-Z_]+)\s*(state\s+)?(?[a-zA-Z_]+)[^a-zA-Z_\(\)]*{", - + Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); in_state = false; @@ -186,14 +184,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { // Go back to level 0, this is not a state in_state = true; - current_statename = m.Groups["statename"].Captures[0].Value; + current_statename = m.Groups[1].Captures[0].Value; //Console.WriteLine("Current statename: " + current_statename); cache = - //@"(?(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", Regex.Replace(cache, - @"(?(?![a-zA-Z_]+)\s*)" + @"(state\s+)?([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", + @"(?(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", "${s1}${s2}", - RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); } ret += cache; cache = String.Empty; @@ -214,7 +211,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL Regex.Replace(cache, @"^(\s*)((?!(if|switch|for|while)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", - RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); } ret += cache; @@ -260,10 +257,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // Replace and Script = - Regex.Replace(Script, @"<([^,>;]*,[^,>;]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Quaternion($1)", + Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); Script = - Regex.Replace(Script, @"<([^,>;)]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Vector3($1)", + Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); // Replace List []'s @@ -280,10 +277,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); - // Replace "state STATENAME" with "state("statename")" - Script = - Regex.Replace(Script, @"(state)\s+([^;\n\r]+)([\r\n\s];)", "$1(\"$2\")$3", - RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); // REPLACE BACK QUOTES foreach (string key in quotes.Keys) -- cgit v1.1