From 9e58ce60c0ff21043779c55460de9234d658fe4c Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Sun, 27 Jul 2008 23:53:18 +0000 Subject: Use new LSL compiler by default in DotNetEngine and XEngine. Fix issues 1651, 1339. --- .../DotNetEngine/Compiler/LSL/Compiler.cs | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index d5271a1..06c7387 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -72,9 +72,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL private string FilePrefix; private string ScriptEnginesPath = "ScriptEngines"; - private static LSL2CSConverter LSL_Converter = new LSL2CSConverter(); - //private static CSCodeGenerator LSL_Converter = new CSCodeGenerator(); - //private static Dictionary, KeyValuePair> m_positionMap; // mapping between LSL and C# line/column numbers + //private static LSL2CSConverter LSL_Converter = new LSL2CSConverter(); + private static CSCodeGenerator LSL_Converter = new CSCodeGenerator(); + private static Dictionary, KeyValuePair> m_positionMap; // mapping between LSL and C# line/column numbers private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); @@ -277,8 +277,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { // Its LSL, convert it to C# compileScript = LSL_Converter.Convert(Script); - //compileScript = LSL_Converter.Convert(Script); - //m_positionMap = LSL_Converter.PositionMap; + m_positionMap = LSL_Converter.PositionMap; l = enumCompileType.cs; } @@ -483,24 +482,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL string errtext = String.Empty; foreach (CompilerError CompErr in results.Errors) { - //KeyValuePair lslPos; - - //try - //{ - // lslPos = m_positionMap[new KeyValuePair(CompErr.Line, CompErr.Column)]; - //} - //catch (KeyNotFoundException) // we don't have this line/column mapped - //{ - // m_scriptEngine.Log.Debug(String.Format("[{0}]: Lookup of C# line {1}, column {2} failed.", m_scriptEngine.ScriptEngineName, CompErr.Line, CompErr.Column)); - // lslPos = new KeyValuePair(-CompErr.Line, -CompErr.Column); - //} + KeyValuePair lslPos; + + try + { + lslPos = m_positionMap[new KeyValuePair(CompErr.Line, CompErr.Column)]; + } + catch (KeyNotFoundException) // we don't have this line/column mapped + { + m_scriptEngine.Log.Debug(String.Format("[{0}]: Lookup of C# line {1}, column {2} failed.", m_scriptEngine.ScriptEngineName, CompErr.Line, CompErr.Column)); + lslPos = new KeyValuePair(-CompErr.Line, -CompErr.Column); + } // The Second Life viewer's script editor begins // countingn lines and columns at 0, so we subtract 1. - //errtext += String.Format("Line {0}, column {1}, Error Number: {2}, '{3}'\r\n", lslPos.Key - 1, lslPos.Value - 1, CompErr.ErrorNumber, CompErr.ErrorText); - errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + - ", Error Number: " + CompErr.ErrorNumber + - ", '" + CompErr.ErrorText + "'\r\n"; + errtext += String.Format("Line {0}, column {1}, Error Number: {2}, '{3}'\r\n", lslPos.Key - 1, lslPos.Value - 1, CompErr.ErrorNumber, CompErr.ErrorText); + //errtext += "Line number " + (CompErr.Line - LinesToRemoveOnError) + + // ", Error Number: " + CompErr.ErrorNumber + + // ", '" + CompErr.ErrorText + "'\r\n"; } Console.WriteLine("[COMPILER ERROR]:" + errtext); if (!File.Exists(OutFile)) -- cgit v1.1