Class Compiler
Represents a compiler that can turn source schema into particular target script/schema, i.e. into database creation script for particular technology
(i.e. Oracle, MySQL, PostgreSQL, etc..) or some other code/script (i.e. RecordModel classes, JavaScript classes)
Inheritance
System.Object
Compiler
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.dll
Syntax
public abstract class Compiler : IConfigurable, INamed
Constructors
Compiler(Schema)
Declaration
protected Compiler(Schema schema)
Parameters
Type |
Name |
Description |
Schema |
schema |
|
Fields
m_CompileErrors
Declaration
protected List<SchemaCompilationException> m_CompileErrors
Field Value
Specifies the comment that will be output for decorated entity in the script
Declaration
public const string SCRIPT_COMMENT_ATTR = "script-comment"
Field Value
Type |
Description |
System.String |
|
SCRIPT_INCLUDE_SECTION
Specifies the name of the file to be included in the output verbatim, i.e.: script-include="mytypes.txt"{}
Declaration
public const string SCRIPT_INCLUDE_SECTION = "script-include"
Field Value
Type |
Description |
System.String |
|
SCRIPT_OUTPUT_NAME_ATTR
Specifies the name of the output that script text has to be placed in
Declaration
public const string SCRIPT_OUTPUT_NAME_ATTR = "output-name"
Field Value
Type |
Description |
System.String |
|
SCRIPT_TEXT_SECTION
Specifies the text to be included in the output verbatim, i.e.: script-text="INSERT INTO TBL_ABC VALUES(1, true, now())"{}
Declaration
public const string SCRIPT_TEXT_SECTION = "script-text"
Field Value
Type |
Description |
System.String |
|
Properties
CompileErrors
Returns exception errors that were generated during compilation. This property returns "planned" errors that were caused by input,
whereas CompileException returns exception that indicates some more drastic abnormality that broke the compilation
Declaration
public IEnumerable<SchemaCompilationException> CompileErrors { get; }
Property Value
CompileException
Returns exception that surfaced during compilation, or null if source has not compiled yet or no exception happened.
This exception is different form CompileErrors because it indicates some un=planned condition that broke the compilation process
Declaration
public Exception CompileException { get; }
Property Value
Type |
Description |
System.Exception |
|
HasCompiled
Returns true to indicate that compiler has already processed the source schema
Declaration
public bool HasCompiled { get; }
Property Value
Type |
Description |
System.Boolean |
|
HasErrors
Returns true when this instance did not compile properly
Declaration
public bool HasErrors { get; }
Property Value
Type |
Description |
System.Boolean |
|
Name
Returns the name of the technology that this compiler targets. i.e. "ORACLE", "RecordModel"
Declaration
public abstract string Name { get; }
Property Value
Type |
Description |
System.String |
|
NameCaseSensitivity
Determines whether output script is case sensitive
Declaration
[Config("$name-case-sensitivity|$case-sensitivity")]
public virtual NameCaseSensitivity NameCaseSensitivity { get; set; }
Property Value
NameComparison
Returns string comparison options for names that depend on target case sensitivity
Declaration
public StringComparison NameComparison { get; }
Property Value
Type |
Description |
System.StringComparison |
|
OutputPath
Determines where compiled output is placed
Declaration
[Config("$out-path")]
public string OutputPath { get; set; }
Property Value
Type |
Description |
System.String |
|
OutputPrefix
Determines the prefix for output names
Declaration
[Config("$out-name-prefix")]
public string OutputPrefix { get; set; }
Property Value
Type |
Description |
System.String |
|
Schema
Declaration
public Schema Schema { get; }
Property Value
Target
Returns type of target that this instance produces output for
Declaration
public abstract TargetType Target { get; }
Property Value
Methods
BuildNodeOutput(IConfigSectionNode, Compiler.Outputs)
Override to perform custom interpretation per particular compiler target
Declaration
protected abstract void BuildNodeOutput(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
BuildOutputs(Compiler.Outputs)
Override to perform compilation into output, the base implementation loops over all nodes and interprets
script includes
Declaration
protected virtual void BuildOutputs(Compiler.Outputs outputs)
Parameters
Compile()
Declaration
Declaration
public void Configure(IConfigSectionNode node)
Parameters
DoCompile()
Performs a compilation - this is a root override-able method where compilation starts
Declaration
protected virtual void DoCompile()
EnsureNotCompiled()
Declaration
protected void EnsureNotCompiled()
EscapeFileName(String)
Replaces incompatible characters for file names with "_"
Declaration
public string EscapeFileName(string fn)
Parameters
Type |
Name |
Description |
System.String |
fn |
|
Returns
Type |
Description |
System.String |
|
EscapeString(String)
Declaration
public virtual string EscapeString(string str)
Parameters
Type |
Name |
Description |
System.String |
str |
|
Returns
Type |
Description |
System.String |
|
GetOutputFileSuffix(String)
Override to provide meaningful extension for particular technology, i.e. SQL
Declaration
public virtual string GetOutputFileSuffix(string outputName)
Parameters
Type |
Name |
Description |
System.String |
outputName |
|
Returns
Type |
Description |
System.String |
|
IncludeScriptFile(IConfigSectionNode, Compiler.Outputs)
Performs a script file include
Declaration
protected virtual void IncludeScriptFile(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
IncludeScriptText(IConfigSectionNode, Compiler.Outputs)
Performs a verbatim script text include
Declaration
public virtual void IncludeScriptText(IConfigSectionNode node, Compiler.Outputs outputs)
Parameters
Implements
Extension Methods