aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index ab9968f..91747af 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
90 m_warnings.Clear(); 90 m_warnings.Clear();
91 ResetCounters(); 91 ResetCounters();
92 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); 92 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true));
93 // Obviously this needs to be in a try/except block. 93
94 LSL2CSCodeTransformer codeTransformer; 94 LSL2CSCodeTransformer codeTransformer;
95 try 95 try
96 { 96 {
@@ -446,8 +446,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
446 // Jump label prints its own colon, we don't need a semicolon. 446 // Jump label prints its own colon, we don't need a semicolon.
447 printSemicolon = !(s.kids.Top is JumpLabel); 447 printSemicolon = !(s.kids.Top is JumpLabel);
448 448
449 foreach (SYMBOL kid in s.kids) 449 // If we encounter a lone Ident, we skip it, since that's a C#
450 retstr += GenerateNode(kid); 450 // (MONO) error.
451 if (!(s.kids.Top is IdentExpression && 1 == s.kids.Count))
452 foreach (SYMBOL kid in s.kids)
453 retstr += GenerateNode(kid);
451 } 454 }
452 455
453 if (printSemicolon) 456 if (printSemicolon)
@@ -711,6 +714,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
711 714
712 int comma = fls.kids.Count - 1; // tells us whether to print a comma 715 int comma = fls.kids.Count - 1; // tells us whether to print a comma
713 716
717 // It's possible that all we have is an empty Ident, for example:
718 //
719 // for (x; x < 10; x++) { ... }
720 //
721 // Which is illegal in C# (MONO). We'll skip it.
722 if (fls.kids.Top is IdentExpression && 1 == fls.kids.Count)
723 return retstr;
724
714 foreach (SYMBOL s in fls.kids) 725 foreach (SYMBOL s in fls.kids)
715 { 726 {
716 retstr += GenerateNode(s); 727 retstr += GenerateNode(s);