From 78363c3bab589bf9696b4e81b447aab0e140445c Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sun, 10 Feb 2008 21:55:26 +0000 Subject: Bugfix to state command: "state default;" rewrite to "state ("default");" --- .../ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 984c184..07a31d0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -193,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL Regex.Replace(cache, @"(?(?![a-zA-Z_]+)\s*)" + @"(state\s+)?([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", "${s1}${s2}", - RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); } ret += cache; cache = String.Empty; @@ -214,7 +214,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.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); } ret += cache; @@ -280,6 +280,10 @@ 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