diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/CSCodeGenerator.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/CSCodeGenerator.cs index 142e791..ec34a7b 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/CSCodeGenerator.cs | |||
@@ -116,6 +116,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
116 | retstr += GenerateStatement((Statement) s); | 116 | retstr += GenerateStatement((Statement) s); |
117 | else if (s is ReturnStatement) | 117 | else if (s is ReturnStatement) |
118 | retstr += GenerateReturnStatement((ReturnStatement) s); | 118 | retstr += GenerateReturnStatement((ReturnStatement) s); |
119 | else if (s is JumpLabel) | ||
120 | retstr += GenerateJumpLabel((JumpLabel) s); | ||
121 | else if (s is JumpStatement) | ||
122 | retstr += GenerateJumpStatement((JumpStatement) s); | ||
119 | else if (s is StateChange) | 123 | else if (s is StateChange) |
120 | retstr += GenerateStateChange((StateChange) s); | 124 | retstr += GenerateStateChange((StateChange) s); |
121 | else if (s is IfStatement) | 125 | else if (s is IfStatement) |
@@ -354,12 +358,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
354 | { | 358 | { |
355 | string retstr = String.Empty; | 359 | string retstr = String.Empty; |
356 | 360 | ||
361 | // Jump label prints its own colon, we don't need a semicolon. | ||
362 | bool printSemicolon = !(s.kids.Top is JumpLabel); | ||
363 | |||
357 | retstr += Indent(); | 364 | retstr += Indent(); |
358 | 365 | ||
359 | foreach (SYMBOL kid in s.kids) | 366 | foreach (SYMBOL kid in s.kids) |
360 | retstr += GenerateNode(kid); | 367 | retstr += GenerateNode(kid); |
361 | 368 | ||
362 | retstr += ";\n"; | 369 | if (printSemicolon) |
370 | retstr += ";\n"; | ||
363 | 371 | ||
364 | return retstr; | 372 | return retstr; |
365 | } | 373 | } |
@@ -399,6 +407,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
399 | } | 407 | } |
400 | 408 | ||
401 | /// <summary> | 409 | /// <summary> |
410 | /// Generates the code for a JumpLabel node. | ||
411 | /// </summary> | ||
412 | /// <param name="jl">The JumpLabel node.</param> | ||
413 | /// <returns>String containing C# code for SYMBOL s.</returns> | ||
414 | private string GenerateJumpLabel(JumpLabel jl) | ||
415 | { | ||
416 | return String.Format("{0}:\n", jl.LabelName); | ||
417 | } | ||
418 | |||
419 | /// <summary> | ||
420 | /// Generates the code for a JumpStatement node. | ||
421 | /// </summary> | ||
422 | /// <param name="js">The JumpStatement node.</param> | ||
423 | /// <returns>String containing C# code for SYMBOL s.</returns> | ||
424 | private string GenerateJumpStatement(JumpStatement js) | ||
425 | { | ||
426 | return String.Format("goto {0}", js.TargetName); | ||
427 | } | ||
428 | |||
429 | /// <summary> | ||
402 | /// Generates the code for a IfStatement node. | 430 | /// Generates the code for a IfStatement node. |
403 | /// </summary> | 431 | /// </summary> |
404 | /// <param name="ifs">The IfStatement node.</param> | 432 | /// <param name="ifs">The IfStatement node.</param> |