diff options
author | Melanie Thielker | 2008-07-12 01:34:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-12 01:34:36 +0000 |
commit | d85774c101f5509672fc8d791fa3c923fc2071c9 (patch) | |
tree | 5282e5f1e55a85f5f6c5c56fdecff097bcf0a677 /OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |
parent | Overloads CreateMesh method of interface IMesher to pass prim physical status... (diff) | |
download | opensim-SC-d85774c101f5509672fc8d791fa3c923fc2071c9.zip opensim-SC-d85774c101f5509672fc8d791fa3c923fc2071c9.tar.gz opensim-SC-d85774c101f5509672fc8d791fa3c923fc2071c9.tar.bz2 opensim-SC-d85774c101f5509672fc8d791fa3c923fc2071c9.tar.xz |
Patch #9142 (No mantis)
Add a config option to OpenSim.ini to select between script compilers
in the XEngine without recompile.
Set UseNewCompiler=true in OpenSim.ini and try it out.
Creates the ICodeConverter interface and adapts the new compiler to it.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 82c7eda..7d7384e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -32,7 +32,7 @@ using Tools; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | 33 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools |
34 | { | 34 | { |
35 | public class CSCodeGenerator | 35 | public class CSCodeGenerator : ICodeConverter |
36 | { | 36 | { |
37 | private SYMBOL m_astRoot = null; | 37 | private SYMBOL m_astRoot = null; |
38 | private int m_braceCount; // for indentation | 38 | private int m_braceCount; // for indentation |
@@ -41,12 +41,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
41 | /// Pass the new CodeGenerator a string containing the LSL source. | 41 | /// Pass the new CodeGenerator a string containing the LSL source. |
42 | /// </summary> | 42 | /// </summary> |
43 | /// <param name="script">String containing LSL source.</param> | 43 | /// <param name="script">String containing LSL source.</param> |
44 | public CSCodeGenerator(string script) | 44 | public CSCodeGenerator() |
45 | { | 45 | { |
46 | Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); | ||
47 | // Obviously this needs to be in a try/except block. | ||
48 | LSL2CSCodeTransformer codeTransformer = new LSL2CSCodeTransformer(p.Parse(script)); | ||
49 | m_astRoot = codeTransformer.Transform(); | ||
50 | } | 46 | } |
51 | 47 | ||
52 | /// <summary> | 48 | /// <summary> |
@@ -63,8 +59,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
63 | /// Generate the code from the AST we have. | 59 | /// Generate the code from the AST we have. |
64 | /// </summary> | 60 | /// </summary> |
65 | /// <returns>String containing the generated C# code.</returns> | 61 | /// <returns>String containing the generated C# code.</returns> |
66 | public string Generate() | 62 | public string Convert(string script) |
67 | { | 63 | { |
64 | Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); | ||
65 | // Obviously this needs to be in a try/except block. | ||
66 | LSL2CSCodeTransformer codeTransformer = new LSL2CSCodeTransformer(p.Parse(script)); | ||
67 | m_astRoot = codeTransformer.Transform(); | ||
68 | string retstr = String.Empty; | 68 | string retstr = String.Empty; |
69 | 69 | ||
70 | // standard preamble | 70 | // standard preamble |