Space Engineers
Classes | Public Member Functions | Static Public Attributes | Properties | List of all members
VRage.Scripting.MyScriptCompiler Class Reference

Provides a compiler for scripts, with support for a type whitelist and instruction counting. More...

Classes

struct  Message
 

Public Member Functions

 MyScriptCompiler ()
 
Task< Assembly > Compile (MyApiTarget target, string assemblyName, Script script, List< Message > messages, bool enableDebugInformation=false)
 Compiles a script. More...
 
async Task< Assembly > Compile (MyApiTarget target, string assemblyName, IEnumerable< Script > scripts, List< Message > messages, bool enableDebugInformation=false)
 Compiles a script. More...
 
void AddReferencedAssemblies (params string[] assemblyLocations)
 Adds assemblyLocations to be referenced by scripts. More...
 
void AddImplicitIngameNamespacesFromTypes (params Type[] types)
 Adds the given namespaces for automatic inclusion in the ingame script wrapper. **This method does NOT whitelist namespaces! More...
 
void AddUnblockableIngameExceptions (params Type[] types)
 Adds the given exceptions to the unblockable list for ingame scripts. These exceptions will be added to try/catch expressions so they cannot be caught in-game. More...
 
void AddConditionalCompilationSymbols (params string[] symbols)
 Adds a conditional compilation symbol More...
 
Script GetIngameScript (string code, string className, string inheritance, string modifiers="sealed")
 Creates a complete code file from an ingame script. More...
 

Static Public Attributes

static readonly MyScriptCompiler Static = new MyScriptCompiler()
 Retrieves the default script compiler. More...
 

Properties

HashSetReader< string > AssemblyLocations [get]
 Gets the assembly locations to be referenced by the scripts More...
 
HashSetReader< string > ImplicitIngameScriptNamespaces [get]
 Gets the namespaces that are to be added to the ingame script using list More...
 
HashSetReader< Type > UnblockableIngameExceptions [get]
 Gets the exception types that are to be made unblockable in ingame scripts More...
 
HashSetReader< string > ConditionalCompilationSymbols [get]
 Gets the conditional compilation symbols scripts are compiled with. More...
 
string DiagnosticOutputPath [get, set]
 If this property is set, the compiler will write altered scripts and diagnostics to this folder. More...
 
MyScriptWhitelist Whitelist [get]
 Gets the whitelist being used for this compiler. More...
 
HashSet< string > IgnoredWarnings [get]
 Contains the diagnostic codes of warnings that should not be reported by the compiler. More...
 
bool EnableDebugInformation [get, set]
 Determines whether debug information is enabled on a global level. This decision can be made on a per-script fashion on each of the compile methods, but if this property is set to true, it will override any parameter value. More...
 

Detailed Description

Provides a compiler for scripts, with support for a type whitelist and instruction counting.

Definition at line 25 of file MyScriptCompiler.cs.

Constructor & Destructor Documentation

VRage.Scripting.MyScriptCompiler.MyScriptCompiler ( )
inline

Definition at line 57 of file MyScriptCompiler.cs.

Member Function Documentation

void VRage.Scripting.MyScriptCompiler.AddConditionalCompilationSymbols ( params string[]  symbols)
inline

Adds a conditional compilation symbol

Parameters
symbols

Definition at line 458 of file MyScriptCompiler.cs.

void VRage.Scripting.MyScriptCompiler.AddImplicitIngameNamespacesFromTypes ( params Type[]  types)
inline

Adds the given namespaces for automatic inclusion in the ingame script wrapper. **This method does NOT whitelist namespaces!

Parameters
types

Definition at line 415 of file MyScriptCompiler.cs.

void VRage.Scripting.MyScriptCompiler.AddReferencedAssemblies ( params string[]  assemblyLocations)
inline

Adds assemblyLocations to be referenced by scripts.

Parameters
assemblyLocations

Definition at line 394 of file MyScriptCompiler.cs.

void VRage.Scripting.MyScriptCompiler.AddUnblockableIngameExceptions ( params Type[]  types)
inline

Adds the given exceptions to the unblockable list for ingame scripts. These exceptions will be added to try/catch expressions so they cannot be caught in-game.

Parameters
types

Definition at line 433 of file MyScriptCompiler.cs.

Task<Assembly> VRage.Scripting.MyScriptCompiler.Compile ( MyApiTarget  target,
string  assemblyName,
Script  script,
List< Message messages,
bool  enableDebugInformation = false 
)
inline

Compiles a script.

Parameters
target
assemblyName
script
messages
enableDebugInformation
Returns

Definition at line 154 of file MyScriptCompiler.cs.

async Task<Assembly> VRage.Scripting.MyScriptCompiler.Compile ( MyApiTarget  target,
string  assemblyName,
IEnumerable< Script scripts,
List< Message messages,
bool  enableDebugInformation = false 
)
inline

Compiles a script.

Parameters
target
assemblyName
scripts
messages
enableDebugInformation
Returns

Definition at line 168 of file MyScriptCompiler.cs.

Script VRage.Scripting.MyScriptCompiler.GetIngameScript ( string  code,
string  className,
string  inheritance,
string  modifiers = "sealed" 
)
inline

Creates a complete code file from an ingame script.

Parameters
code
className
inheritance
modifiers
Returns

Definition at line 483 of file MyScriptCompiler.cs.

Member Data Documentation

readonly MyScriptCompiler VRage.Scripting.MyScriptCompiler.Static = new MyScriptCompiler()
static

Retrieves the default script compiler.

Definition at line 42 of file MyScriptCompiler.cs.

Property Documentation

HashSetReader<string> VRage.Scripting.MyScriptCompiler.AssemblyLocations
get

Gets the assembly locations to be referenced by the scripts

Definition at line 88 of file MyScriptCompiler.cs.

HashSetReader<string> VRage.Scripting.MyScriptCompiler.ConditionalCompilationSymbols
get

Gets the conditional compilation symbols scripts are compiled with.

Definition at line 112 of file MyScriptCompiler.cs.

string VRage.Scripting.MyScriptCompiler.DiagnosticOutputPath
getset

If this property is set, the compiler will write altered scripts and diagnostics to this folder.

Definition at line 120 of file MyScriptCompiler.cs.

bool VRage.Scripting.MyScriptCompiler.EnableDebugInformation
getset

Determines whether debug information is enabled on a global level. This decision can be made on a per-script fashion on each of the compile methods, but if this property is set to true, it will override any parameter value.

Definition at line 143 of file MyScriptCompiler.cs.

HashSet<string> VRage.Scripting.MyScriptCompiler.IgnoredWarnings
get

Contains the diagnostic codes of warnings that should not be reported by the compiler.

Definition at line 134 of file MyScriptCompiler.cs.

HashSetReader<string> VRage.Scripting.MyScriptCompiler.ImplicitIngameScriptNamespaces
get

Gets the namespaces that are to be added to the ingame script using list

Definition at line 96 of file MyScriptCompiler.cs.

HashSetReader<Type> VRage.Scripting.MyScriptCompiler.UnblockableIngameExceptions
get

Gets the exception types that are to be made unblockable in ingame scripts

Definition at line 104 of file MyScriptCompiler.cs.

MyScriptWhitelist VRage.Scripting.MyScriptCompiler.Whitelist
get

Gets the whitelist being used for this compiler.

Definition at line 126 of file MyScriptCompiler.cs.


The documentation for this class was generated from the following file: