aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-01 23:33:12 +0000
committerMelanie Thielker2008-09-01 23:33:12 +0000
commita5d2674a439df4f13285ab43bde194535bc31be1 (patch)
tree42351442f99ca46ac5f722346ed073ad2b9c0113 /OpenSim/Region/ScriptEngine/Shared/CodeTools
parentAnother attempt at fixing XEngine llSetPrimitiveParams: Make it accept (diff)
downloadopensim-SC_OLD-a5d2674a439df4f13285ab43bde194535bc31be1.zip
opensim-SC_OLD-a5d2674a439df4f13285ab43bde194535bc31be1.tar.gz
opensim-SC_OLD-a5d2674a439df4f13285ab43bde194535bc31be1.tar.bz2
opensim-SC_OLD-a5d2674a439df4f13285ab43bde194535bc31be1.tar.xz
This is an attempt to fix the handling of constants in LSL.
It wraps constants in new LSLType(x), so that lists with constant values are processed correctly. Contains changes to the lsl.parser.cs that are not (yet) reflected in opensim-libs, since this experimental patch affects XEngine only. Also contains nuts.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs16
2 files changed, 15 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 2226673..b357ab6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -726,16 +726,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
726 if ("LSL_Types.LSLFloat" == c.Type) 726 if ("LSL_Types.LSLFloat" == c.Type)
727 { 727 {
728 int dotIndex = c.Value.IndexOf('.') + 1; 728 int dotIndex = c.Value.IndexOf('.') + 1;
729 // Skip first dot (in type name)
730 dotIndex = c.Value.IndexOf('.', dotIndex) + 1;
729 if (0 < dotIndex && (dotIndex == c.Value.Length || !Char.IsDigit(c.Value[dotIndex]))) 731 if (0 < dotIndex && (dotIndex == c.Value.Length || !Char.IsDigit(c.Value[dotIndex])))
730 c.Value = c.Value.Insert(dotIndex, "0"); 732 c.Value = c.Value.Insert(dotIndex, "0");
731 } 733 }
732 734
735 // commencted because the parser does it now
733 // need to quote strings 736 // need to quote strings
734 if ("LSL_Types.LSLString" == c.Type) 737 // if ("LSL_Types.LSLString" == c.Type)
735 retstr += Generate("\""); 738 // retstr += Generate("\"");
736 retstr += Generate(c.Value, c); 739 retstr += Generate(c.Value, c);
737 if ("LSL_Types.LSLString" == c.Type) 740 // if ("LSL_Types.LSLString" == c.Type)
738 retstr += Generate("\""); 741 // retstr += Generate("\"");
739 742
740 return retstr; 743 return retstr;
741 } 744 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
index 53da265..2f9a829 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
@@ -1304,24 +1304,24 @@ public class ReturnStatement_2 : ReturnStatement {
1304 public ReturnStatement_2(Parser yyq):base(yyq){}} 1304 public ReturnStatement_2(Parser yyq):base(yyq){}}
1305 1305
1306public class Constant_1 : Constant { 1306public class Constant_1 : Constant {
1307 public Constant_1(Parser yyq):base(yyq,"integer", 1307 public Constant_1(Parser yyq):base(yyq,"integer", "new LSL_Types.LSLInteger("+
1308 ((INTEGER_CONSTANT)(yyq.StackAt(0).m_value)) 1308 ((INTEGER_CONSTANT)(yyq.StackAt(0).m_value))
1309 .yytext){}} 1309 .yytext+")"){}}
1310 1310
1311public class Constant_2 : Constant { 1311public class Constant_2 : Constant {
1312 public Constant_2(Parser yyq):base(yyq,"integer", 1312 public Constant_2(Parser yyq):base(yyq,"integer", "new LSL_Types.LSLInteger("+
1313 ((HEX_INTEGER_CONSTANT)(yyq.StackAt(0).m_value)) 1313 ((HEX_INTEGER_CONSTANT)(yyq.StackAt(0).m_value))
1314 .yytext){}} 1314 .yytext+")"){}}
1315 1315
1316public class Constant_3 : Constant { 1316public class Constant_3 : Constant {
1317 public Constant_3(Parser yyq):base(yyq,"float", 1317 public Constant_3(Parser yyq):base(yyq,"float", "new LSL_Types.LSLFloat("+
1318 ((FLOAT_CONSTANT)(yyq.StackAt(0).m_value)) 1318 ((FLOAT_CONSTANT)(yyq.StackAt(0).m_value))
1319 .yytext){}} 1319 .yytext+")"){}}
1320 1320
1321public class Constant_4 : Constant { 1321public class Constant_4 : Constant {
1322 public Constant_4(Parser yyq):base(yyq,"string", 1322 public Constant_4(Parser yyq):base(yyq,"string", "new LSL_Types.LSLString(\""+
1323 ((STRING_CONSTANT)(yyq.StackAt(0).m_value)) 1323 ((STRING_CONSTANT)(yyq.StackAt(0).m_value))
1324 .yytext){}} 1324 .yytext+"\")"){}}
1325 1325
1326public class ListConstant_1 : ListConstant { 1326public class ListConstant_1 : ListConstant {
1327 public ListConstant_1(Parser yyq):base(yyq, 1327 public ListConstant_1(Parser yyq):base(yyq,