diff options
author | Dalien Talbot | 2008-02-10 22:23:11 +0000 |
---|---|---|
committer | Dalien Talbot | 2008-02-10 22:23:11 +0000 |
commit | c935b308e67d4468437fa201a3bf444d9715f377 (patch) | |
tree | db8c309027f243c35c236093c0c0780bb5327284 /OpenSim/Region/ScriptEngine/DotNetEngine | |
parent | Bugfix to state command: (diff) | |
download | opensim-SC_OLD-c935b308e67d4468437fa201a3bf444d9715f377.zip opensim-SC_OLD-c935b308e67d4468437fa201a3bf444d9715f377.tar.gz opensim-SC_OLD-c935b308e67d4468437fa201a3bf444d9715f377.tar.bz2 opensim-SC_OLD-c935b308e67d4468437fa201a3bf444d9715f377.tar.xz |
The very beginnings of attachments (no detachments! :)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 21 |
1 files changed, 7 insertions, 14 deletions
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 | |||
176 | { | 176 | { |
177 | // 0 => 1: Get last | 177 | // 0 => 1: Get last |
178 | Match m = | 178 | Match m = |
179 | //Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | 179 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", |
180 | Regex.Match(cache, @"(?![a-zA-Z_]+)\s*(state\s+)?(?<statename>[a-zA-Z_]+)[^a-zA-Z_\(\)]*{", | ||
181 | |||
182 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 180 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
183 | 181 | ||
184 | in_state = false; | 182 | in_state = false; |
@@ -186,14 +184,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
186 | { | 184 | { |
187 | // Go back to level 0, this is not a state | 185 | // Go back to level 0, this is not a state |
188 | in_state = true; | 186 | in_state = true; |
189 | current_statename = m.Groups["statename"].Captures[0].Value; | 187 | current_statename = m.Groups[1].Captures[0].Value; |
190 | //Console.WriteLine("Current statename: " + current_statename); | 188 | //Console.WriteLine("Current statename: " + current_statename); |
191 | cache = | 189 | cache = |
192 | //@"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | ||
193 | Regex.Replace(cache, | 190 | Regex.Replace(cache, |
194 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"(state\s+)?([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", | 191 | @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", |
195 | "${s1}${s2}", | 192 | "${s1}${s2}", |
196 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | 193 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
197 | } | 194 | } |
198 | ret += cache; | 195 | ret += cache; |
199 | cache = String.Empty; | 196 | cache = String.Empty; |
@@ -214,7 +211,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
214 | Regex.Replace(cache, | 211 | Regex.Replace(cache, |
215 | @"^(\s*)((?!(if|switch|for|while)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", | 212 | @"^(\s*)((?!(if|switch|for|while)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", |
216 | @"$1public " + current_statename + "_event_$2", | 213 | @"$1public " + current_statename + "_event_$2", |
217 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | 214 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
218 | } | 215 | } |
219 | 216 | ||
220 | ret += cache; | 217 | ret += cache; |
@@ -260,10 +257,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
260 | 257 | ||
261 | // Replace <x,y,z> and <x,y,z,r> | 258 | // Replace <x,y,z> and <x,y,z,r> |
262 | Script = | 259 | Script = |
263 | Regex.Replace(Script, @"<([^,>;]*,[^,>;]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Quaternion($1)", | 260 | Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Quaternion($1)", |
264 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 261 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
265 | Script = | 262 | Script = |
266 | Regex.Replace(Script, @"<([^,>;)]*,[^,>;]*,[^,>;]*)>", @"new LSL_Types.Vector3($1)", | 263 | Regex.Replace(Script, @"<([^,>;]*,[^,>;\)]*,[^,>;\)]*)>", @"new LSL_Types.Vector3($1)", |
267 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 264 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
268 | 265 | ||
269 | // Replace List []'s | 266 | // Replace List []'s |
@@ -280,10 +277,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
280 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", | 277 | Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_.]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", |
281 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 278 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
282 | 279 | ||
283 | // Replace "state STATENAME" with "state("statename")" | ||
284 | Script = | ||
285 | Regex.Replace(Script, @"(state)\s+([^;\n\r]+)([\r\n\s];)", "$1(\"$2\")$3", | ||
286 | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase); | ||
287 | 280 | ||
288 | // REPLACE BACK QUOTES | 281 | // REPLACE BACK QUOTES |
289 | foreach (string key in quotes.Keys) | 282 | foreach (string key in quotes.Keys) |